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”
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”
“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”
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:
Continue reading “Singly Responsible”
If you ever need to iterate
through a short or a long unwieldy array
I know of an easy way
Just type that list aka array
May it be [“cap”, “panama”, “sombrero”, “fez”]
or even [ 3,5,6, 7,8]
there is nothing that .each can’t take
Continue reading “To .Each All Elements”
I want to compare now my Ruby FizzBuzz code with two others I found on the web.
This is mine:
Not bad, not bad.
I was curious to see what other solutions was possible with Ruby. So I decided to research in the series of tubes.
Continue reading “FizzBuzz 2”
Continue reading “FizzBuzzing Part 1”