2012-02-11

Readability !== Comprehension: CoffeeScript Case

I am not exactly a Javascript guy, though I acknowledge the power and need for JS in today's web environment. It seems that the CoffeeScript (CS) language, which acts as a pre-processor to JS, gains some popularity in the industry.

CS removes most of the symbols like the braces and semicolons and adds whitespaces like Python; so much that it is possible to write almost complete English sentences (long one-liners) which will be processed into tens of lines of JS code.

While searching for information on CS, I've stumbled upon an interesting criticism here by Ryan Florence, which got me thinking.

While I am a fan of syntactic-sugars in my languages and powerful data operators like the generators and list-comprehensions, I found myself agreeing with many of the criticisms int the article. Especially the ideas that readability and comprehension are different things; and the fact that the symbols are faster than words.

I wouldn't declare CoffeeScript as a bad language to use based on this criticism though since most of the criticized points are optional in it; and I like coding in Python which shares many of those features. But the general idea of the power of the symbols seems to be a good one to meditate on. Maybe Python had got rid of its 'readable' syntax in favor of more symbolism while keeping its great syntactic-sugaring and crazy data operations, it would be an even better language for me :).

Alright, so this example is from the article....Which is more comprehensible?

JavaScript:
if (five && six && seven) doStuff();
CoffeeScript:
doSomething() if five and six and seven
Another one:
wash plate, brush, sink for key, plate of dishes when plate.dirty if meal.status is 'done'
That backwards 'if' statements and the use of 'and's 'or's etc. cannot be good for fast comprehension and debugging.

One of the comments (by James Treworgy) made total sense for me:

"Actually this is the thing that has kept me away from CS more than anything else. Comparison operators are at the root of mathematical equations which are the essence of computer programming: if x = y then .... Removing the visual cue seems pointless as best. It's less terse, and it confuses literals, variables, operators, and reserved words. 
Serious programmers go to a great deal of effort to identify and implement consistent patterns in their code to make it easily comprehensible. We use capital letters to mean specific things, and we use operators and braces and parenthesis to clearly define the intent of a given expression. At the essence of CS is a desire to make code read like English. 
But English is not code. It lacks adequate syntax to clearly express the kinds of things we express in code. Would a mathematician want his integral symbols replaced with the words "integral of" or his ^ notation replaced with "to the power of "? 
Doing that would only benefit people who aren't mathematicians. Likewise, I think trying to make computer code "readable" really means "make it readable to people who aren't comfortable with the language of computers." What is more readable to someone who doesn't feel comfortable with "!==" is less readable to someone who works with it every minute of every day."
Hmmm, interesting food for thought for me concerning the meaning of coding and the relationship of the coder with the code itself.

2011-02-28

What is Your Personal Software Development Process?

It seems that, we software developers are always on the hunt for the ultimate process to follow for our 'profession'. We are almost obssessed about the latest methodologies, life-cycles, X-driven developments, agile and heavy-weight approaches; even more so than any other similar industries out there (as far as I know).

Why is it so? I think, it is because of the nature of our field:

2011-02-24

Boo Language Gotchas for Python Users

Recently, I have involved in a game development project that uses Unity3D engine which I had no prior experience. I'm trying to get comfortable with it now which maybe a topic for another post. This quick post is about the Boo language which is supported by the Unity game engine for scripting work. Other alternatives are C# and Javascript. I don't fancy the idea of learning C# coming from a Java and a slight no-MS background :), and I know Javascript well enough for this project. But the thing is, coding in Javascript is not much fun.... like coding in Python (for me anyways).

2010-10-24

Another programming language popularity contest

If you are interested in the relative popularity of programming languages and the related trends, you may find TIOBE Programmıng Community Index useful. This site holds monthly popularity contests through the use of search data by Google.

2010-10-21

How to construct a makefile on Windows and make life easier for a QGIS Python Plugin

Development of a Python plugin for QGIS is a fun experience and I plan to share my relevant adventures in a future post. But for now, I want to focus on the deployment aspect of it, which can be frustrating if done manually.

2010-10-20

Visibility Analysis Plugin (VAP) for QGIS in the repository

Hi folks!

My humble visibility analysis python plugin for Quantum GIS can be downloaded from the User Contributed Repository. It is currently experimental software (version 0.0.9), but new features will be added soon according to my thesis work.

2010-05-08

Effects of Precision in Viewshed Analysis

I have added high-precision calculation option to my viewshed analysis plugin for QGIS as promised. After spending the last couple of days sick, I am back here at last :)




2010-04-28

Why Floating-Point Arithmetic is Just Wrong?!

....or why 0.1 + 0.1 + 0.1 - 0.3 is NOT equal to zero !

I know that floating point operations in computer languages are inherently wrong! In fact every seasoned developer knows this; often with some painful memories of bug-hunting sessions in the past. But newcomers might be suprised by this behavior.

So, let me first explain what is wrong with the floating point numbers? Let's use Python as our guinea pig:

2010-04-24

Just What is Python? My Initial Thoughts

As I've made some progress on my Python adventures, now may be a good time to express some of my initial opinions on the language.

Fırst of all, I've realized some of my beginner frustrations would have been greatly eased if I had understood just what kind of language was Python. So, I will try to list some primary concepts here: