Last updated on 2012-12-10
Everyone can learn to code. Seriously, there are a number of web pages (check this one for example) on which you can start learning right away. And with the increased popularity of interpreted languages, you get almost instant satisfaction! Type some code, press enter, and voilà! the code executes and you can see the output right away.
But learning the syntax of a programming language is only the first part of learning how to program. And IMHO, it is also the easiest one. For example, last month I finished coursera‘s Software Engineering for SaaS course (I have much to say about the course, specially the “Software Engineering” part, but that will have to wait for some later time). All of the course’s assignments were in Ruby, a relatively new but very popular programming language, in which I wasn’t fluid to say the least (actually it has many similarities to java/perl/c/etc… so most of the stuff I already knew). But I wanted to do all assignments since without practice there is no learning.
So I taught myself Ruby in while doing the HWs – I would get to a point where I didn’t know how to do something, would search the internet, and do some trial and error until it worked. I know this screams of “programming by coincidence”, but I really tried to understand what I was doing after it worked and check that it was not a coincidence that it did. It actually went quite well for the first HW, but with each HW things got more complicated, and here is why: I not only had to learn the language, I also had to learn how to work with the trillion libraries that come with the language and the frameworks used to create applications with the language. Specifically, I had to learn Rails, Cucumber, RSpec, and some other things I can’t remember.
And these are not small framework. Each one of them requires you to learn lots of stuff, starting from the framework’s conventions, where files are located, how they must be named, how they are executed, cucumber tests are written in a domain specific language (DSL) so I also had to learn some of that, and more and more… Sadly I have more things to do in my life so the last HWs came out with very bad grades (but I still got my Statement of Accomplish
All this happened some while ago, so why did I decide to write about it today? Yesterday I stayed up late trying to implement a new feature in my Eclipse OPM Editor – drawing ‘>’ every few pixels on a line connecting two nodes. Doing this relatively simple thing took me like 5 hours! I had thought for some days on how to do it, [some of the following terms are draw2d terms which can take long to explain, but I think you’ll understand the story without knowing their meaning, so humor me] and decided that using a locator and a polyline figure. But there are two polyline figures in draw2d, one called
Polyline and another one called
PolylineShape. I decided to use
PolylineShape, wrote the code and executed. Nothing happened. Changed the code, added points, color, prints. Nothing. I tried drawing a picture instead of a
Polyline and things worked, so something was wrong with the line.
To make a short story long (or the opposite), after a LOT of debugging I found that unlike a
PolylineShapes don’t know their own size, you have to provide it for them (a thing commonly done in draw2d).
So there went 4 hours of work. Even worse (or maybe better), I ended up implementing it in a completely different way, by changing how the line itself is drawn.
So knowing the language is just the beginning. There is a long and winding road after this.