Just another Ruby on Rails fan

student-lang
 

I’ve never really caught the programming bug. I was taught VB / .NET in college but it was all incredibly tedious and not very interesting. Drag and drop a button, double click it and enter some code, then cross your fingers and hope it runs without exploding. I’m self-taught in php & jQuery although i’m more of a ‘hacker’ than a developer. Html / css is where I’ve least trouble. Why? Because that’s the stuff I enjoy doing… i can see the results of that front end stuff immediately…

Over the past couple of weeks however, I’ve been teaching myself Ruby and getting to grips with Ruby on Rails. I can’t help but ask the question why don’t they teach this in college and why didn’t i learn this sooner… it’s a programming language that actually makes sense with a nice open community to talk to if you get stuck.

Coding Language > Real World Language

There was an article on Mashable recently titled ‘Coding Is 21st Century Literacy‘ and that combined with my recent experience of Ruby on Rails was the catalyst for this blog post, my first in almost 6 weeks. Learning spoken languages has never interested me partly because there was never any incentive for me to learn them. I ‘studied’ French at school for a few years but only because it was compulsory. Same with Irish. Given the choice, i’d have avoided both as I consider them a waste of time (for me, not for everyone)… if you intend living or working in France, learn French. If you want to teach Irish, get a job in TG4 or translating government documents, learn Irish. Tá brón orm, but at 25 I’ve used Irish a grand total of zero times since I finished my last sentence in the 2006 Leaving Cert Irish Paper 2.

Everything has a price over it’s head and we determine whether or not we’re prepared to pay that price. Languages to me are too expensive mainly because i can’t see myself needing or using them enough to warrant spending months or years studying them. If you’d given me an option to swap Irish for a programming language for the Leaving Cert, i’d have snapped your hand off.

When it comes to programming languages however, they take a back seat right up until college. In fact programming isn’t taught at all in Irish education. If you want to learn a programming language, you do it in your own time. Agricultural Science, Music and Religion are quite clearly more important subjects that will prepare you better for the world and for college.

Maths is programming

Myth. This was my only concern when I applied for my course in college. I never liked maths, I couldn’t relate x and y to real world things and ultimately it was my weakest subject in terms of results. Not because I lacked the ability to learn about it and memorise formulas, but because the price over it’s head wasn’t worth paying in my view. Back in my day, higher level maths was worth 100 points. So was everything else. Maths was infinitely harder than other subjects and required more time than subjects for most people so I was happy to drop to ordinary level maths and write it off as my 7th subject (you’re only marked on your best 6 subjects). That system has now changed partly because of people like me who abandoned maths for convenience sake and ignored all the ‘but maths is important’ advice.

The problem with maths in school though is that you need to pass it and in some cases pass it comfortably to get in to college, never mind get in to an IT course. Colleges therefore assume that if you’re not good at maths, you’re not good enough for an IT course. In fact in college IT courses, they still teach you Maths and over my 4 years and 48 modules, a Maths module was the only module I ever failed and had to repeat. Why? Same problem. It didn’t mean anything to me. I bundled myself over the line though, again proving ability wasn’t the problem, it was motivation. “Do just enough to pass” and move on because there’s a massive difference between the effort & discipline required to achieve the same results in maths as in other subjects… that’s my view.

ruby-code

In programming, certain things are like maths…. 2d arrays, 3D arrays, queries, variables, functions, classes… i’ve always had a massive problem simply understanding what all of them are or more importantly why they matter and how they can benefit me… i still don’t understand what all of them are but i understand why, when and where they’re needed.

I think of them as boxes for organising stuff. Just like boxes in real life. They help keep code tidy so that when you have guests staying, the house isn’t just one massive unorganised dump with food in the bathroom and a bed in the living room. That’s the real world problem that would be created if we didn’t have boxes or places for storing things. So that’s what all that programming lark is. Different boxes for different bits of code. A variable is your ‘random junk’ box. A class is the ‘easily accessible box’… arrays are a box split in to little boxes…

