Archive for January, 2010

An alternative way to choose a language

January 31, 2010
Serving tea at the community kitchen at Bardon, October 1942

'Serving tea at the community kitchen at Bardon, October 1942' by Flickr user State Library of Queensland, Australia

Whilst browsing through some Ruby blogs via Delicious (after having just added mine), I happened upon a blog post entitled, “4 Wrong Ways and 1 Awesome Way to Choose a Language“. After having just written my own “How to choose a programming language” blog post I felt confident that this chap would cite “because it sounds sexy” as the awesome way.

Surprisingly, that was not his reason!

In fact, his reason for choosing his language of choice (which is Python, so clearly not chosen because it sounds sexy) is the community. When you’re working in a language with a good community, there is a good chance that whatever you want to do has already been done by someone else and is available for you to re-use. To be honest that is one of the reasons I picked Ruby. If you go with the current trendy language there is bound to be lots of support and resources out there for noobs like myself.

I actually left a comment on his blog mentioning my method of choosing a language and I suddenly got over 100 visits to this blog. Considering I had not had one single visitor before that, I was quite happy with the increase in traffic. Unfortunately, I get the feeling that no one agrees with my sentiment as I did not get a single comment on the post. It’s difficult enough being motivated to write a blog with 0 daily visitors, but when you do get an influx it would be nice if someone left a comment…

… even if only to ridicule me! :p

Over my Head, Part I: Encapsulation

January 30, 2010

'encapsulation' by Flickr user Swiv

Of course I fully expect that over the course of reading Part two of Beginning Ruby there will be frequent “Huh?” moments.

I just had one in Chapter 6 “Classes, Objects , and Modules.


Encapsulation is the ability for an object to have certain methods and attributes available for use publicly (from any section of code), but for others to be visible only within the class itself or by other objects of the same class.

Ok, I think maybe typing that out helped me understand the concept but the code examples that followed did not make much sense to me.

I could stick around and try and get it or I could move on. I’ll move on for now. If it’s that important I’m sure I’ll encounter it again and its meaning will become clearer.

N.B. The Flickr pic above is one of the first Creative Commons images I found doing a search for ‘encapsulation’. It’s of St. Andrew’s Cathedral, which is near where I’m from. Hurrah!

Ruby’s Building Blocks

January 28, 2010
Building Blocks

'Building Blocks' by Flickr user Artful Magpie

So I’ve just finished Part 1 of Beginning Ruby – “Foundations and Scaffolding”.

Chapter 1 just tells you how to install Ruby. I already had it installed so I was able to skip most of it. The explanations do look fairly idiot-proof so it would have been at my level if I hadn’t already installed it, when I was messing about with some other idiot-proof guide.

Chapter 2 is explaining some of the basic concepts about Ruby and why these make it a great programming language. As I previously had no concepts about any programming language it was not a hard sell. I buy it – Ruby rocks not only because Ruby is a nice word, it also rocks because of “Object orientation“. Basically everything is an Object, and for reasons that are not yet entirely apparent to me, that rocks more than a very rocky thing.

Other concepts that are explained include Class, Variable and Method. I did actually feel like this chapter laid a pretty good foundation for me, and I “got it” better than when I was reading through the other e-book guide.

Chapter 3 started getting deep. It covers the important building blocks of Ruby. I’ve read this one twice as it’s pretty difficult to get it all first time. The concepts it introduces include: Regular Expressions, Arrays, Hashes, Code Blocks, Ranges and Symbols. Even on a second read I’ve probably only got about 20-30% of that stuff locked in my head, but hopefully it will become reinforced as I go in to Part 2.

In Chapter 4 you build a little text analyser application in to which you can plug any passage of text and it tells you number of words, sentences, ‘interesting sentences’ etc. It’s a nice little exercise but I wonder how much I just copied code like a robot and how much I really learnt from it.

Chapter 5 steps back for a minute and takes some time to explain the history of Ruby and introduces you to some of the ecosystem – blogs and forums that are good resources to learn more about Ruby. I joined up to the Rail Forum, because according to the book it is “particularly friendly to beginners”. I’m going to need friendly….

Tin robot

'Tin robot' by Flickr user Glamhag

If I’ve got one criticism of the book so far, it’s probably that it needs to have some small exercises to do to make sure concepts are actually being understood and remembered. It explains things in such a clear way that it’s a shame I can’t go off and try some immediately related challenge with the answer at the back of the book with an explanation. I’m worried that the code that I have created, such as the analyser, I just did robot-style. I know there are various “Ruby exercise” websites, so I’ll maybe try them later and link to them when I do.

On with Part 2. Apparently by the end of part 2, I’ll be able to “develop Ruby applications complete with complex class and object arrangements of my own; know how to test, document, and deploy them; and use databases and external data sources to feed you applications.” Ummm…. I wouldn’t be so sure… GULP!

How to start learning Ruby

January 24, 2010

'You Noob on a shirt' by Flickr user xrrr

The problem with learning to program from a starting point of knowing nothing about anything, is that you are in a fairly unique position. There aren’t many people who just decide one day to “learn to program”. This makes it pretty difficult to find suitable information about how and where to start.

