First off, lets give you, dear reader, my level of experience with rails. I started out looking at rails in May of 2007 and being a man of the PC realm I wanted an IDE that I could use. Half the stuff I was trying to do did not work in windows which led me to ditch rails for the summer since my job required I actually do my job. Last fall, I installed a linux distro on a box I had laying around and decided to give Rails another whirl. Which brings me to my first tip for all you n00bs.
#1 Learn Ruby.
I spent sometime actually writing ruby code and some scripts that I actually use in my job and wouldn't you know it, it makes understanding rails that much easier. Now as stupid as that may sound you would not believe how much easier it is to get an answer from someone when you know the realm in which the question resides. That brings me to...
#2 Just show them the code.
Ok, so you're sitting there staring at a problem on your screen and you spend the next 10 minutes formulating the question so that you can ask an 'educated' question and not sound like a n00b to have no one answer the question. It's an age old problem that can be spelled it in 7 words.
A picture is worth a thousand words.
Use a service like pastie.caboo.se and post the code or error message then ask your question. And this leads into...
#3 Be specific.
Here is a lame example
--- so you have the following code ---
['one','two','three'].each do |index|
puts "Here is the index #{index}"
end
---
Don't ask, "Why doesn't this work?" , because the smart a$$es out there are going to tell you that it does work and that it is syntactically correct so you are clearly the object that does not work. Ask a specific question like "Why does this code [link to pastie] not display the indicies?" Which kind of goes back to rule #1.
We are more then half way there and I have yet to scratch the surface of n00b tips and since I don't have a good transition, on to #4.
#4 Don't reinvent the wheel.
It is going to happen. You are going to spend hours writing a piece of code that you think is the greatest code ever, then you are going to ask someone a question on how to improve or solve some issue and that someone is going to tell you "ActiveRecord/ActionView/ActionController already has that functionality... you just do...[insert the name of some method here]" About this time your brain melts and your significant other is calling 'assisted living' facilities to put you up in. If you find you are spending to much time adding functionality to Rails, 99.9% of the time that functionality is already there you just haven't discovered it yet. Finally,
#5 Build the docs locally/Rdoc is your friend
That is one of the great things about open source, the majority of the time you have access to the internal documentation of the api and Rails is no exception. Every part of rails has a rakefile and the documentation task is defined there. All you have to do is run rake rdoc to build the normal documenation or you can run
rdoc --all --promiscuous --include 'lib/*/*.rb' --inline-source --op mydocs --exclude 'test'
from within say the actionpack-2.0.2 directory and get all sorts of goodness. Having the docs generated locally means never needing access to the internet. Huh? Why is that a good thing? On to bonus tip #6
#6 You are ONE BILLION times more productive offline.
Truly you are. You will spend a lot of time looking for an built answer to some problem you are having rather then spending the time LEARNING how rails works. You need the disconnected time to devle deep into the documentation and write your own code. That bears repeating. You ned the disconnected time to devle deep into the documenation and WRITE YOUR OWN CODE.
Those are my 5+1 tips for n00bs.
0 comments:
Post a Comment