This week I read two more chapters of Sadi Mertz’s  book .  The concept of inheritance at its surface is straightforward- a mechanism that delegates the transmission of messages among classes.  You have a superclass that communicates with its subclasses but each one of these subclasses can only communicate with the superclass.

Think of a raw turkey meat as a  superclass. From this superclass you can create subclasses with suggestive and yummy names such as baked turkey, grilled turkey, fried turkey, and the like (As of the time of this writing, it is the post Thanksgiving weekend so naturally I am eating a good amount of left over turkey).
Continue reading “Inheritance”

On Banging

Methods that end with a “bang” in Ruby are arcane.  These are the ones which require a “!” (exclamation mark) at the end of a method.

Consider the example below.

“!” after .capitalize modifies the object for good.  The string “Example” will be always capitalized in your program whenever you call the variable string.  Easy to understand right? I thought so too until I started bagging anything under the sun that needed changing.
Continue reading “On Banging”

I Am a Deaf Frog

“Nothing is unattainable. Something can be very difficult to achieve, but not outright impossible. With time and determination, I will get it.”

I say this to myself every time I  am confronted with adversity. This past week was the second week of the Web Development Fellowship. The level of complexity of the exercises are increasing by the day and what took me a few minutes to finish is now taking me hours. When I am working on hours on a program problem, and I still can’t see the end of the tunnel, frustration sets in. Whenever I am frustrated and my mind tricks me into quitting,  I remember of my young self in acting class.
Continue reading “I Am a Deaf Frog”

Singly Responsible

For homework, I read last night the chapter on the Single Responsibility Principle (SRP) from Sandi Metz’s book “Practical Object-Oriented Design in Ruby“.

SRP is the idea that a class should have only one responsibility because they are easy to change and therefore easy to reuse.

If you are a visual person, the picture below will give you an idea:

Single responsibility picture

Continue reading “Singly Responsible”