Decorator – Design Pattern
Simplest explanation I’ve heard of the decorator pattern is it’s “used to extend the functionality of a single object without affecting any other instances of the same class.” The decorator pattern is used to achieving a separation of concerns and is essential tool in the Open/Closed…
Ruby Blocks, Procs, & lambdas
Blocks are very handy and syntactically simple, however we may want to have many different blocks at our disposal and use them multiple times. As such, passing the same block again and again would require us to repeat ourself. However, as Ruby is fully object-oriented,…
Ruby Forwardable Module
In my web development journey I recently stumbled upon the Forwardable module. I’ve been making a concerted effort to learn and follow the object oriented design principles. In this case favor composition over inheritance. In other words instead of inheriting and exposing all of the…
5 SOLID Design Principles
In my journey to become a better developer I’m currently concentrating my efforts on design patterns and principles. I came across this video by Sandi Metz on how the 5 SOLID design principles apply to Ruby. SOLID is about managing the dependencies in your application. …
Day 3 at Dev Bootcamp
Feeling a bit tired today. This will make 3 days in a row when I go to sleep after midnight. What I learned today: Regex groupings: /([aeiou]*)([aeiou].*)/ These regex groups (stuff in between parentheses) can be called in a string, “21ay” produces pig-latin….
First Day of Dev Bootcamp
It was an AWESOME first day! First we introduced ourselves and got advice from the other cohorts. Then some team building exercises and lunch. Finally, CODING (pair programming specifically)! My roommates and me coded from 3pm until midnight. It was great to do some pair programming…
Day 2 Dev Bootcamp
Today I struggled mightily and wrote some really bad code. My first thought was to save the code, and keep working at it. Cooler heads prevailed, and I deleted the terrible code. Today’s advice is to delete bad code and love it. The moment…
Difference between ruby helpers, partials, and route helpers
Learned today that helpers and partials are not created equal. View helpers are like modules. They primarily store ruby methods that can be used by your view files. Form helpers make it easy to write and maintain form markup. Partials are embedded ruby files (.erb)…
Equality in Ruby
== is equality of value. Typically overridden in subclasses to provide class specific meaning. === is the same as == but usually overridden in subclasses for use in case statements (Range, Regex, Proc). eql? is equality of value and type. equal? is pointer comparison (hash)….