Skill-Testing Questions: Mandatory Knowledge for Rails Beginners
1. You must know how to turn on a computer, and how to do basic operations. You must not be afraid to type.
- Have you read How to Ask Good Questions?
- What operating system are you running?
- What text editor do you use?
- Does it have syntax highlighting? (If you answer ânoâ to this question, as well, you fail it).
- What is a command line? How do you access it on your operating system?
- What does a programmer do? (Judge yourself: if you have no real idea beyond âmakes a computer workâ, then you fail it).
- What sort of operations would I use to move one line of text of a file to another part of the same file?
- What is the difference between a web application and a web page or web site?
If you can answer these questions, you win this category.
This is a tough thing to say, though. If your answer to #2 was âWindowsâ, you need to understand that Railsâand indeed, most modern, cutting-edge programming stuffâis not meant for you. Accuse me of elitism, sure, but itâs a simple fact of the matter that many, if not most big-name programmers program on one of these two platforms (or some more extreme variant). You can program and do Rails on Windows, but you are swimming against the current. You are going to fight battles learning to program, so ask yourself: is using this operating system the battle you wish to fight? The correct answer is no, but you might have your reasons. Nevertheless, you can download and install a copy of Linux so amazingly easy these days that youâre making it hard if you choose not to.
2. You must understand some command-line basics.
Weâre out of the category where you can pass just by having a pulse and understanding what programmers do for a living. Here, you have to have a basic knowledge of how to navigate the file structure, create files and directories, open, edit, and delete files.
Rails, of course, makes heavy use of the command line. You literally cannot start programming in Rails if you cannot use it.
How many of these commands do you know? You donât have to know every single one, but if youâre uncomfortable with more than one or two of these, spend a little more time here.
- cd
- ls
- pwd
- mkdir
- rmdir
- rm
- mv
- cp
- touch
- vim / nano / pico / emacs (one of these)
- chmod
- chown
- grep
3. You must understand some Ruby.
In particular, focus on the methods dealing with Arrays and Hashes, and make sure you understand block syntax and the concepts behind yield.
Once you learn these things, you will find that promised efficiencyâI promise you.
You should be able to explain what each of the following code samples does:
array = %w(dog cat aardvark)
array.each {|animal| puts animal.upcase }
array.map! {|animal| animal.reverse }
array.select {|animal| animal.include? 'a' }
array.sort_by(&:length)
array << 'dog'
array.uniq!
hash = {cat: "meow", dog: "woof", aardvark: "sluuurp"}
hash.keys.join(" and ")
hash.collect {|k, v| "the #{k.to_s} says #{v}"}
class Donkey < Animal
attr_accessor :name
def initialize(name)
@name = name
end
end
my_donkey = Donkey.new "Ernesto"
my_donkey.name
4. Success!
If you make it to this point, you should be good to start learning Rails. This doesnât mean that you can stop learning more about the command line or about Ruby, but you wonât spend the gross majority of your time fighting these things.