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
Continue reading “Something out of Nothing: Null Object Pattern”
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
Continue reading “Ruby’s Safe Navigation Operator &. and is it a Code Smell?”
If you are into object-oriented programming, you most likely have heard about composition over inheritance. The concept itself is simple: Whenever possible, prefer to compose objects rather than introducing inheritance.
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”
Ruby-ish, rubbish… Get it? Anyways, not like Ruby-ish means bad! Quite the opposite!
It’s the day after Xmas and because Ruby is awesome and delivered 2.6.0, we’ll get to play with some of our new Xmas gifts:
Continue reading “A Ruby-ish Xmas”
ePub is a digital book format which is pretty common nowadays. It’s supported natively by Windows and Android and it’s one of the official formats for digital books in the Apple Books store.
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.
Continue reading “ePubber – generating ePub files with Ruby”
Have you ever wanted to make your own programming language? Maybe a template engine? A JSON parser? If you have ever built any of those, you might have noticed it’s not exactly easy to get started. We’d like to help with that.
Welcome to Part 3, the final in this series on Writing a Markdown Compiler!
Continue reading “Writing a Markdown Compiler – Part 3”