And it’s only when you start creating your own analogies like that, does anything even begin to make sense. I’m telling you right now you can pass maths or pass programming classes without having a clue as to what you’re writing or doing. I’ve done it. It’s relatively easy. The thing is, in programming if something doesn’t work, I consider it broken or a failure. In school / college, if something is broken or not working, you get marks for everything you’ve done that isn’t broken. So if you’ve built something and 60% of it works, congratulations, you’ve passed.

The problem with that is that whilst you’ve passed, you haven’t actually learned anything. In your mind, you’ve just been rewarded for building something that doesn’t work which in the real world wouldn’t happen. No client would pay for a website that has an error message on the homepage and can’t process payments correctly. Having 60% of the system right doesn’t cut it. It’s 100% or nothing.

And that’s why programming is not like maths. In maths it doesn’t matter if you mess up some solution to an imaginary problem. Nobody cares other you you and the examiner, for a brief second. In programming, there are no imaginary problems. It’s real world so the stakes are higher, the goal is clear and mistakes generally never go unpunished. That’s why i enjoy it more than maths even though i believe it’s equally if not more challenging.

Where to study Ruby?

I’ve watched & completed two Ruby courses now. Codecademy’s Ruby course and TeamTreeHouse’s “Build a Simple Ruby on Rails Application”. Codecademy is free and a great way to introduce yourself to ruby. TeamTreeHouse’s stuff isn’t free ($25/month but $12.50 for the first month if you signup via this link) but it’s definitely worth paying for at least once and checking out if you’re serious about learning rails. I find watching screencasts or videos of people doing stuff is easier than reading a book. While you’re on TeamTreeHouse, they also have iOS / Android and php stuff along with front end stuff like html / css / jQuery. It’s like having college courses on tap, without the exams.

Why Ruby?

Good question. I suppose it’s like asking why do most people use iPods to listen to music or Google Chrome / Firefox as a browser? There are other services / products that allow you to listen to music and browse the web. Just like there are other programming languages. So when you view languages in that context, you start to understand why people would prefer one over the other. To suggest it ‘doesn’t matter’ what you use or that they’re ‘all the same at the end of the day’ would be like me saying all music playing devices are the same and all web browsers are the same or all cars are the same. It’s an arrogantly simple way of putting it which only developers really have the right to say.

If a non-driver or car owner says that all cars are the same, you won’t take them seriously because you know they’ve *at best* got theoretically knowledge of cars. When buying, repairing, selling, making a car, you’ll most likely discard their input. Back to to Ruby, and this is the most comprehensive answer i’ve seen to the question ‘Why Ruby?’, by David Hansson, creator of Rails. Skip to 36 mins in for

Why Rails?

At this stage i’m very familiar with Ruby but no so familiar with Rails. I initially started off trying to create basic apps in rails but didn’t have a clue what i was doing. I was then advised to leave rails for the time being and focus purely on ruby. It made sense. Now, going back in to rails an making sample apps makes a lot more sense.

One massive incentive for me to learn Rails was this thing called slim. It’s a gem (a gem is basically a rails plugin) which allows you to create templates with a minimal amount of syntax. It does away with opening and closing tags and makes creating layouts and html mockups a breeze. Here’s a comparison between standard html and slim…

html

and now for the ‘slim’ version…

slim-lang

The latter is so much easier to work with because you never have to worry about closing tags and as a result it’s easier to read, requires no commenting (to explain which closing tag belongs to what opening tag) and ultimately reduces the risk of errors. All of that speeds up development time and makes my life easier. But that’s just one small example of what rails can do or why it’s important to me.

You’ve also got a smooth relationship with Git / Heroku and a massive support community who also build and maintain gems just like ‘slim’. There are numerous others advantages and i’m sure i’ve only just skimmed the surface so far… i am after all, a rails beginner but i know that once i find something i like / enjoy, i tend to use it much more and ultimately understand it better.

 

Your browser is out of date. It has security vulnerabilities and may not display all features on this site and other sites.

Please update your browser using one of modern browsers (Google Chrome, Opera, Firefox, IE 10).

X