Invert your assertions

TDD Tip: Invert your assertion One top tip I picked up years ago from a co-worker was to invert your assertions when you are in the midst of your TDD cycles. In other words, if you have an RSpec assertion like this: expect(foo.nil?).to be_truthy flip the truthy to falsey and run the test expect(foo.nil?).to be_falsey What you want to see there is that your test fails. In a ‘true’ TDD environment the test would be perfectly clean and no state would be acting on your subject, but that’s just not how most test suites for production products work....

January 26, 2023 · 1 min · 120 words · Matt

Macroservices - A Pragmatic Approach For Small Teams

In an ideal world, all software projects would be written well. Full test suite, a good ci/cd pipeline, and a general focus on maintainability. If that’s the world you live in, or your org spends a lot of time from the onset of a project optimizing for a clean codebase, this is nirvana. One well kept monolith keeps complexity down across the board. No complicated SOA, deployment tooling, or failure case handling....

June 13, 2019 · 2 min · 310 words · Matt

Programmatically Change S3 Storage Class To Glacier

The glacier storage class within Amazon S3 is a great way to reduce costs for files you don’t think you will ever need again, but want to have stick around just in case. Unfortunately the AWS SDK doesn’t provide a way to transition an object to the Glacier storage class; you can only transition to Infrequent Access and no further. Here is my quick hack to enable that ability: Create a special folder in your S3 bucket named ‘archive’ (or whatever you like)....

March 8, 2018 · 1 min · 195 words · Matt

Rails 4 and Paperclip with S3 + Cloudfront

It’s been over two years since I have implemented Paperclip, the awesome image attachment gem, into a Rails app. The basic setup is still very easy and clean to do, as is the initial setup to get S3 storage working. But what’s not well documented is how to use Cloudfront to serve up your image attachments rather than pulling them from S3. Thanks to this helpful answer on stack overflow, and a little digging into the code of Paperclip itself, it turns out to be trivial to implement....

April 21, 2016 · 1 min · 138 words · Matt

iOS Design Patterns: The Builder

One of the things I’d like improve in 2016 is my knowledge of software engineering design patterns, with a particular emphasis on iOS. I’ll be posting a quick summary of each one I stumble across on the blog so that my future self can find things again easily. Today’s pattern is called ‘The Builder’. The intent of the pattern is to make it easy to create objects with a lot of initial configurations, without bloating your code with a bunch of long initializers....

January 5, 2016 · 1 min · 175 words · Matt