Object Composition is a very powerful and pervasive software design technique. Yet, paradoxically, it is an underutilized design pattern whose lack of usage is the root of many anti-patterns in software development. One that I continue to come across regularly has to do with not using composition to test and migrate a piece of software from one service to another.
Briefly, Object Composition is combining two or more objects to create more complex objects while keeping definitions of the constituent objects unchanged (unlike inheritance, which extends these definitions)
Continue reading “Object Composition for Service Migration”
TL;DR. The inability to cancel threads in C++ can result in bizarre semantics even in seemingly straightforward (and almost) declarative code. folly::Future is an interesting case in point.
Continue reading “folly:Future, onTimeout(), and a race condition”
TL;DR. Scripts are a great way to automate the mundane. But be sure you give yourself a way out — an undo — when running them.
Some time ago, I had to carry out a long sequence of manual changes in the deployment of my ‘cloud’ service, and so like a good software engineer, I automated large chunks of these changes with shell scripts. Here I learned the importance of building and ‘undo’ in all your shell scripts that mutate the state of world.
Cross posted on LinkedIn.
This is the fifth, and final, post in my series of notes on unit tests. So far, we’ve talked about how unit tests help us in documenting our code, reliably refactor software, build better code, and even help debugging in prod. In this post, we’ll discuss how unit tests (more precisely, the act of writing unit tests) help us improve the usability of our code.
Continue reading “Merits of unit tests — part 5”
Cross posted on LinkedIn
In the previous three parts of this series, I have talked about how unit tests are useful in a lot more than just verifying that your code works. We’ve talked its uses for documentation, refactoring and code health, and writing better software. Next, we’ll see how unit tests helps you debug issues in production.
Continue reading “Unit tests FTW! — Part 4”