2008-06-20 16:15:31 +0000
You would expect any professional to know their stuff, for a Ruby on Rails beginner, this is no less important.
One of the things I run into quite a bit is people simply not knowing enough about the underlying model of their database. Getting them to understand a has many through object relationship, is not going to get very far if they don’t know how an SQL database represents this.
Basics are what will make or break you as a programmer. You can know all the syntactic sugary beliefs out there, but without some hard won understanding of basic principles, you will be out in the cold as soon as some part of the program breaks in a new and unusual way.
Each subject has it’s basic fundamentals. For my Ruby programming, the fundamentals are defined in several key books (like the Pickaxe and the Ruby Programming Language and Design Patterns in Ruby). For Rails, you can’t really go past Agile Development and the Rails Way for key points. Each of these become like a ‘Bible’ to you when you are coding. Each programmer has their bible, it is interesting even that it is called a Bible, as in Christianity, the fundamentals of that belief system is contained in a book CALLED the Bible. My religion has a set of books that contain our core beliefs, we call them collectively, ‘The Basics’.
But a lot of Rails folks in their misguided ‘coding SQL is evil’ forget that underneath all that pretty ActiveRecord sugar are real, cold blooded, raw, writing SQL queries, automagically generated by our core team friends to attempt to leach from our databases the data we and our application so desperately need.
It’s all well and good to be able to type ‘person.phones’ and get an array containing all the phone numbers belonging to that person, but if you don’t know that in executing that statement, that an equivalent SQL query approximating “SELECT * phones WHERE person_id = 2;” is occuring, you my friend are in for some nasty surprises.
Just like me when I first discovered the has many through, I promptly made a call like paragraph.chapter.book.genre.words and wondered why my DB came to a screeching, painful halt, and my ruby instance blew straight through the available RAM and started playing friendly with my swap space… I did not understand what all those queries were doing and did not thinking with the size of the resulting dataset. The LEFT OUTER JOINS came to bite me… quite hard.
But SQL is a dry subject, not DRY that is, far from it actually, more like a moist sponge, but it is dry in that most of the materials you have to learn it are bland and quite factually boring.
But I found this book online, it has been around for a bit, I am not the first to discover it, but it is an introduction to SQL that I think almost any Rails developer should read. It covers the basics, where RDBMS’s came from, why you need two apostrophes to get one and how using SQL will get you better dates.
So I thoroughly recommend it. Head over to SQL for Web Nerds and have a good read.