The value of a test suite can easily go down when complexity goes up, and a lot of the time this complexity can be prevented. There is a great discussion on SO about this.
Data Structures at the heart of your system
You should always prefer to create complex data structures over complex program logic. In fact, making complex data structures that are intelligent will eliminate the need for complex program logic. This will lead to a more robust system that’s easier to reason about and has less code to maintain.
ActiveRecord associations and the valid? flag when building
I was debugging a mysterious bug using RSpec and it took a while to figure out what exactly was going on. I thought that I would document my findings here, as I could not find much information on the subject and ended up digging into the ActiveRecord source code.
UNIX at Made
Everyone in the Made office seems to prefer Unix based systems. Why is that? Sure everyone likes Apple products, they are considered stable, relatively speaking, but I don’t think that everybody appreciates where most of that stability comes from.
Cache sweepers in Rails: Invalidating caches from outside the controller
Invoke cache sweeper through a rake task, which will loop over all the products in the database and expire the cache for each one. There is a fair amount of setup required for this to work. I will walk you through how to do this with a series of hacks.
Spree Custom Gateway
Spree makes it easy to take payments from any Payment Service Provider, and in this post I will briefly walk you through the process of creating and using your own custom gateway.
Pulling with the –rebase flag
There is no denying that Git is a power tool. Power tools command discipline and mastery to be used effectively.
Metaprogramming in Ruby
When you find yourself duplicating functionality that is similar to existing functionality in your system, it may be an indication that the process could be generalised to accommodate more scenarios. This has the benefit that this ‘role’ would be encapsulated and the source code would exist in only one place, becoming less of a maintenance burden.
Tell, don’t ask. It’s a matter of principle.
When we design software with maintainability in mind, one obvious goal is to keep the unnecessary lines of code to a bare minimum. The less you need to see/read that is not vital to your understanding of the domain model, the better.