Archive for August 28th, 2011

The Finnish lesson

August 28, 2011

Via Abi: Why are Finland’s schools successful? The short answer: a strong public school system. But the long answer in the piece is worth every minute of your time that you spend reading it.

Mukul Kesavan takes sides

August 28, 2011

Mukul Kesavan begins by telling why he likes Team Anna’s protest; and in the last four paragraphs does a U turn to tell why he has decided to change sides:

I tried hard, therefore, to empathize with Team Anna. But it didn’t last. N. Ram of The Hindu, in the course of a televized discussion, urged critics of the jan lok pal bill to ignore the angularities and eccentricities of individuals in Team Anna the better to appreciate the social significance of the movement. This is easier said than done because it’s harder to read social forces than it is to react to human faces.

So when Anna pointed to the scar on his forehead (which he attributed to hostile Pakistani fire) and declared that he was now engaged in fighting home-grown thieves and then called them traitors for good measure, I was appalled in a shabby-genteel way by the crassness of his rhetoric. But Anna, at least, had an excuse: the Congress’s minions had called him names too. To watch the likes of Arindam Chaudhuri and Om Puri bluster and splutter their way through diatribes about the political class, was to learn that this movement was without intelligence or discrimination.

The clincher, though, was a performance by Kiran Bedi, a member, along with Kejriwal and Prashant Bhushan, of Anna’s core group. Arvind Kejriwal is the political strategist, Prashant Bhushan is the in-house legal mind; it isn’t clear to the outsider what Kiran Bedi brings to the inner circle. Annoyed by Parliament’s failure to begin a debate on the lok pal bill on Friday, she began to slag off Parliament in particular and members of parliament in general. They were lazy, callous and unworthy of respect. Even as she was speaking, she spotted an MP in Ramlila Maidan and began heckling him publicly.

In the end, it wasn’t what she said as much as the way she said it that torpedoed the reluctant admiration I had built up for Team Anna’s campaign. Kiran Bedi, pioneering policewoman, pranced around the stage trying to parody the uselessness of MPs. The wisdom of doing this aside, it was the grotesqueness of the performance that was striking. She borrowed a scarf, draped it like dupatta over her own head and launched herself into a little skit, looking for all the world like a talentless schoolgirl bidding for attention. In the end, I turned against the jan lok pal crusade not on ideological grounds, but aesthetic ones. Anna was a star, but his repertory company, it turned out, was full of amateurs and bit players auditioning for lead roles, small people dwarfed by a giant stage.

A must-read piece.

Go

August 28, 2011

After Scala, it is Go that Bruce Eckel is excited about; along the way, he also tells about some general philosophy about developing programming languages and learning them:

I’ve been intrigued by the Go language since I first encountered it about 6 months ago. There are some great online lectures that you can find here.

Go solves a number of problems that C++ and Java didn’t. Unlike C++, Go has a garbage collector which eliminates a large class of memory-leak issues. Go has a much cleaner syntax than either language, eliminating a great deal of programmer overhead when writing and reading code. Indeed, based on syntax alone I personally classify Go, along with Scala, as a next-generation language because they respect the needs of the programmer; they serve the programmer rather than telling what hoops must be jumped through.

But one of the biggest issues solved by Go is parallel programming. Go has built-in support for Communicating Sequential Processes (CSP). You can start any function f() as a separate process by saying go f(), and then communicate with that process using channels (which safely transport messages back and forth). It’s worth noting that Go was initially designed to create servers (not web servers per se, just general-purpose servers as we’ll explore in this article) and has expanded to a general-purpose systems language; it creates natively-compiled executables and tends to be more closely aligned to the hardware — thus “goroutines” tend to be tied to the processors/cores of a single machine. Scala, in contrast, seems to be aiming for distributed multiprocessing systems, especially when you look at the direction that Akka is going (the rumor is that Akka will eventually be folded into Scala).

My interest here is to make the case for hybrid programming. I distinguish hybrid from polyglot programming; the latter means that the programmer has learned and benefits from knowing multiple languages (this is essential, I believe, as it allows you to see solutions in multiple ways rather than being restricted to the lens of a single language). When I say hybrid programming, I mean that a single application is crafted using multiple languages.

In my experience, all languages do some things well but have blind spots. When you use those languages, you can move very quickly when utilizing their “power regions” but the project slows way down and becomes expensive when you encounter the problem areas. Why not use multiple languages and let each one work to its strength?

Coming from a background in C/C++, I find Go to be a real breath of fresh air. At this point, I think it would be a far better choice than C++ for doing systems programming because it will be much more productive and it solves problems that would be notably more difficult in C++. This is not to say that I think C++ was a mistake — on the contrary, I think it was inevitable. At the time, we were deeply mired in the C mindset, slightly above assembly language and convinced that any language construct that generated significant code or overhead was impractical. Things like garbage collection or language support for parallelism were downright ridiculous and no one took them seriously. C++ took the first baby steps necessary to drag us into this larger world, and Stroustrup made the right choices in making C++ comprehensible to the C programmer, and able to compile C. We needed that at the time.

We’ve had many lessons since then. Things like garbage collection and exception handling and virtual machines, which used to be crazy talk, are now accepted without question. The complexity of C++, and the resulting impact on productivity, is no longer justified. All the hoops that the C++ programmer had to jump through in order to use a C-compatible language make no sense anymore — they’re just a waste of time and effort. Now, Go makes much more sense for the class of problems that C++ was originally intended to solve.

Sandwiched between these sections is example codes with explanations as to making a hybrid program of python and Go, which, more programming oriented among you might enjoy!