Sure, if you go off and Google for “how to learn Ruby” you will find loads of websites which will try to help you get started. The problem is that most of these websites are written for people who can already programme a bit. There is no need for them to explain some of the most basic ideas, as their audience already knows them. If you’re already a Python whizzkid, it’s fairly unlikely you’re going to need to be told what a text editor is.

I really had a hard time finding a resource that started from the assumption that the reader knew absolutely nothing.

The first place I tried was an e-book I purchased called “Learn to Program” by Chris Pine. It describes itself as “A Place to Start for the Future Programmer”. Well that sounds like me!

It’s quite a decent read. Chris’ style is nice and light-hearted and he does explain things quite well. However, I did feel that I didn’t really get the basics from reading this e-book. It felt to me a little like it assumed that initial tiny bit of knowledge about programming languages that I was missing. I gave it a go, and worked through the basics but didn’t quite “get it”. It was some of the important concepts like classes that I didn’t seem to pick up in this book.

Yes, that’s right, I needed something that assumed the reader was even dumber.

I found a good thread on Hacker News: Learning to Hack for the very first time. Reading this guy’s situation, he sounded exactly like me. He had zero experience of programming and wanted to learn to “make stuff”.

The suggestions in the thread are really useful. The guy already had a site running on Rails, hence he was going to learn Ruby.

Among the many recommendations, was: Beginning Ruby: From Novice to Professional, 2nd Edition (Expert’s Voice in Open Source)
*. I bought this book and I’ve found it excellent so far. When the author says “novice”, he really means it. The book starts out assuming you know nothing and explains all the necessary concepts so that doofuses like me can get it. Inevitably the learning curve is steep, but it definitely starts at the right level for someone like me. I’m sure it would also be a good book for people who want to learn Ruby and aren’t complete noobs.

So my recommendation if you’re a complete noob like me is to buy that book above and start from there. I’ll talk more about the book as I work through it. I’ve already gone through a few chapters but I’ll try and write a couple of quick posts to catch up.

*that’s an affiliate link. i.e. if you click on it and buy something from I get a few pennies. I actually logged in to my affiliate account for the first time in 4 years to make that link. Turns out I’ve got £4.25 waiting for me. What annoys me about Amazon affiliate scheme is that if I put a link for, I wouldn’t earn any money if someone from the US clicked on the link, then decided to buy the book from .com. How daft is that? What’s the point in having a affiliate account then?

How to choose a programming language

January 23, 2010

Ruby under lens

I’m pretty sure I always knew that ‘C’ was some kind of programming language. I didn’t really do any computing classes at school other than what was obligatory in the 1st year, but I suspect I must have been told about ‘C’ then. I also had some suspicion that it must, therefore, be really old and hence not used anymore.

When I was working along side a programmer a couple of years ago, he did everything in ‘Perl’. My layman’s interpretation of Perl, was that of a badass language for real hardcore programmers. Wishy-washy rubbish programmers who wanted to make crap insecure code, would use PHP. There is no reason for this anti-PHP stance really, but I can’t get it out of my head. It just sounds too…easy.

I do remember him saying one day, “I really like the sound of this ‘Rubionrails‘”. Of course he was talking about “Ruby on Rails” but I heard it as “Rubionrails” – one word instead of three. (I think this must have been in 2006, when Ruby on Rails was really talking off – I’ve been reading up about Ruby history and how Rails really gave it the mainstream attention).

The name kind of stuck with me. “Ruby on Rails” sounded new, shiny sexy and exciting.

So when it came to choosing a programming language to learn from scratch, it was only natural that I should choose Ruby. To be honest, after some reading around about various languages it seemed to me that Ruby really is the best language for a beginner to learn.

I’ve read that learning Ruby is like learning to play the guitar: it’s easy to pick-up but difficult to master. That’s fine by me. I’m not planning on becoming a master, but good enough to busk would be nice!

So in a nutshell, I chose Ruby to learn because I like the sound of the words “Ruby on Rails”. Wonder if they knew how cool it would sound to noobs like me when they named it?

Learning to programme from scratch

January 12, 2010

I’ve decided to try and learn to programme and I’ve started this blog to track my progress (or lack thereof).

Why is this interesting? Well, I’m 30 years old and I have absolutely no programming experience. I don’t mean I’m a designer who’s dabbled in coding, or I learnt some programming a few years ago and I’m picking it up again – I mean I have *no* experience. Zero.

I’m doing this for a few reasons (that I’ll expand upon in a later post), but one of the reasons is just to see if it’s possible. Most programmers live and breathe programming, and they start early – most start around the age of 13. It’s not the sort of thing you just wake up one morning and decide to do.

I’ll start with a few posts to put this is context – why, how, what have I done so far etc.. Thereafter, my posts will probably be fairly irregular ramblings about what I’ve learnt or what I’m stuck on. Maybe this blog will even become a useful resource for others who are starting from scratch.

On the other hand, what is much more likely is that I’ll drift away from this idea, never learn to programme and this blog will remain an online testimony to my lack of commitment. Only time will tell!