Updated Jul 07
Programming go to comments

Edouard de Castro

Stirring news/topics/links

Notes

Jul 07

Swift is a multi-paradigm, compiled programming language developed by Apple for iOS and OS X development.

At last something exciting to replace Objective-C (that I’ve never resolved to learn because it was not different enough from C to feel new and exciting, yet different enough to be difficult to master).


Swift Interactive Playgrounds © Apple

Like Scala, it has tuples, optional types, pattern matching, immutables, closures / lambdas / first class functions (obligatory for functional programming), Static typing with type inference, etc…
(Seems to “miss” implicits, futures/promises, Async support)

High level programming and performance (compiled) + interoperability with legacy Objective-C (like scala is interoperable with java): nice!

p.s. native compilation and lack of full garbage collection – just using automatic reference counting (ARC) – make it ~a systems language, but a modern one!

Swift

Jun 04 12

Blockly is a web-based, graphical programming language. Users can drag blocks together to build an application. No typing required.

Google blocky


... my generic maze solution

Their maze demo is really cool, it’s a “training”; you have to resolve it by building the code…
(it took my slow brain few minutes to understand the system and “resolve” the puzzle in a generic way)

Not for core programming, but could be a nice tool to allow users to define “behaviors” / “rules” ... Could also be a nice way to introduce programming to kids?

The system (javascript) is open source. Hosted on google code

Feb 29 12

Loop Recognition in C++/Java/Go/Scala

Google implemented and benchmarked a well specified, compact benchmark in four languages: C++, Java, Scala and (its own programming language) Go and evaluated the results along several dimensions.
(They used the languages’ idiomatic container classes, looping constructs, and memory/object allocation schemes).

We find that in regards to performance, C++ wins out by
a large margin. However, it also required the most extensive
tuning efforts, many of which were done at a level of sophisti-
cation that would not be available to the average programmer.

Scala concise notation and powerful language features al-
lowed for the best optimization of code complexity.

The Java version was probably the simplest to implement,
but the hardest to analyze for performance. Specifically the
effects around garbage collection were complicated and very
hard to tune. Since Scala runs on the JVM, it has the same
issues.

Go offers interesting language features, which also allow
for a concise and standardized notation. The compilers for this
language are still immature, which reflects in both performance
and binary sizes.

language    time factor    memory footprint factor   
C++ Opt 1.0x 1.0
C++ debug 8.6x 2.8
Java 64-bit 5.8x 3.7
Java 32-bit 12.6x 3.7
Scala 3.6x 1.8
Scala opt 2.9x 1.8
Go 6g 7.0x 3.1

(scala opt: for comprehension replaced with a simple foreach )

A significant part of the original program is the specification
of a complex test graph, which is written in a procedural style.
Because of this style, the structure of the test graph is not
immediately evident. Scala made it possible to introduce a
declarative DSL which is more concise and additionally makes
the structure of the graph visible syntactically
. It should be
noted that similar changes could have been made in other
languages, e.g., in C++ via nested constructor calls, but Scala’s
support for functional programming seemed to make this really
easy and required little additional supporting code
.

google research article

May 22 11

or How I Learned to Stop Worrying and Love the JVM environment

(google doc version – with colors in code examples)

A non boring-Java (and more):

At work I’m using Scala for all my new developments. It’s a joy to use! A fast, concise and elegant general-purpose multi-paradigm programming language (object oriented, function oriented) providing seamless integration with Java, designed to scale from scripts to large complex applications.

  • Seamless integration with Java = low-risk adoption
  • multi-paradigm: object oriented and functional = expressive
  • less code = more readable = more productive
  • Multicore friendly = future proof

Used by LinkedIn, Twitter, Foursquare, UBS, EDF etc…

The scala language was created by Martin Odersky who also wrote the Java reference compiler and co-authored the Java generics. His implementation of the Scala compiler produces java bytecode that performs as good as comparable Java code.

As high level and concise as Ruby or Groovy but way faster and IDE friendly.

Trying to merge “the best” of object-oriented and functional languages; “the best” of agile (dynamic typing + lightweight syntax) and safe (static typing) / performant languages.

What I like in Scala – Highlights

Type inference

Scala has a non-annoying, non-verbose advanced static type system with type inference. Static enough to help safe refactoring and self documentation but without cluthering your code:

val txt = "bla" // "bla" is a String literal: so txt is a String... 
val r   = new java.io.StringReader( txt )

// obviously in method definition, types should be declared: 
def bar( msg:String ) = println( msg ) 
def foo( a:Int, b:Int ):Int = a + 4 * b  
    // n.b. if the return type could be inferred from the last evaluated
    // expr. it can be omitted: def foo( a:Int, b:Int ) = a + 4 * b // ok 
