Hello

I live in Singapore. A veggie food lover especially olive brown rice.

Ruby, the hot #Reddot lingo, not to be taught in school

I am lucky enough to be one of 200+ attendees of Reddot Ruby Conference, held in Singapore — a little island somewhere in Asia. You simply turn right from the red dot country of Japan, follow your GPS all the way south, till you hit near the middle of the globe knot at around 1.38 latitude angle. To be honest this is my first Ruby Conference. These days, it is really hard to be a purely Ruby talks without few of Rails centric discussions slipped in. Though, I was quite happy listening to the keynote delivered by Dave Thomas on the Ruby language itself.

 

I still remember vividly, when I was in school. I had this an assembler language assignment. It was really tough for somebody who has been all along having a happy life doing away with high level language. In assembler you have to figure out how your Program Counter flows. Where the counter is acting as your switch statement or conditional statement. Function calls involve stack in the land of very limited byte memory to play around. I was picking up my Ruby at that point of time. I was fascinated by how dynamic Ruby is. You can define methods on the runtime, have a hook when you get a missing method call, which many call those perks as meta-programming.

 

Dave showed us the slide where he redefined the method implementation for if, begin etc. It was an exercise to see if we can abuse Ruby language keyword. Yes, Ruby allows those. That brought me back to my old memory. I got really pissed with Assembler. It's like kicking your nut doing a simple conditional branching statement, jumps here, jumps there. Kind of like having to wipe my ass without pulling down my pants. Then I thought of using Ruby to generate those blocks of switch statement using meta-programming. So I will write in Ruby, the output is simply reflection of each Ruby method calls in Assembler lingo.

Continue

I should have if method, pass the block with series of direct Assembler commands, it will write out the correct jump sequences using available jump operator on the platform (could be JMP — kind of like goto, JNE — jumps not equal, JE and so on). Just imagine I would like to have code like following:

 

	if {
	  ROL R1, 3
	  MOV R2, R1
	} else {
	  MOV R3, R1
	}

 

Those if-else blocks will be replaced by corresponding jump statement sequences, so I can save a lot of my pains doing correct nesting of jump addressing. ROL, MOV and those similar operations will be handled by method_missing implementation, to simply echo back what gets called. Sounds easy, half way through out the process, a feeling of futile effort, I simply gave up. The more I progress, the more I really were really thinking into translating all high level functionalities to my quasi assembly echo chamber engine. Thought of translating def method into stack calling, hash, array, loop, repeat, while-end. Kapowwww . . . It seems like I had pulled my pants all the way down, now I don't feel like wiping my ass. Never again I mess wroughtfully with what is not intended to be :)

 

Those days were really playful. An urge to learn more about Ruby. Listening to Dave's today talk brought my reminiscence. Ruby is a nice language. Inspired by many other languages. In the keynote, Dave associated Ruby with Singlish — derivative of English language which has absorbed many local terms from Chinese, Malay, Tamil etc. I felt like associating Ruby with local food call Rojak. Rojak is a mix of many fruits like apple, pineapple, pear, starfruit with spices and sauces on top, with dried crumbled pieces of fried flour, I don't know what it is called. It is weird by it tastes really delicious.

Continue

There goes Ruby. Bits and pieces from many other languages. Well, wait a moment before thinking that Ruby is like cherry pick language out of others, I would think of Ruby as a beautiful creation of well Matz and the team mixing in all the essential language components into one, One red dot language. The main spices and sauces that keep Ruby thick and delicious is its Opinionated language. Matz is opinionated. Ruby is nice because Matz is nice.

 

Now, back to the scene of school. Will Ruby ever be a main language taught to new fresh undergrads as intro to the programming language? I had long have this wondrous thought what if They taught Ruby in school as introduction to programming. Students will quickly learn a practical language, fully object oriented and easy to program. They will come to know that everything is object, quickly identify that object can call an instance method defined by the object class. Oh oh ah .. 1 is an Object, 1.to_s means object 1 sends a method message to_s to tell himself that he should morphed into "1" as in string value "1". They start their first line with puts "Hello Ruby". That's simple. I have come back to the real fact that C/Java holds the de facto intro languages into programming 101. It seems harder to convince the university or professors to teach Ruby than doing that assignment in Java. It's a lot easier to find someone born a programmer with C/Java as their first programming lingo. It's almost as difficult to find new born programmer speaking Ruby as their first mother tongue as to find school that teaches Ruby primarily.

 

I reach my epiphany with a few reasons behind the back of my minds, confirming again that the best language to be taught in the school is what has currently be taught in the school for many decades, either Java or C and some static typed languages. Fundamentally,

Continue

  1. 1. Language like Java quickly imposes declaring your variables with corresponding types. You get immediate exposure to what data types are about. Students learn about primitives type like int, float, char, byte, and so on. In Ruby, someone has to draw idea cloud around these literals e.g. 1, 1.0, "a" are actually primitives to specify your data types. The clue of data type is less obvious. And hey you get a question like "Didn't you just tell me that everything is an object?"
  2. 2. Java quickly build the house of structure by imposing Class construction and static main method as entry of execution. Ruby is too much a wild west jungle to start putting anything you like. Someone can start with a simple puts "Hello Ruby", or def method; end without class structure. When a newbie start to program, they are afraid and they want to know the one right way. "You don't tell people to jump out the plane and lecturing them a quick recap of aerodynamic" — Dave Thomas
  3. 3. There are integrated development editor (IDE) which comes with features such as live syntax checking, clearly annotated messages for each error lines and Autocompletes. Think of eClipse or NetBeans. Autocomplete is quite useful for beginner. Those static typed languages like Java/C can really take advantages of the language nature by giving warnings and errors through the IDE.
  4. 4. Decades of teaching the same language that is widely used in the industry has probably morphed into a kind of promise such that one or two semesters of your C/Java courses is enough to prepare yourself ready to work in the industry when you are graduated. You've got the right kind of learning background as you interviewer look at you.
  5. 5. Debugging student works for static typed language like Java/C is so much easier compare to the beast of Ruby.
  6. Continue

Those among many reasons that definitely make strong points for not having Ruby as introductory programming language. In real life, we will freak out if a new born baby speaks human language the moment he/she was born. Learning a programming language is somewhat similar to learning a human language. Our baby language serves as the basic practice for mimicking and echoing any sounds we heard. Baby's learns by following others to the point where she/he voices out something beyond a bubblahballoo-esque sounding, but a real spoken understandable sound we call it human language.

 

Ruby has always been an interesting language to learn. Full of mystery and new stuffs to learn. From the early days of picking up "Poignant's Guide to Ruby" to learning the beautiful MVC way of Ruby on Rails, I had learnt much of what Ruby has to offer and to my surprise today I learnt a few more missing pieces in my big Ruby learning Maze. Good stuff. Way to go.

 

P.S. was written without proof-read. Enough for my Ruby pilgrimage, back to my cocoa coding.