The decorator pattern is one of my favorite patterns. It is simple, extensible and powerful. It feels like it follows the essence of object oriented programming beautifully. Sadly though, it is also easy to be misused or misunderstood. So, in this post I will show you the essence of the decorator pattern, illustrated with a few examples.Continue reading “OOP Fundamentals: The Decorator Pattern”
The dependency inversion principle is one of the cornerstones of object-oriented programming. Without it, there is no object-oriented design. It’s that important.Continue reading “OOP Fundamentals: The Dependency Inversion Principle”
We are pleased to release bBox version 0.96, with JSON processing via jq, Python 3 compile/run, and improvements supporting Zsh, cURL and Ruby.
What is nothing?
undefined? A vast void of emptiness that fills your soul with dread? Oh sorry, that’s just my stomach.
We often think of nothing as… well, nothing. It’s when something doesn’t exist and therefore cannot be interacted with. So in our code, we try account for having nothing. No
User? No problem.
Ruby devs are probably all too familiar with seeing this error:
NoMethodError (undefined method `foo' for nil:NilClass)
Most of the time, it’s probably due to a typo, but every now and then we end up having to do something like:
defined?(bar) && bar.foo # returns nil if bar is nil
If you’re on Rails, or are using ActiveSupport, you can use
Over years of reviewing Ruby code, the same things tend to come up over and over. In this post, I’d like to address some of the most common code smells I find when reviewing OOP code (and Ruby code in particular).Continue reading “Common Code Smells in OOP”
In this post I’ll talk about generating ePub files with Ruby and how to painlessly integrate this feature to your application. I’ll be using a Ruby gem I created called ePubber, which I created to help manage ePub content.