I'm being stubborn

I’ve been writing a lot of Go code for the past few years and I have really come to appreciate the code generation patterns that Go developers use. In this case, the excellent Moq library to generate test doubles for unit tests. No third-party code is necessary to use these test doubles, which is an unusual joy nowadays with masses of transitive dependencies frequently required for anything interesting. One thing that has been bugging me for a while with moq is that in its documentation and generated code it calls these test doubles mocks when they are clearly stubs....

Standalone mode for Redis clients

I’ve been playing around with using an in-process redis using miniredis as the backing store for a service that relies on go-workers2 for background processing. You can find the code in my example-miniredis project on GitHub. While miniredis was created as something to be only used in unit tests, this may be useful in running a service that normally requires a redis in a totally standalone mode. I view such a standalone mode as critical for a good development experience in creating integrations against a service, since you can run the service locally without any of its downstream dependencies and still expect to have it respond sensibly....

S3 backup script in a single binary

Everyone has a backup script that takes a tarball/zipfile/etc and uploads it somewhere for safe-keeping. In a lot of places where I’ve worked, the “somewhere” winds up being an Amazon S3 bucket (or lately a DigitalOcean Space). These scripts are lovingly crafted and sometimes quite clever, using the aws cli or s3cmd, or something custom. What I wanted was to encode my process for encrypting a backup and sending that backup to an S3 bucket....

Convert PEM to JKS

SSL/TLS in Java is a pain in the behind. Not only is the setup verbose, but the format for certificates and keys is unique. Nginx/Apache/Go/etc seem to be happy using certifiates and keys encoded as PEM files, but Java has its own special KeyStores, with the JKS format being the default. There are a number of questions on forums, and custom recipes that involve openssl, to convert PEM certificates and keys into formats that can be imported into a Java keystore....

Some Things

Some things once done can never be undone Some things not done can never be done Some things once said can never be unsaid Some things unsaid can never be said Some things permanent are now broken and scattered Some things temporary still remain solid and fixed Some moments will never come again...

New Developer Booklist

Welcome friend. Here’s something for you to read so that we can have some awesome arguments. The Pragmatic Programmer Design Patterns: Elements of Reusable Object-Oriented Software Refactoring: Improving the Design of Existing Code Domain-Driven Design: Tackling Complexity in the Heart of Software Working Effectively with Legacy Code Growing Object-Oriented Software, Guided by Tests Release It!: Design and Deploy Production-Ready Software Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation Building Microservices Pragmatic Thinking and Learning: Refactor Your Wetware Drift into Failure: From Hunting Broken Components to Understanding Complex Systems Building Evolutionary Architectures ...

Goodbye WordPress

Goodbye self-hosted WordPress. It’s been educational but I’m tired of the maintenance, security risks, and the spam. This blog was created when I was beginning to explore my options and I’ve decided that its future does not require a publishing platform. From now on this blog will be a static site, currently generated by Jekyll. I’ve migrated the posts but not the comments. If you feel the need to get in touch you can find me on Twitter....

Consumer-Driven Contract Tests

The most useful way I’ve seen such contract tests work is that the team that consumes the messages creates and publishes an artifact in their build pipeline for use by the creators of the messages. For this example let’s have it create a tarball with a shell script entry point. The inputs to the shell script can be a URL to the api-server and any other parameters required, like user IDs, oauth tokens, etc....

Zero-downtime deployments

For some time now I’ve been thinking about all the different approaches that I have seen and heard with the goal of zero-downtime deployment for a horizontally-scaled application that relies on a database or some form of persistent storage. On most of the projects that I have worked on this was not a requirement, although a speedy and automated deployment was preferred. However, other projects were for websites and applications that formed the backbone of a 24/7 company and as such the idea of even a couple of minutes downtime was unacceptable....

Conversations with Spring

Not that long ago I gave a ThoughtWorks geek night presentation on Post-Redirect-Get and how to mess with the Spring Framework to make it happen. I've put up the presentation and the code that I used for it on GitHub. Feedback is always welcome....