def filterEntry( f: Entry => Boolean ):List[ Entry ] = { ...
    // filterEntry takes function f - that should receive an Entry and
    // returns a Boolean - as an input param and returns a list of Entry

/* for parameters in passed function, type is also generally inferred 
   ("target typing"): 4, 5, 6 are integer literals, so List( 4, 5, 6 ) is 
   a factory generating an integer list, so reduceLeft ("accumulator" 
   method) takes a function that will receive integers: x and tot can
   only be integer: no need to specify their type: */
List( 4, 5, 6 ).reduceLeft( ( tot, x ) => tot + x ) // = 15

Implicit type conversions

To extend libraries retroactively, without actually changing them (safer/cleaner than Ruby open classes). You define a new class which contains the desired method and define an implicit conversion from the target class to your new class:

// "adding" a =~ regexp match method to String: 
// (java String#matches method works only on the whole string! 
// and java String#contains doesn't use regexp)

class MyStr( str: String ) { 
    def =~( re: String ): Boolean = { 
         if ( re.r.findFirstMatchIn( str ) != None ) true else false 
    } 
}
implicit def String2MyStr( str: String ): MyStr = new MyStr( str ) 

/* every time the compiler found a String with an undefined method, 
e.g. here =~ : it will look for the implicit method in the current scope that
has matching in/out types = takes a String and returns an object implementing 
=~(). It will then ~inline the conversion method... */ 

"ABC66DE" =~ "\\d+" // will return true 
// p.s. dots and parenthesis can be omitted (in some situations): 
// is shorter than "ABC66DE".=~( "\\d+" ) and than
// new MyStr( "ABC66DE" ).=~( "\\d+" )

Function-as-first-class-values

In addition to being object oriented, Scala is function oriented: Functions can be passed as parameters to other functions/methods; functions/methods can return functions (n.b. cleaner than ruby where regular code blocks are not real objects / “values” = not real first-class citizens).

Higher-order function, Closures, Currying etc…

// Even simple collection processing functional methods can come in handy!

// Cleaning a string: 
"ONCE 235354 upon A time". 
    split( "\\s+" ). 
    filterNot( _.matches( "\\d+" ) ). 
    map( w => w( 0 ).toUpper + w.substring( 1 ).toLowerCase ). 
    mkString( " " ) 
// will give "Once Upon A Time" 

// partitioning:
val ages = List( 34, 56, 12, 44, 6, 65 )
val ( youngs, olds ) = ages partition ( _ < 26 )
// youngs: List[Int] = List(12, 6)
// olds: List[Int] = List(34, 56, 44, 65). 
// closure, currying, partially applied function ... 

import scala.util.matching._

class RegStr( str: String = "" ) {
    def xall( re: String )( f: List[String] => String ) = {
        // regex#replaceAllIn method wants a matcher function eating 
        // Match objects: Embed passed f fonction eating 
        // List( matched, subgroups* ) inside function of Match matcher_f,
        // that will be a proxy to use f with replaceAllIn
        val matcher_f = ( m: Regex.Match ) => f( m.matched :: m.subgroups )
        re.r.replaceAllIn( str, matcher_f ) 
    } // xall: a functional String replaceAll
}
implicit def string2Regstr( str: String ): RegStr = new RegStr( str )

"the quick brown fox".xall( """\b(\w)(\w+)\s*""" ) {
    hit => hit(1).toUpperCase + "." 
} // gives: "T.Q.B.F."   // looks like language ctrl structure (... DSL)

// assigns a partially applied function (also a closure) to a value:
val tqbf = "the quick brown fox".xall( """\b(\w)(\w+)\s*""" )_

tqbf { ms => ms(1).toUpperCase + ms(2) } // "TheQuickBrownFox" 
tqbf { ms => ms(1) + ms(2).toUpperCase } // "tHEqUICKbROWNfOX" 
tqbf( _(1) ) // "tqbf" 

Refinement types / Structural typing

In addition to the “classical” (class/trait) typing, you can “emulate” duck typing with Scala safer, more explicit structural typing feature:

// If it walks like a duck and quacks like a duck, we could call it a duck.
class Duck { 
    def walk  = println( "flip flop" )
    def quack = println( "Quaaack!" ) 
} 
class Person { 
    def walk  = println( "Klop klop" ) 
    def quack = println( "imitating Quaaack!" ) 
}
// Handy to glue unrelated "external" classes by their abilities
def doTheDuck( duck: AnyRef{ def walk; def quack } ) = {
    // usually a param type is a Class/Interface, but could be method(s)
    // ("abilities"); here the type is AnyRef implementing walk and quack!
    duck.walk 
    duck.quack 
} 
// def walkLikeDuck[ T <: AnyRef{ def walk; def quack } ]( duck: T ) = { ...

doTheDuck( new Duck ) // flip flop, Quaaack! 
doTheDuck( new Person ) // Klop klop, imitating Quaaack!

Advanced pattern matching

Case classes – Allows to match (with “deep match” support and variable binding) on any sort of data, not only against integer types and enums like in Java switch/case-s – and Extractors:

// case classes:
case class B( a:String, b:String ) // just add a case modifier to the normal class definition
case class A( x:String, z:B )
val a = new A( "foo", new B( "*", "*" ) )

val ok = a match { 
    case A( "foo", B( e, "+" ) )           => { println( e ); 1 }
    case A( "foo", b @ B( x, y ) ) if x==y => { println( b.toString ); 2 }
    case _ => 0 
} // 2
    // tests if a is an A object constructed with "foo" and an object B 
    // itself built with any value (put in variable e) and "+" or 2
    // identical values (2nd case)... Works via extractors (see below)
    // n.b. match/case-s return a value!

// pattern matching with extractors: 
// n.b. like an object deconstructor / data extractor:

val A( str, b ) = a // equivalent to val( str, b) = A.unapply( a ).get
    // extracts data from a into str and b: 
    // str = "foo" // extracts 1st field (x) of a:A object into str:String val
    //             // = instantiate and initialize str:String val to "foo"    
    // b   = B( "*", "*" ) // extracts 2nd field (z) of a:A object into b:B val
    //                     // = instantiate and initialize b:B val to "foo" 
val A( "foo", b ) = a
    // extracts 2nd field (z) of a:A object into b:B val, but only if 1st field
    // (x) of a:A object equals "foo" (if it doesn't match: will raise 
    // scala.MatchError)
// n.b. this extractor works via the unapply method on the class A companion
//      object A (= like a static method). For "case" classes this method 
//      (and companion) is ~auto generated, but extractors can be customized 
//      (by defining unapply, unapplySeq static or/and instance! methods)
//      to do something different than just extracting object parameters, 
//      see below regexp
// n.b. extractors can be used outside case classes (and be polymorphic)...

// with regexps: (sub groups extraction!)
val email_re = """^([\w\d\-\_\.]+)(\+\d+)?@([\w\d\-\.]+)$""".r

val email_re( name, _, domain ) = "edouard.decastro@isb-sib.ch" 
    // Regex extractor extracts matched groups into strings that can be 
    // assigned together: define and initialize val name:String to 
    // edouard.decastro and domain:String to isb-sib.ch

// a custom extractor:
// extracting multiple matches (full match and captured groups in a list of Strings)
// from a regex on a String :
// (instead of just captured groups on a String full match (default Regex extractor))
import scala.util.matching._ 
class RegMore( re:String ) { 
    def unapplySeq( str:String ):Option[ List[ List[String] ] ]  = {
        Some( re.r.findAllIn( str ).matchData.toList
                      .map { m => m.matched :: m.subgroups } )
    }
}

val rem = new RegMore( """\w(\d+)""" )

val rem( a, b, _* ) = "foo54, bar18, baz, qux0" 
// a: List[String] = List( "o54", "54")
// b: List[String] = List( "r18", "18")

// n.b. couldn't use implicit conversion (to "extend" Regex into RegMore) here...


etc…

Interactive console
Tuples (mixed type “collections” ... handy to return multiple values)
Default & named arguments
Traits ((partially) implemented interfaces)
Collections (rich, mutable + immutable versions)
Parser Combinators (built in domain specific “language” for executable grammars)
Abstract fields, and types
Option type
XML literals
Actors

Has a great web framework: Lift

Mar 17 11

From the O’reilley OSCON 2010 Emerging Languages Camp (seen via an infoQ interview of Charles Nutter – mister JRuby – by Werner Schuster)

A Blend of Java and Ruby

(haven’t tried it yet… anyway is not mature and looks no better than scala except that is doesn’t require any non Java core lib)

http://www.mirah.org/wiki/MirahFeatures

In general, Mirah could be seen as a “Ruby with static types”, though Mirah is not Ruby. It does not share Ruby’s type system, core classes, standard library, or even execution model, since none of these things are imposed upon Mirah programs by the Mirah language.
Mirah is more a repurposing of Ruby’s syntax to a flexible toolchain suitable for compiling to any number of type systems and runtimes with maximum performance.”

http://www.infoq.com/articles/mirah-interview

At present, it seems the best way to describe Mirah is as “a nicer way to write Java.” So I’d say the primary target right now is Java developers that want a replacement for javac with a nicer syntax and a few additional features.
...
It turns out that the Java libraries and most of the Java type system aren’t really that cumbersome if you put a little sugar around them. For me, the best sugar available comes from Ruby syntax and some of Ruby’s “apparent” language features.
...
Mirah is a statically-typed, compiled language, but it runs well as a script too. You write what mostly looks like “Ruby with a few type annotations”, and then either use the “mirah” command to run it as a script or the “mirahc” command to compile it to JVM bytecode or Java source.

How will it stand against jRuby performance and productivity wise ? Will it be soon really usable? How fast is it? ... How could it stand against Scala?

# dynamic.mirah:

def foo( a:dynamic )              # dynamic typing
  puts "I got a #{ a.getClass.getName } of size #{ a.size }" 
end

class SizeThing

    def initialize( size:int )    # static typing
        @size = size
    end

    def size
        @size
    end

end

#foo( [ 1, 2, 3 ] )
#foo( SizeThing.new( 12 ) )
You can use both static and dynamic types: nice!
# sort_closure.mirah :

import java.util.Collections
import java.util.ArrayList

list = ArrayList.new [ 9, 5, 2, 6, 8, 1 ]
puts "unsorted: #{ list }" 

Collections.sort( list ) { | a, b | Integer( a ).compareTo( b ) }

puts "sorted: #{ list }" 
You can use code blocks that made ruby so (functional) and “beautiful”

Btw, I don’t understand why people are so attached to ’;’ and tons of parenthesis and curly brackets (even ’:=’) ? Many new languages keep those, maybe to avoid scaring old programmers? (e.g. AmbientTalk – a distibuted event-driven language – looks great if it was not for its syntax). With Mirah, striping an old language of it’s ugly and heavy -ness is refreshing! (but Scala already did the same)

Feb 29 12

HTML5 Web Sockets represent the next evolution of web communications: a full-duplex, bidirectional communications channel that operates through a single connection (TCP socket) over the Web; meaning reduction in unnecessary network traffic and latency, cleaner network code, more interactive and responsive web applications. It is not just an incremental enhancement to conventional asynchronous HTTP communications (e.g. AJAX and Comet ); it represents an enormous advance for interactive and real-time (event-driven) web applications.

WebSockets enables establishing a bidirectional communication channel. The WebSocket protocol is not build on top of HTTP, it defines the HTTP handshake behaviour to switch an existing HTTP connection to a lower level WebSocket connection. WebSockets does not try to emulate a server push channel over HTTP. It’s a ~ low level framing protocol on top of TCP.

Example (javascript, server side):
n.b. the WebSocket protocol supports a diverse set of clients (e.g. JavaScript, Adobe Flex, JavaFX, Microsoft Silverlight, etc…)

Establishing a connection:
var myWebSocket = new WebSocket("ws://www.websocket.org");
n.b. to establish a WebSocket connection, the client and server upgrade from the HTTP protocol to the WebSocket protocol during their initial (HTTP) handshake.
n.b. the connection itself is exposed via the onmessage and postMessage methods defined by the Web Socket interface.
Then associate a series of event listeners to handle each phase of the connection life cycle:
myWebSocket.onopen = function(evt) { alert("Connection open ..."); };
myWebSocket.onmessage = function(evt) { alert( "Received Message:  "  +  evt.data); };
myWebSocket.onclose = function(evt) { alert("Connection closed."); };
To send a message to the server, call postMessage (with the content you wish to deliver). Call disconnect to terminate the connection…
myWebSocket.postMessage("Hello Web Socket! Goodbye Ajax and Comet!");
myWebSocket.disconnect();

Both text and binary WebSocket data frames can be sent full-duplex, in either direction at the same time!

The Web Sockets API is being standardized by the W3C and the Web Socket protocol is being standardized by the IETF.

HTML5 Web Sockets can provide a 500:1 or – depending on the size of the HTTP headers – even a 1000:1 reduction in unnecessary HTTP header traffic and 3:1 reduction in latency. That is not just an incremental improvement; that is a revolutionary jump – a quantum leap.

Web Sockets browser / server support:
Chromium
soon in Firefox (available in the trunk of the Firefox code base)
WebKit
node.js a server side JavaScript implementation!
web-socket-ruby server/client implementation in Ruby
...

links:
The Future of the Web: HTML5 Web Sockets
HTML5 Web Sockets: A Quantum Leap in Scalability for the Web
What is an HTML 5 WebSocket [kaazing.org] (Kaazing Gateway provides an emulation layer for browsers as far back as IE 5.5)

HTML5 Server-Push Technologies, Part 2

2012:
Getting started with HTML5′s Web Sockets

Jul 19 10

(Apache) CouchDB is a peer based DISTRIBUTED database system.

Instead of storing data in rows and columns, the database manages a collection of (JSON) documents.

Apache CouchDB is a distributed, fault-tolerant and schema-free document-oriented database accessible via a RESTful HTTP/JSON API. Among other features, it provides robust, incremental replication with bi-directional conflict detection and resolution, and is queryable and indexable using a table-oriented view engine with JavaScript acting as the default view definition language.

Unlike SQL databases which are designed to store and report on highly structured, interrelated data, CouchDB is designed to store and report on large amounts of semi-structured, document oriented data. CouchDB greatly simplifies the development of document oriented applications, which make up the bulk of collaborative web applications.

It is designed for extreme scalability and is easily deployed to multi-core or multi-server clusters.

Introduction
Overview

on wikipedia

“Front-ends / APIs”:

CouchRest (ruby)
Couchdb-lucene

July 2010: CouchDB 1.0 released

Apr 14 09
Google has released App Engine support for Java … Great: JRuby + Rails can be used on the infrastructure!

JRuby on Google AppEngine: First Impressions [Article by Nick Sieger]

In the end, I’m still extremely excited about the prospect of using JRuby and Rails on AppEngine, and can’t wait to see what people build with these tools. If you want a little head start, you can check out the first Rails application I deployed, jruby-rack.appspot.com

JRuby on Rails on Google App Engine [Article by Ola Bini]

In this post I thought I’d go through the steps you need to take to get a JRuby on Rails application working on GAE/J, and also what kind of characteristics you should expect from your application.

trade-offs and constraints:

  • No regular net/http, restclient, ActiveResource usage.
  • No ActiveRecord! (use Bumble !?)
  • 1000-files limit per application! (freeze rails gems remove unused stuff!)
  • Startup/first request processing is slow.
    ...
May 15 09
V8 is the high-performance JavaScript Virtual Machine that is part of new Google’s Chrome web browser.

A high-performance Javascript could be critical for “pure-dHTML rich internet applications” when combined to other developments, like Canvas and SVG support! Then bye bye flash-flex/java applets/silverlight etc…!

V8 JavaScript engine [wikipedia]

Stricking features:

  • Dynamic JustInTime compilation to native code!
  • Multi-threaded from the ground up.
  • Efficiant non-conservative garbage collector.
  • Independent from the browser; can be used in other projects.

Nice article by Zviki Cohen: Google Chrome: ‘JavaScript Forever!’

Google wants your JavaScript web applications to run fast, stable and secure and to feel much like desktop applications. You achieve that by downloading a different runtime engine (you can call it browser, but that name is totally obsolete). That sounds like the next generation RIA [Rich Internet application] technologies: Microsoft Silverlight, Adobe Flash/Air and Sun’s JavaFX. Google are sending a clear message: “we have a lot riding on JavaScript and we’re not looking for a replacement anytime soon”.

Note: Mozilla’s next-generation JavaScript engine TraceMonkey (for firefox 3.1) will outperforms (actual implementation of) V8.

Some people are even starting to think about using V8 as a VM for other (dynamic) languages :

Dave Griswold has made interesting posts on Strongtalk-general google group:
Using V8 for other languages
Chrome and V8

We’ll have to see what the details are when the code comes out, but the release of the V8 VM is the beginning of a whole new era for dynamic languages (Smalltalk, Ruby, Python, etc).
Let the flood of fast new dynamic language implementations begin!

Could JavaScript Power A Significant Future Ruby Implementation or VM?

Side note: A nice new book about JavaScript:
JavaScript: The Good Parts

May 15 09

Run your web applications on Google’s infrastructure!

On April 8 Google launched Google App Engine, a hosted dynamic runtime environment for (now Python) web applications inside Google’s geo-distributed architecture. The Google App Engine is designed to completely house your service, and to integrate easily with Google services.
Revolution in web application hosting / deployment!?

Notes:

  • Provides dynamic web serving and persistent storage (BigTable datastore, GoogleFileSystem) with queries, sorting and transactions; automatic scaling and load balancing!
  • A free account can use up to 500MB of persistent storage and enough CPU and bandwidth for about 5 million page views a month (they plan to introduce pricing and service level agreements for additional resources, priced in a pay-as-you-go marginal resource structure, once the product leaves its limited 10,000-person)
  • Google App Engine applications are implemented using the Python programming language (other languages are to come [please!: ruby, groovy]).

(Actual) Feature limitations:

  • Python is now the only supported language (they already have many requests for Ruby, Java, Perl, PHP, and Fortran)
  • users have to have a google account ? (comment by Gábor Farkas “as far as i understand, you do not have to use google-accounts for user management. you can implement your own user/session management if you want to.”)
  • No offline processing (no cron jobs and other long-life processes)
  • Served static files limited to 1 MB

but ~all this will be addressed (already in their pipeline, see GoogleAppEngine blog post ); App Engine is going to evolve fast.

Interesting reads:
Google App Engine for developers by Niall Kennedy.
Google App Engine: History’s Next Step or Monopolistic Boondoggle? by Marshall Kirkpatrick.

Example (featured project): Vorby.com

Jul 29 10

http://www.workingwithrails.com/high-profile-organisations
and
Article by Obie Fernandez
Big Name Companies Using Ruby on Rails

List of big name firms that are using Ruby on Rails for major projects:

amazon.com, BBC, CapGemini, BPN, Cisco, C|Net, EA (Electronic Arts), IBM, JP Morgan, NASA, Oakley, Oracle, Siemens, ThoughtWorks, Yahoo!

In addition to the list above, there’s a number of companies where I have direct, or reliably indirect knowledge of Rails adoption through my friends and associates (Obie Fernandez):

John Deere, New York Times, NBC, Barclays, LA Times, Chicago Tribune, Orbitz, Google, Turner Media, Limewire

Notes:

interesting “technology profiler” site : Builtwith.com

Dec 05 07

Great article by Alex on blog.adaptiveblue.com.
Software Engineering Tips for Startups

Highlights/summary

  • Have working code: the working code is the core and the launchpad for the business (Obviously having the right business model, revenue stream and appropriate funding – or the really cool idea – won’t hurt either).
  • Have a technical (co-)founder: always have a strong technical co-founder. Someone who shares or invents the business, but also has the technical feet on the ground! Technology is what makes the business possible to begin with.
  • Hire A+ engineers who love coding: startups can not afford to have developpers who are not that good or not that passionate.
  • Keep the engineering team small and do not outsource. See The Mythical Man-Month : you can get a baby from a women in 9 month, you can’t get a baby in one month from 9 women. Hire a few of the best guns you can find, pay them well, give them stock options, make them happy.
  • Don’t bring the wrong person into the company (Ask tough questions during the interview).
  • Avoid hiring (non-technical) managers: if everyone is sharp, knows what they are doing and executes on a task, why do you need a manager?
  • Instill an agile culture: there is no room to plan for 6 months and then execute (because someone else will get there first!). The new approach is to evolve the system. See below agile note.
  • Do not re-invent the wheel: there are so many fantastic open source libraries out there that re-writing existing libraries is a waste of time (and you are not likely to do it better).

I think most of this also applies to any software development team!

Feb 29 12

Great rant by Andrew Wulf (The.Codist{}) against verbose, “low productivity” and IDE dependent languages.
It’s Time For The Dinosaurs Of Development To Go Extinct

Highlights

I’m really getting tired of the large lumbering programming languages and frameworks still in heavy use in most IT shops these days. Yes, I do mean Java + Java EE, .NET and C/C++.

Even as familiar and comfortable as Java is to me, it’s really just another dinosaur doomed to extinction (or more likely doomed to eternal damnation as Cobol is due to all the existing code bases).

To me the most important resource that a modern language/framework needs to address is the programmer’s time.

Yet it’s the little mammals, furry and (at least to much of corporate IT) insignificant that are going to revolutionize programming. It’s the languages and frameworks that simplify the programmer’s world that will win out eventually.

Maybe they are not quite evolved yet, but dynamic languages like Ruby, Javascript, etc. and functional languages like Haskell, Erlang and Scala, etc. are the first wave of a future where programming gets more productive.

Of course for many large companies there is comfort in tradition, in so called standards, in monolithic application servers (so much like the mainframe of old) and stuff that costs lots of money. Going to a new language or framework is scary business, forbid the thought of rewriting “the beast”. It’s easier to feed it year after year than replace it with a new furry mammal. The “architecture committee” sure isn’t going to recommend such a rash act.

I doubt I will change anyone’s mind still embedded in the existing Jurassic programming era but be on guard, them little furry critters you ignore now represent the first wave of future where bigger is deader.

I would add:

  • Good IDEs and refactoring tools are no surrogate for intrinsic productivity and elegance.
  • Flexibility and productivity should not be traded for false security and conformism.
  • Being safer for “programming monkeys” is no surrogate for having a competent team.
  • Metaprogramming, higher order functions, closures increase productivity and “expressivness” (and enjoyment of programming!).

Note: I have nothing against the java Virtual Machine, which is now mature and efficient, but I would prefer to use it through a modern powerfull high level language such as scala

Oct 02 07

Just got this must-have book about the REST ‘philosophy’:

RESTful Web Services
by Leonard Richardson & Sam Ruby

Putting the “Web” Back Into Web Services.

The first book that sets down best practices for “RESTful” web services.
Introduces the Resource-Oriented Architecture (ROA), a commonsense set of rules for designing RESTful web services.

The world of web services has been on a fast track to supernova ever since the architect astronauts spotted another meme to rocket out of pragmatism and into the universe of enterprises. But, thankfully, all is not lost. A renaissance of HTTP appreciation is building and, under the banner of REST, shows a credible alternative to what the merchants of complexity are trying to ram down everyone’s throats; a simple set of principles that every day developers can use to connect applications in a style native to the Web.
RESTful Web Services shows you how to use those principles without the drama, the big words, and the miles of indirection that have scared a generation of web developers into thinking that web services are so hard that you have to rely on BigCo implementations to get anything done. Every developer working with the Web needs to read this book.

David Heinemeier Hansson foreword

see also my Giving SOAP a REST post

Oct 02 07

Adobe Flex, the cross-platform rich web application environment based on Flash, is set to go open-source (part of). No more worries about being locked into a proprietary system?

Adobe announce
So maybe flex/apollo isn’t that un-interesting after all!


Schiphol Amsterdam Airport monitoring system built with Adobe Flex

I still haven’t fully grasp how it works: to me it looks Flex is a XUL like flash-based system where a User Interface description (called MXML), which can contain event-driven logic (ActionScript) [like html with javascript] is compiled into a flash ‘movie’ and served (or can be a standalone client application?).
The flash application (compiled on the fly depending on client input ? or precompiled) can be directly served to (web) clients (for them it’s then like interacting with a flash only web site) or you can mix html/flash.

The flash movie can be ~bridged to javascript inside a normal html page, so it’s possible to build mixed dHTML / Flex systems.
A flex application, like javascript, can directly access HTTPServices (through HTTP GET and POST requests) (? or indirectly through bridging to javascript ajax)

As almost every browser has flash (unlike XUL that only works with firefox), and if it’s now open source it might be quite interesting for building richer web apps!?

I think that a flex application can be compiled and stored on the server (as a standalone flash movie), then a web application server can generate html containing an <embed/object> tag pointing to the flash applet on the server.
The generated page can interact with the applet (running on the client) through javascript (via a simple bridging javascript library) : This is flex the cheap way !? You could also dynamically generate flex applets … but this is more complex and ~useless if you can mix a static flex core applet with dynamically generated html (as long as the flash applet and javascript can fully interact) !?

techcrunch article

Adobe are opening up part of their ecosystem, which is great, but don’t hold your breath for an open source Flash runtime anytime soon (unlike Java). ... but this announcement will definitely be met with calls of ‘not enough’ from the open source community and those waiting for a fully open and cross platform rich application platform from Adobe.

Other Rich Internet Application frameworks:

The Ajax Open Source Declarative Framework – XAP -

An Apache incubation ‘project’
Doesn’t required non dHTML, proprietary – e.g. flash for flex – runtimes.

  • Declarative rich user interface via XML.
  • Data binding for connecting UI to data.
  • Incremental update of web pages, declaratively and programmatically.

OpenLaszlo

Declarative (XML) UI + JavaScript transparently compiled to Flash or dHMTL only (OpenLaszlo 4)

demos

May 15 09

Nice article by Bruce Tate
Crossing borders: JavaScript’s language features

Highlights/summary

JavaScript is often ridiculed as the black sheep of programming languages. Nearly every Web developer has cursed JavaScript at one time or another.
But JavaScript is becoming increasingly important, and it remains the most broadly available scripting language for Web development. Some industry leaders are taking a fresh look at JavaScript, driven by the resurgence of its use. Programming techniques like Ajax make Web pages more interactive…

The article illustrates JavaScript features that make it attractive:

Higher-order functions. A high-order function is one that either takes functions as arguments or returns a function. This feature gives JavaScript programmers the ability to deal conceptually with actions, or functions, as easily as they deal with other variable types.

A flexible object model. JavaScript’s object model uses a relatively uncommon approach to inheritance – called prototypes. JavaScript represents objects as nested functions! JavaScript bases object construction on a prototype, or an existing instance of an object, rather than a class template!

Dynamic & weak typing: Dangerous? but could allow better productivity and flexibility.

Open objects: One can add “on the fly” new attributes and behaviors (methods) to any existing “object”...

To this list, I would add closures.

In the same vain:
Functional Javascript

(April 23 2008):
Javascript will be the Next Big Language

Oct 02 07

37Signals’ book about building a successful web application/business is now Free on-line. It details the business, design, programming, and marketing concepts and methodologies of 37signals.

A smaller, faster, better way to build software

  • Get something real up and running quickly
  • The leaner you are, the easier it is to change
  • Don’t waste time on problems you don’t have yet
  • Test your app via real world usage
  • Hire Less and Hire Later
  • Hire quick learning generalists over ingrained specialists

etc…

Mantras, epicenter design, less software, and all these other wonderful ideas won’t really matter if you don’t have the right people on board to implement them.
You need people who are passionate about what they do.

Getting Real TOC

Feb 29 12

A typical software system comprises several “core” and system-level “cross-cutting” concerns (a particular goal, concept, or area of interest).

If writing an application for handling medical records, the bookkeeping and indexing of such records is a core concern, while logging a history of changes to the record database or user database, or an authentication system, would be cross-cutting concerns
since they touch many parts of the program.

Object Oriented Programming paradigm is good for representing core concerns, but not very adapted for handling cross-cutting concerns. This results in code that is hard to design, understand, evolve and reuse.

Aspect Oriented Programming (AOP) is a paradigm for better concerns separation (than previous methodologies such as simple OO) that provides modularization of crosscutting concerns. It shows great promise for improvements in code maintenance and reusability. AspectJ is the most popular AOP language.

An aspect can alter the behavior of the base code (the non-aspect part of a program) by applying advice (additional behavior) at various join points (points in a program) specified in a quantification or query called a pointcut (that detects whether a given join point matches).

An aspect is a modular unit of crosscutting implementation. It encapsulates behaviors that affect multiple classes into reusable modules. With AOP, core concerns are implemented in an object-oriented way, then crosscutting concerns are implemented separately using aspects.

Ruby’s meta-programming facilities are powerful enough to allow for AOP-esque techniques but ruby has no dedicated AOP support: no conventional and thus reusable way of applying Aspect Oriented Programming principles. Transami has made a proposal to add AOP abilities to Ruby (does ruby really needs this !? maybe not but it’s interesting)

Note: Unit Testing, also a cross-cutting issue!:
grammatech.com article

Links:
Aspect-oriented programming wikipedia article
developer.com article
rcrchive.net article

Aquarium a framework that implements Aspect-Oriented Programming (AOP) for Ruby

Mar 12 10

Nice (and fun) article by ‘raganwald’:
Wasabi cannot cure rotten fish

Highlights:

No methodology [including agile] can ‘fix’ projects that are staffed with underperforming people. People are more important than process, period.

This is the underlying issue with the language ‘wars’ as well. No magical combination of JSON, static typing, design patterns, IDE whizzies, and frameworks will somehow help a million monkeys produce any of Shakespeare’s works.

my statement is that you can only judge a methodology on the basis of the results it delivers for a team that has already proven it can ship software. You judge it on the basis of incremental value.

What is it that causes companies to buy silver bullet after silver bullet? Why do companies lurch from consultant to methodology to programming language like infomercial junkies looking for something that will flatten their tummies without sweaty exercise or unpleasant diets? [I would answer: naiveness, greed, cluelessness]
...

I couldn’t agree more: Good tools and methodologies can only help good teams, they won’t save “miss-staffed” ones!

Feb 29 12

An antidote to bureaucracy.

  • Individuals and interactions over processes and tools.
  • Working software over comprehensive documentation.
  • Customer collaboration over contract negotiation.
  • Responding to change over following a plan.

Quite ‘old’ + I don’t believe in silver bullets but it’s nice to see that nowadays sanity and common sense are somehow trendy!...

Nice article by Martin Fowler :
martinfowler.com article

Highlights/summary

Separation of Design and Construction?

We should be very wary of the traditional engineering metaphor for building software. Coding should not be viewed as a classic construction activity. Coding is not a low (intellectual) skills construction activity, it is a design activity! Creative processes are not easily planned, and so predictability may well be an impossible target.

The Unpredictability of Requirements!

Requirements are not just changeable, they ought to be changeable. Even if the customers/users can fix their requirements, the business world isn’t going to stop for them. And many changes in the business world are completely unpredictable.

Controlling an Unpredictable Process – Iterations

Iterative development (has been around for a while under many names: incremental, evolutionary, staged, spiral…) as a feedback mechanism/reality check: frequently produce working versions of the final system that have a subset of the required features.
This leads to a style of planning where long term plans are very fluid, and the only stable plans are short term plans that are made for a single iteration.

The Adaptive Customer/User

In an adaptive process the customer/user has much finer-grained control over the software development process. At every iteration they get both to check progress and to alter the direction of the software development.

No “Plug Compatible” Programming Units!

One of the key features of agile methods is that people involved in software development are not considered replaceable parts/resources (as in traditional methodologies). Alistair Cockburn’s studies of software projects have led him to conclude the people are the most important factor in software development.
The notion of people as resources is deeply ingrained in business thinking. But for the highly creative and professional work, this does not hold.

Programmers are Responsible Professionals

Programmers are the best people to decide how to conduct their (technical) work. The Taylorist notion of a separate planning department that decides how to do things only works for uncreative jobs, if the planners understand how to do the job better than those doing it (e.g. sweatshop, army!)...

Managing a People Oriented Process

Developers must be able to make all technical decisions. Such an approach requires a sharing of responsibility where developers and management have an equal place in the leadership of the project.
Ex-developers need to recognize that their technical skills will rapidly disappear and they need to trust and rely on current developers.

Business/Users Leadership

But the technical people cannot do the whole process themselves. They need guidance on the business/users needs.
Agile teams need continuous access to business/users expertise. Furthermore this access is not something that is handled at a management level, it is something that is present for every developer.
...

Agile methods

Extreme Programming
Scrum

Where traditional organizations call for the definition of static roles, Scrum developers can change hats dynamically, often passing as analysts, testers, coders, designers, architects and integrators in a single day…

Crystal
Context Driven Testing
Lean Development
Unified Process
...

Note: By extension, all this probably also make sense for any creative activity!? It’s nice to see that people realize that bureaucracy does not represent a surrogate for talent and creativity, but instead is more like an old-fashioned burden.

Agile, lightweight, adaptive/fluid processes are the present trends in development methodologies, and this is not a bad thing! Nevertheless they too are not a surrogate for competence!

Feb 29 12

Nice article by ‘coffeemug at gmail.com’:
fp ramblings @ defmacro.org

Highlights/summary

Like object oriented programming, functional programming is a set of ideas, not a set of strict guidelines.
A function is a very basic unit in functional programming. Functions are used for almost everything, even the simplest of calculations. Even variables are replaced with functions. In functional programming variables are simply aliases for expressions. They cannot be modified. All variables can only be assigned to once!

By now you are probably wondering how you could possibly write anything reasonably complicated this way. If every symbol is non-mutable we cannot change the state of anything!
It turns out that functional programs can keep state, except they don’t use variables to do it. They use functions instead. The state is kept in function parameters, on the stack. If you want to keep state for a while and every now and then modify it, you write a recursive function.
You may be interested why someone would want to program in this manner ?:

Nice for unit testing, debugging, concurrent programming, hot code deployment …

Functional languages offer a different kind of abstraction tools that make you forget you’ve ever liked modifying variables. One such tool is capability to work with higher order functions = functions that operate on other functions (accept them as arguments, modify and manufacture other functions). ...currying, lazy evaluation (e.g. infinite data structures, monads), continuations, (function) pattern matching, closures (note: you can use those techniques with Perl! http://hop.perl.plover.com).

Opinion: Difficult, marginal and academic image (...that’s a cool point…), but if the future of computing is indeed massive parallelism; might help a lot!

see also:
wikipedia.org Functional programming language
The Next Mainstream Programming Languages: A Game Developer’s Perspective (Tim Sweeney, Epic Game. Programming requirements of the video game industry with hard number and real code. Startlingly insightful suggestions to address these problems, mostly coming from… Haskell!)
Why People Aren’t Using Haskell

Feb 29 12

Not directly progamming related, but information theory related.
A Chaitin constant or halting probability is a construction by Gregory Chaitin which describes the probability that a randomly generated program for a given model of computation or programming language will halt. It is usually denoted with Ω.

It is a normal, uncompressible and transcendental number which can be defined but cannot be computed (beyond a certain value N – which is non-computable too! – you cannot compute the value of any bit of Ω). This means one can prove that there is no algorithm which produces the digits of Ω.


MetaMath! The Quest for Omega. Gregory Chaitin book where he shares his profound insights into the inescapable, shocking limitations that infuse mathematics and computation.

‘Don’t understand a bit but is really poetical, philosophical!
... together with Gödel’s incompleteness theorem this implies that there can never be a “theory of everything” for all of mathematics and maybe, by extension that there is a limit to all possible knowledge… The limits of reason!...

wikipedia.org Chaitin’s constant
scienceblogs.com article

Oct 02 07

Debunking the (slowness) Myth of High-level Languages

Nice article by David Chisnall :
Debunking the Myth of High-level Languages

Highlights

High-level languages are not intrinsically slow! David Chisnall explains how programming in a low-level language can make a compiler’s job harder, essentially wasting effort and slowing down your program’s processing.

...using a virtual machine doesn’t necessarily translate to overhead.
Research on dynamic recompilers such as Dynamo in 2000 and earlier showed that a just-in-time recompiler, running MIPS code on a MIPS machine, could give a miss-staffed speed increase over running the same code on the raw hardware. The reason for this improvement is that a virtual machine could perform some categories of optimization that weren’t available to a static compiler.
...
Another thing that’s slow in Java is array accesses. Let’s look at arrays for a second. An array is nothing more than a blob of memory with fixed-size elements. This is actually a very low-level construct. Arrays in Java try to mimic a low-level concept with high-level semantics. This is fairly obviously a bad idea.
The problem, isn’t that Java is a high-level language; it’s that it chose the wrong abstractions.
Other data structures work significantly better in high-level languages. A dictionary or associative array, for example, can be implemented transparently by a tree or a hash table (or some combination of the two) in a high-level language; the runtime can even decide which, based on the amount and type of data fed to it. This kind of dynamic optimization is simply impossible in a low-level language without building higher-level semantics on top and meta-programming – at which point, you would be better off simply selecting a high-level language and letting someone else do the optimization.

made me think: ... ‘wish there were a nice and fast VM for Ruby! [Rite (Ruby >=1.9)?, YARV, Parrot for ruby (Cardinal)!?, JRuby? ...]
see Ruby VirtualMachineOptions
[August 9, 2006]: Parrot 0.4.6 is released; includes new partial (?) Ruby and Javascript implementations.

Feb 02 11

OK, everyone talks about Ruby but can it get the job done?

The drawbacks of “scripting” languages primarily lie in the perception that they are not “serious” programming languages. Ruby seems to have overcome such PR hurdles by it’s elegance, it’s hype and the Rails framework! (and replacing the word “scripting” with “high-level programming” and “dynamic” in people’s mind!)

Ruby is a pure object (no primitive types) interpreted language. Its typing model is dynamic (typing is enforced at run time, the type of a variable can be altered at any time) but strong (typing is enforced rigorously, types cannot be casted) with type inference (types are not declared explicitly but inferred from syntactic context); all this allowing duck typing – types are defined as the capabilities of objects; allowing polymorphic substitution.
It is dynamic: classes or even instances can be extended, modified at runtime (“open” classes). Functions may be added, new classes of objects may be created, new modules may appear.
This eases code reuse/extension and represents a huge productivity boost.
Increasingly, people are finding that the productivity gains they get from dynamic languages and metaprogramming are enormous.
So it is more and more difficult for change-resistant and so called “serious” programmers to belittles Ruby.

Obviously ruby is not the only high level, dynamic, pure object language in town, but in association with frameworks like Rails (for database-backed web applications) – the language ‘killer application’, the trojan horse to win minds and businesses – it clearly has an edge!
(Note: It “won my mind” at least! This page was built and is displayed through my MeMiki “online information manager” engine built with Ruby on Rails)

So what’s left for Ruby bashers? It is slow (~true, but there are plenty of ways to hook up C/C++ to Ruby if you really need the speed! Moreover speed doesn’t matter if the core application is not the speed bottleneck), it won’t scale well (the ultimate “can’t prove it but that sounds good and authoritative” – FUD argument).
Ok, well, what about real businesses that are built with ruby:

  • The data management web applications from 37signals that claims 400’000 users, is built with Ruby on Rails (...no outside funding, no debt, and only 7 people: book ... rails creator, David Heinemeier Hansson, works for this company!).
  • Odeo (podcasting portal),
  • Robot Co-op (43things , 43places , 43people social networking apps)
    are handling millions of request a day!
    etc…

so, who said that ruby is a nice toy but can’t be used for large scale project?

links:

http://www.ruby-doc.org
http://www.ruby-doc.org/docs/ProgrammingRuby
http://www.rubyweeklynews.org
Interesting Ruby debate
try ruby! – in your browser

Will the Enterprise change Ruby, or will Ruby change the Enterprise?

To me the value of metaprogramming, duck-typing and open classes is that they permit a tremendously powerful way to re-imagine the mapping of elements from real-world problem domains to elements of computer programs. They help us model the world better. And yes, that can mean changing the behavior of already-established and stable objects.

note about ruby job market (August 2006, seen in an O’Reilly Radar report):
radar.oreilly.com article: ruby_book_sales_pass_perl

in the job market, which trails the book market considerably, we see that while Ruby is the only programming language with an increase in job postings (shown by the bright green in the treemap below), it is still considerably smaller than the job market for Perl or Python (and java)

The adjusted totals of jobs calling for programming skills (as a percentage of all jobs) is down across the board, except for Ruby.

Fun article: Interviewing Ruby Programmers

Ruby Metaprogramming techniques

Dec 23 10

Book by Bruce A. Tate
...”Java’s reign is coming to an end”... Ruby!, Ruby!...

oreilly.com – beyondjava

blog:
intertwingly.net – Beyond-Java
interview (of several prominent authors, bloggers, and developers):
onjava.com – ruby-the-rival.html

Positive note about Java seen in the comments on
oreillynet.com our_long_java_nightmare

I for one am enormously grateful that popularity of Java has finally nailed the myths that anything with a VM or garbage collection is a toy / useless / too slow for real world tasks.
For that, if nothing else, Java has been a huge step forward :-)

Feb 29 12

SOAP isn’t the only game in town for Web services interfacing (unless being ignorant of what made and continues to make the Web successful), REST offers a perfectly good solution for the majority of implementations, with greater flexibility and lower overhead.

While REST (Representational S*tate *Transfer) originally referred to a collection of architectural principles, people now often use the term in a looser sense to describe any simple web-based interface for programmatic access, that uses XML (or YAML, JSON, plain text) over HTTP without the extra abstractions of MEP & Remote Procedure Call based approaches like the web services SOAP protocol.
The ‘naked’ data, without any envelope is retrieved as the content of an HTTP query response (or in its header). The input data for the operation to be performed is part of the query parameters, and the target URL represents the resource being accessed.
HTTP POST, GET, PUT, DELETE “verbs”/methods can be used, respectively to perform: Create, Read, Update, Delete operation on a target resource (url). OPTIONS method might be use for resource description and service discovery, HEAD for resource status monitoring. Alternatively, simple GET/POST operations with additional parameters to mimic other modes might be used (“low” REST, ).
Relying on just few uniform methods to manipulate distinct resources represents an object oriented way of thinking as opposed to the method – procedural – oriented SOAP approches.


devx.com article
REST-Web-Services @ xfront.com
infoq.com article

tbray.org On-REST

webservices.xml.com rest
Highlights:

Managing our data/resources is complex enough, why add extra useless levels of complexity for the API. “The web is the API!”
Explicit typing and protocol independence are not surrogates for simplicity, elegance and scalability!

Here’s the radical idea: no matter what your problem, you can and should think about it as a data object/resource manipulation problem rather than as a method oriented API design problem. Think of your web server as an information repository, like a database on which one can do uniform data manipulation operations. Even web services with complicated work flows can be organized in a URI-centric “object/resource oriented” manner.

RestResources

Oct 02 07
JSON  go to comments

(JavaScript Object Notation, ~a subset of YAML ) is a lightweight data-interchange format; a serialized representation of data structures.

example

{"people": [{"name" : "edouard", "id" : 12}, {"name" : "test", "id" : 13}]}

JSON’s simplicity has resulted in its widespread use, especially as an alternative to XML for Ajax. It is less verbose and faster to parse (if using eval()) than XML. In JavaScript (and many other dynamic languages) JSON can be parsed trivially using the eval() procedure (caution: security issues!).

http://www.json.org
http://en.wikipedia.org/wiki/JSON

Aug 11 10

Douglas Engelbart

Modern computer “father”

Graphical user interface (2-dimensional display editing), mouse, video teleconferencing, groupware, email, hypertext, document version control etc… all in the 60s!!


Engelbart’s 1968 demo flyer
Doug Engelbart’s mother of all demos video, 1968!

Mother of all demos wikipedia article

The Mouse Turns 40 -video

Working Together – Douglas Engelbart & Harvey Lehtman


Engelbart timeline mural


Ted Nelson

The other “father” of the web

American sociologist, philosopher, and pioneer of information technology.

hypertext and hypermedia concept / term creator.

Started project Xanadu ... following Vannevar Bush and its theoretical machine called the memory extender (“Memex” c.f. Krell computer terminal ;-) footsteps…. inspiring Tim Berners-Lee in creating the web.

Jul 14 10


White & Nerdy [latest Weird Al]
Note: first appearance of an O’Reilly book in a music video!...

Medieval tech support [introducing the book in a scroll world]

Cookie Monster eats computer [1971!]

The programmer Hierearchy

We all know that there is a hierarchy of programmers. Ruby programmers look down on everybody. C programmers look down on most. Right at the very bottom are Java programmers who are looked down on by everybody, but also consider themselves superior to all other, thus making Java Programmers equivalent to the Erotic Furries in the Geek Hierarchy.

The geek hierarchy

Web2.0 bullshit generator
e.g. “tag podcasting weblogs”

Web Economy Bullshit Generator
e.g. “repurpose extensible synergies”

Can you tell a coder from a serial killer?

Geek cartoons/humour





http://xkcd.com


Add a comment:

(required)

(will not be published) (required)

(optional)

(ascii characters only)