Ruby on Rails Lingo For Beginners
One of the more challenging things starting out in a new language is having to not only learn the new language/framework, but dealing with the jargon that goes along with it. There’s nothing more frustrating than finding someone willing to answer your questions, but you can’t understand what they’re saying! Here’s a few of the acronyms and terms that you might come across if you’re a Ruby on Rails newbie, with a perl refugee slant.
- Gem – The basic distribution of most of the plugins and addon libraries for Ruby. Thing CPAN. A lot of times you can either install a gem onto your system or as a plugin to a rails project. The basics are you can run “gem list”, “gem install <gem>” and “gem search –remote <search>” to list installed gems, install a new gem by name, or search the configured remote gem servers. Speaking of CPAN, the main two places for gems (currently anyway) are github and rubygems. The main rubygems distribution is essential to get most of the gem functionality, so you’ll need to make sure you have the rubygems package (for your OS) installed and working before you can start doing “gem install” all crazy like. More information can be found on the rubygems site.
- TDD – Test Driven Development. Ruby and Rails people love testing. They love it like mom’s homemade pasta and meatballs served to you with lots of Parmesan cheese after a long day. The TDD philosophy basically means that before you write code, you write a test. In the simplest “hello world” case you would write a test to say “does the program print out ‘hello world’”. It of course fails because there is no program written yet. Then you write the code and work on it until it prints out “hello world” and the test passes. Some people follow TDD to extremes, some ignore it completely (but shouldn’t) and others work in the grey area in between extremes.
- Waterfall – The waterfall model is another design philosophy, but this is more of the old school, not web 2.0, evil-used-by-suits philosophy. It’s your classic “wait till Bob gets the requirements done, then we need the architect team to design the models and system, then we’ll get you to implement it, it’ll head into QA for them to test, and eventually it’ll go into maintenance mode”. Yawn. That’s not to say that there aren’t good reasons to use this model, but it’s considered an old school way of doing things. You’ll know what your mentor means and not think he’s talking about a trip to look at waterfalls anyway.
- DHH – This of course is the creator of Rails, David Heinemeir Hansson. You might also hear names like Obie Fernandez, Wayne Seguin, and JEG2 (James Edward Gray II), and these too are people high up in the community. There are a lot of them, and it’s a big community, so don’t feel too bad if you don’t recognize a name or two.
- MVC – The Model, View, Controller model is at the core of Rails, and if you somehow managed to miss this in the first chapter of any Rails book, I’m shocked! However, if you somehow did, you may hear it thrown around and get confused, especially if you come from another programming language and are still used to the old world “SQL and code inside your HTML file” world that you’ll be so happy to escape.
- DRY – Another big one I’d be shocked if you didn’t know, it’s Don’t Repeat Yourself, another tenant of the Ruby and Rails world. Basically this means that copy and paste programming is not a desired thing, and if you find yourself doing the same bit of code more than once (ie: formatting a price with a $ and decimal places) it’s best to find a way to move that into it’s own function so it’s only in one place. This makes code easier to maintain, and keeps you happy. Not a Rails specific philosophy, but definitely a core value. Next time someone looks at your work and tells you it’s not DRY you’ll know what they mean.
- Refactoring – Closely related to DRY, refactoring is the act of going back and seeing where you can extract common functionality or make the code more idiomatic or simple. Different from Golf challenges in Perl by far. Check out Refactor My Code if you want to get some great examples of how different people take the approach. This site is awesome as you don’t just see the end result of good coding (as you’d see by reading (some) other people’s source code), but both the start and several alternative results.
- Convention over Configuration – The idea that by following naming and file conventions, and following them, productivity goes up over a framework that allows you to configure where files are, how classes are named, etc. By having a set of standard practices that you know your system follows, you can concentrate on what you’re doing and get sh$t done! This is probably the most important tenant of Rails, and is pretty much what the entire thing is built on.
- Framework – Going back a bit, what the heck is a framework. Short answer is it’s something you build your applications in which provides you with everything you need. In other words, instead of you having to deal with HTTP POST parameters for string processing, it provides you with libraries for data handling and common functionality.
- CRUD – Speaking of things you don’t have to deal with, the biggest thing that I think web app developers have to deal with is the four common actions you’re taking with data (think editing a list of blog posts): Create, Retrieve, Update, and Delete. This is shorthand for telling people that the data you’re dealing with has (or needs) the standard set of actions to edit, delete, show and create functionality. This goes hand in hand with our last one…
- Scaffolding – This is the concept of creating a default set of functionality that the programmer can update later on. This is a quick and dirty way of getting things working, and is, in most cases, either only used for learning purposes or is rewritten later. Creating a scaffold for a set of data (say a blog post) can be done in rails by running “script/generate scaffold Post title:string body:text”. This will create a scaffolding which lets you have access to the CRUD operations on this new data model. With just that one line above you get all the HTML, form processing, and database layer interaction needed to fully perform CRUD operations. The concept of using scaffolding to create quick and easy access to data is a huge part of Rails’ success (even if you do end up rewriting them eventually, or grow out of using scaffolding as your skills improve).
There are lots more out there (this page has a great list). Phusion, Heroku, nginx, nokogiri, sass, haml, copilot and scout are other terms for some specific software and sites and libraries you might come across.
No related posts.
July 26th, 2010 at 10:46 pm
[...] Watching the screen-cast I realize that Charles was doing the following (as far as I can tell, as I’m pretty new to the whole TDD thing): [...]