Posts for the month of May 2012

How it works 2

There is yet another success story of a guy who got accepted by YCombinator, which means a success.

What he did, is no more, no less a New IDE Concept, which described on this link http://www.chris-granger.com/2012/04/12/light-table---a-new-ide-concept/

First of all, one should notice, that novel ideas comes not from sub-committees of Microsoft or IBM, but from a wandering mind of a student.)

OK, lets take a little bit closer look.

The idea that the process of programming is most efficient when programming environment is interactive and implemented in the same language is not very new.

First and recent Smalltalk environments were implemented in Smalltalk, and everything in the environment could be examined, modified and evaluated on the fly.

The same concept was implemented in Lisp as Genera OS - take a note - the whole operating system in highest level language, translated directly into a microcode of a Lisp Machine, or later, Dec Alpha CPU.

Emacs is a modes example of the same concept - editor for lisp code with Lisp system inside.

The second important idea, that code must be represented not as a mere text, is also 50 years old. Lisp code is actually s-expressions made out of pairs. So, it could be easily and with minimal overhead transformed into a tree, graph, or whatever you wish.

The idea to use browser window to display the code in various fancy forms, such as bubbles or squares, is also not so innovative, Smalltalk and Lisp systems can do so easily, because their graphics and display procedures are written in the same language and immediately available to call or extension.

So, what is cool about Light Tables?

It is an web-application build on Clojure and ClojureScript - the fattest buzzwords of the moment. So, everything seems to be utilized - JVM with hundreds of of jars of dependencies, which eats gigabytes of RAM and CPUs.

Here comes the important point to understand. This is an re-implementation of ideas which were successfully implemented decades ago, hundred times more efficiently, on incomparable modest and very limited hardware, using much less code, which was more clean and readable.

This is the very definition of the crisis/bubble of the mediocre in IT. (Think of millions of Homer Simpsons with some Java/Javascript coding experience hunting for a better jobs).

Second thing to notice - all the most hyped recent developments, such as Clojure and Coffescript are about to address somehow the very shortcomings of Java and Javascript or, to name things as they are, their deep flaws.

The idea to use a Lisp-like syntax and macros along with data structures and control abstractions based on java classes is, of course, a good one, but what does it tell you about bloatedness and meaningless verbosity of Java language? The causes of Coffescript are much the same.

Now here is the question? Why YC gives money to this? Because they invest in persons, not in software of even technology. They're trying to catch that special kind of people - producers - focused inroverts, natural engineers, those who favor this activity more than anything else in life (for this moment). This is the only way to make millions - using such people.

So, there is how it works.

Reducers? Oh, come on..

There are a disturbance in the force caused by an unprecedented paradigm-shifting event - blog post by Rich Hickey, the greatest JVM language developer:

http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html

Amazingly, reducers was not invented by this great mind, and being around for quite while. There is a paper, which won several awards, published in 2009 about how to use the concept of reducers to deal with idiot's code (that uses global variables) to make it some-how run in parallel with minimum modifications. (they wrap those variables into another ADT and implement their own green threads and scheduling. All together it is called MIT Cilk.)

But it seems like an adaptation of an old idea from functional programming world (in which MIT is the years ahead of anyone else) to address actual problem faced by industry - how to run idiot's code after on multicore with minimal changes. Btw, Intel already licensed Cilk and now developing and pushing its own implementation. They even created a new branch of GCC 4.7

So, now we could see some connections.. Some smarties at MIT got grants, adopt some proven concepts, and re-implemented them "in a modern way" - using STL.))

And now, the greatest inventor of programming languages, after just a 3 years, found a novel way to back-port the concept back to.. what he called his Lisp 1, and the crowd froze in admiration. Well, we also enjoying.

Innovators, Imitators, Idiots.

Here is a famous trinity or triple I - Innovators, Imitators, Idiots. This is what happens to any market, any paradigm, any idea that becomes mainstream..

Long ago, some talented people invented object-oriented programming and implemented it in language called Smalltalk. This is not a whole story. The second, part is that objects in Smalltalk are communicating with each other using message passing, which means they are actors.

Then, another engineers designed and implemented object-oriented layer for Common Lisp. It is called Common Lisp Object System or CLOS. The second part is that object communicate to each other following Meta-Object Protocol, or MOP.

Then idiots came and start to shout on every corner that everything must be an object and that object-oriented paradigm is superior and simply the best. They gave a primitive examples, which other idiots were able to grasp, and due to peer effect, it became a common sense.

The raise of J2EE and XML madness, STL-everywhere nonsense (there are no .cpp file without words Template <class T>), and my website must be a hierarchy of objects instead of mere text files and so on we all have seen.

Now we are in the bubble, but it isn't financial one, like over-priced housing (well, all those framework-copy-paste drones are grossly overpriced) it is a bubble of idiots, a third and final phase before a collapse.

The same thing is going on in finance right now (take a seat and watch the collapse) - some smarties innovated CDS and other instruments and products. Then idiots flew in and now we have what we have. Everyone have borrowed from everyone else and then brought products they don't understand and made wrong unhedged bets, whose logic they unable to grasp. Quite standard behavior among idiots.

Now what? Well, back to the basics, as usual. Back to school. Algorithms and Data Structures, but without words Java or C++ or God forbid Javascript, is what programming is all about. Algorithms and Data Structures are (surprise! surprise!) language independent. (In some cases they are machine dependent, but that isn't difficult at all).

So, time to wipe the dust from HtDP, TAOCP, SICP, AIMA, PAIP, Introduction to Algorithms (very useful for keeping a window from closing) and learn what programming is really. hint: good coders code, good engineers reduce complexity. It is like in high-school - simplify''')

Innovators make everything more simple, idiots - more complicated.

The foundation of Lisp.

Before Computer Science (which is not a science, and not about computers) became mainstream and crowded by punks and mediocre (the bell curve, you know) mostly people proven brilliant were in the field, so, their ideas and decisions were based on deep reasoning, rather than snap-judgments of a typical consumer. They were standing on the shoulders of Titans..

Lets consider very few ideas which forms the foundation of Lisp Language, as it was defined by sir John. Ideas from:

  • Set Theory
    • Sets are collections of objects. Any type of object can be collected into a set.
    • Ordered Pairs. The entries of an ordered pair can be other ordered pairs, enabling the recursive definition of ordered lists.
    • Binary Relations are defined as a collection of ordered pairs which represents a set.
  • Graph Theory
    • Graphs are structures used to model pairwise relations between objects from a certain collection.
  • Lambda Calculus
    • anonymous functions (a form of defining function without giving a name)
    • high-order functions (a function that returns an anonymous function)
    • currying (transformation of a function with multiple arguments into a chain of function applications with a single argument)
    • the variable binding and scope (a lambda expression binds its variables, a bound variable has the lambda expression as its scope)
    • the substitution model (recursive replacing of all occurrences of a variable with its value)
    • combinators (expression that contains no free variables is said to be closed. Closed lambda expressions are also known as combinators)

Together it gives you following conclusions:

  • Almost anything could by defined as (or reduced to) a structure made out of pairs. Cons is the basic building block for a symbolic expressions.
  • Almost anything could be expressed as a list of procedure applications using the substitution model.
  • Almost anything in the real world could be modeled as a graph.
  • For a special cases (such as I/O events) we will use special forms.
  • In Untyped Lambda Calculus function application has almost no restrictions. For those who can't live without restrictions there is Haskell, and we are free to shot ourselves in the leg.
  • The Mathematical notation is not suited for a symbolic language. For those who got stuck with Math notation there is Python3.