Decouple your APIs from their implementation

A common pattern seen across Rails applications is the following update action in controllers Convention over configuration is a very powerful way of getting developers up the curve quickly. However, it can lead to a certain amount of automatic programming which obscures the possibility of creating beautiful APIs with our…

Read this article

Readable Specs == Business Value

Consider the situation of a product manager or software architect overseeing the work of several dozen if not hundreds of programmers. If you have been in this situation you know what the problems are Ensuring delivery quality is a nightmare - you are spending as much time verifying the work…

Read this article

Painless Controller Testing In Rails

There seems to be reasonable support for the opinion that controllers do not require testing and that integration tests or acceptance tests are sufficient testing for controllers. I think in large part this opinion arises because controllers are hard to test. In this post, I’d like to share…

Read this article

Easy Tag Search With Sequel

One of the most under-rated libraries in the Ruby world in my opinion is the brilliant SQL builder library Sequel. Sequel allows you to build SQL statements in Ruby and compose them using all kinds of nice logic and Turing-complete programming language goodness. So, why in the world of ActiveRecord…

Read this article

Are Comments a Code Smell? It Depends

Of late there have been numerous posts for and against comments in source code. On the anti side, we have for example DHH, whose recent post Clarity over Brevity in Method and Variable Names on the 37signals blog calls out comments as a code smell saying that the code should…

Read this article

Why I Migrated Away From MongoDB

I recently concluded a migration away from MongoDB to PostgreSQL for one of my apps - digiDoc. I’d like to tell you why I did so. To be honest, the decision to use MongoDb was an ill-thought out one. Lesson learned - thoroughly research any new technology you…

Read this article

Clarity over Brevity in Method Calls

A method name is actually just one part of a method invocation and since methods take arguments, one can use the arguments to provide a lot more clarity of what the method is doing than simply restricting oneslef to the method name. Infact, methods with names like make_person_an_…

Read this article

Using State Machines to keep your Controllers Happy

I just wanted to share a technique I stumbled upon some time ago which helps to keep my controllers clean and easy to read and test. So, use case - you have an object that goes through a workflow, inhabiting several different states and having different things that can be…

Read this article

A peek into Test Driven Design

As the software that we write grows in complexity, there’s been an increasing trend amongst practitioners to guarantee or prove that their programs operate as desired. No serious programmer will deny that this ability is one of the most important ones in running complex software systems. Without such…

Read this article

On Reading Source Code

There are some things that people you look up to as masters of the hacker craft do on a regular basis - they contribute to open source projects, they have commits all over the place in software that you know and use every day, they build and maintain gems that…

Read this article