On Mar 28, 2006, at 3:08 PM, Dmitry B. wrote:
Do You want to take part in the creation process of exam series,
covering Ruby itself and RoR framework?
Not really, but I doubt you want to hear that.
So, I better at
least point some things out. From your basic exam:
Vocabulary and concepts (1 questions)
Ruby source file supposed to have .rb extension.
While this is good practice, it is certainly not required. There are
even times it would be considered undesirable (making a command-line
executable, for example).
Understand that basic commands like puts and exit are actualy
Kernel class methods.
They are actually Kernel instance methods.
Ruby Environment (1 question)
Know that RUBYPATH contains a list of directories to look for
included files.
This variable is not set on my system, just FYI.
Naming (3 questions)
Ruby naming style and how it affects code
* Constants: UPPER_CASE
* Classes: Starting with uppercase
…at each new word: LikeThis.
* Methods and variables: starting with lowercase
…and using underscores to separate words: like_this.
Know that methods ending with ! are supposed to be mutators (sort!).
Actually, they are considered dangerous. exit!() is not a mutator,
for example.
Comments (1 question)
Know that the Ruby code has a # (sharp) comment symbol.
…and multi-line comments:
=begin
This is a comment.
=end
Variables (2 question)
Know that there is no unbound variables, but only class attributes.
What does this mean?
Know that it is not necessary to define staring value in Ruby. It
is nil.
You will probably get a warning for programming like this though, if
Ruby’s warnings are on.
Know how to check if variable is defined with nil? method.
You check if a variable is nil with nil? and defined with defined?.
I/O (2 questions)
IO reading iterators: each_line
Or its alias: each().
Classes (3 questions)
Know that the name of constructor method in Ruby is ‘initialize’.
The name of Ruby’s default constructor is new(). The name of the
method new() calls to complete object construction is initialize().
Understand that class methods are supposed to work without any
object being created.
That’s a little more fuzzy in Ruby than Java, since the class itself
is an object.
Know that Ruby does not care what is the class name of the object
until it has called methods.
What does this mean?
Methods (2 questions)
Know what does method ‘alias’ means in Ruby.
alias is a keyword, not a method.
Blocks (1 question)
Usage of blocks and iterators.
These are two pretty broad topics that probably should not be lumped
together under one topic.
Not covered: creating own iterators and using ‘yield’.
yield is used to call a block. That might be to create an iterator,
but it does not have to be.
Exceptions (2 questions)
Know that Exception is a class and custom exceptions should inherit
it.
I believe most custom exceptions should inherit from RuntimeError.
‘catch’ and ‘throw’ constructs.
Why are these here? They have nothing to do with exceptions.
Modules (1 question)
Understand the difference between require and load commands.
This is not related to modules.
Know that it is not mandatory to include file extension in ‘require/
load’ directives.
Again, nothing to do with modules.
Dynamic usage of load command.
Again.
James Edward G. II