Sunday, March 31, 2013

Why Ruby? Tour de Babel

Coding Horror: Why Ruby?
by Jeff Atwood (2013)

Tour de Babel
by Steve Yegge (2004, 2006)
whirlwind tour will cover C, C++, Lisp, Java, Perl, Ruby, and Python

Up-to-date list would likely include JavaScript, too...

Microsoft Build: June 26 – 28, 2013, San Francisco

Microsoft Build Developer Conference | June 26 – 28, 2013
The Moscone Center

Registration opens at 09:00am PDT, April 2, 2013
Early bird (first 500): $1,595 // Full: $2,095


San Francisco Moscone Center is apparently THE place to hold a conference.

Google I/O

Apple Worldwide Developers Conference (WWDC)

+ Intel, SalesForce, EMC, VMware, Oracle, RSA...

$$$ for developing Windows Store Apps

Microsoft’s $100-per-app bounty is both too much and not enough | Ars Technica:

Publish an app in the Windows Store by June 30 and Microsoft will give you a $100 Visa card. Developers can submit up to 20 applications for a total of $2,000 in rewards (first 10000)

But Microsoft's $100 per app scheme seems flawed on that basis, too. $100 buys a few hours of development time, if that. $100 will cover the annual subscription to publish in the Store (or two years of subscription for individuals), but it's hardly a reason to write an application.

The only apps that could credibly be developed for that kind of budget are the cookie-cutter clone apps, such as the "e-books as applications" that clutter up Apple's App Store. That kind of application is developed once, then replicated dozens of times, simply putting in a different book's text for each version.

build.windowsstore.com

Node.js: Sync vs. Async

node.js is becoming very popular,
and it is very different than a typical web server programming

Here is adjusted example from excellent video training
(that also requires you to type, since samples are not provided):
Learning Node.js LiveLessons (Sneak Peek Video Training): O'Reilly - Safari Books Online:

JavaScript is single-threaded, and node.js processing is like Windows 3.1 or 95:
"collaborative multitasking".
And there is a big difference: APIs are asynchronous.
This, along with lack of a good IDE (intellisense), comes with "cost" in productivity.


Here is a simple example of synchronous getting list of sub-directories:
function load_albums_sync(callback){
  var folder='albums';
  var file_list = fs.readdirSync(folder);
  var dirs_only=[];
  for(var i=0;i<file_list.length;i++) {
    var st=fs.statSync(folder+'\\'+file_list[i]);
    if(st.isDirectory())
      dirs_only.push(file_list[i]);
  }
  callback(null,dirs_only);
}

JavaScript Async require separating requrests from responses:
function load_album_async(callback){
  var folder='albums';
  fs.readdir(folder,function(err,file_list){
    if(err){
      callback(err);
      return;
    }
    var dirs_only=[];
    (function iterator(i){
      if(i>=file_list.length){
        callback(null,dirs_only); // done
        return;
      }
      fs.stat(folder+'\\'+file_list[i],function(err,stats){
        if(err){
          callback(err);
          return;
        }
        if(stats.isDirectory())
          dirs_only.push(file_list[i]);
        iterator(i+1);
      });
    })(0);
  });
}

Manageable, but with with nested functions and brackets, is cryptic almost as Lisp.

Observe that testing each item in the directory requires recursion,
since every item needs to be tested asynchronously:
start, and provide callback function to handle responses.

Async is not free.

Maybe Anders Hejlsberg, creator of C# and TypeScript (pre-processor for JavaScript),
can now add async-await from C# to to TypeScript,
and simplify JavaScrypt async programming also.