2008 06 13

I’ve just come across an inspiring blog entry with the thought-provoking title You don’t know that programming language. The authors argues that knowing a programming language is very different from knowing of a programming language.

Personally, I know of C, C++, Java, Python, Ruby, LISP, Scheme and Objective-C. But do I really know them perfectly? The answer is a big NO. For instance:

But this is not a big problem according to the blogger. What is important instead is to have the right aptitudes to learn those things if ever the need arises. He mentions that one only has to master the essentials like algorithms, design patterns, etc. and the rest will follow (if needed.)

I believe he is right.

Popularity: 1% [?]

written by avinash

2008 04 15

I have just come across a great article by Alex Iskold entitled Top 10 Traits of a Rockstar Software Engineer. It is a must read for all aspiring software engineers out there… especially those who are still learning the skills in a university.

The 10 traits he mentions are:

  1. Loves To Code
  2. Gets Things Done
  3. Continuously Refactors Code
  4. Uses Design Patterns
  5. Writes Tests
  6. Leverages Existing Code
  7. Focuses on Usability
  8. Writes Maintainable Code
  9. Can Code in Any Language
  10. Knows Basic Computer Science

Phew! What can I say more? Apart from telling all of you to read the article thoroughly and to pay special attention to the various books he refers too.

Priceless.

Popularity: 2% [?]

written by avinash

2008 04 14

My Year II students are currently learning scripting with Ruby, my favorite programming language (ex aequo with Scheme I think…). Today I thought about what could be the difference between scripting and programming and I came up with:

Scripting is the same as programming except that you don’t have to worry about unnecessary details like deciding upon types, declaring classes and handling exceptional conditions. In other words, you only focus on the fundamentals.

Ruby is an excellent scripting language because it has been designed correctly. My students have had no problems understanding Ruby code that they were seeing for the first time. In fact, Ruby is a very elegant language.

Ruby is also very powerful thanks to the predefined functionalities in Ruby Core and the Ruby Standard Library. I have naturally spent some time explaining the likes of strings, regular expressions, etc. to my students but also libraries like OpenURI (used to access resources likes files, images and web services found on the Internet) and REXML (used to extract parts of an XML file.)

Consider the following Ruby script for instance:

require "open-uri"
require "rexml/document"   

artist = gets
artist.chomp!
artist.gsub!(" ","+")

input = open("http://ws.audioscrobbler.com/1.0/artist/#{artist}/toptracks.xml")
doc = REXML::Document.new(input)

puts
puts "The 10 greatest tracks are:"
puts

count = 1

doc.elements.each("mostknowntracks/track") { |track|
  puts "(#{count}) #{track.elements["name"].text}"
  count += 1
  break if count > 10
}

This simple Ruby script prompts the user for the name of an artist and queries Audioscrobbler for his/her top music tracks using OpenURI. The XML file returned is parsed using REXML and the top 10 tracks are displayed on screen. This is what I get when running it:

$ ruby top-10-tracks.rb 
Depeche Mode 

The 10 greatest tracks are:

(1) Enjoy the Silence
(2) Personal Jesus
(3) Precious
(4) Just Can't Get Enough
(5) Policy of Truth
(6) Never Let Me Down Again
(7) It's No Good
(8) Dream On
(9) Strangelove
(10) World in My Eyes

and also

$ ruby top-10-tracks.rb 
Avinash Meetoo 

The 10 greatest tracks are:

(1) This is real
(2) Play
(3) Beautiful sea
(4) Helium
(5) The myst
(6) Zygma
(7) Seduction
(8) Deception
(9) Eternity
(10) Lion Heart

Not bad for a 20-lines long script! Incidentally, I deeply believe that Ruby is a great language to learn programming.

This is a great quote from one of my heroes, Mr Steve Yegge!

Ruby’s one of the easiest languages for just about anyone to learn — it’s maybe a 3-day exercise, and after a week or so of using Ruby, you just may never look back. It’s like getting a new car: it still gets you from A to B, but without your old car’s flaky transmission, cracked windshield, and 5-year-old french-fry remnants under the driver’s seat.

Who am I to argue?

Popularity: 2% [?]

written by avinash