A land without templates

Meet C01t, the newest “rock star developer” for Guava Orchards. C01t just had this great idea for a new service. Eager to get started he says to himself: “I’m going to crank out this prototype as fast as I can. If it proves out I’ll go back and fix formatting, add some comments, write a full suite of automated tests… you know turn all this into production ready code”.

The prototype generates all sorts of excitement. A deluge of new feature ideas comes pouring in. C01t bolts more and more code onto the prototype. Everyone who tries the service loves it. Out of nowhere there is talk about launching a beta by the end of the month. “That should be no problem right? After all the services is only missing 2 small features”, they say. That’s when C01t experiences his first moment of panic. This was only supposed to be a prototype!

C01t explains that the service needs a complete rewrite. He has to implement a fully automated test suite. Heck, right now he can only build and run the service on his box. “I need at least 3-4 months to get the service production ready”, C01t declares confidently. “We have to ship within the next 4 weeks. Tell you what! We’ll assign Nick to this project full time. He can help with testing and automating the deployment”, they say.

Nick and C01t set out to make the impossible possible. C01t implements the missing features. He writes some tests. Nick builds a fully automated build/test/deployment pipeline. He sets up monitoring and alerts. He even manages to cobble together a basic getting stared guide. Finally “launch day” arrives. The pipeline has only had one successful run in the last 2 weeks. However, they go head and launch anyways.

Almost from the get go, issues start cropping up. At first the requests take too long to process. Then the error rate spikes. C01t digs in and finds the bug. He codes up the fix. Then Nick deploys the fix to production after fighting the pipeline for a week and a half. A moment of respite. But then the alert for authentication failures goes off. The fix broke the main login flow.

And that’s when C01t decides: “No more prototype code ever again”!

Templates to the rescue

Does C01t’s story sound familiar? So, how can you avoid a similar debacle in the future? Write production ready code from day 1. Use a Green GUAVA template and the cookiecutter command-line utility to generate your project.

Every one of our templates configures your project according to the following principles:

  • Build/development environment: Create a fully isolated and consistent build environment with Docker containers. Furthermore, make builds repeatable by employing a package management tool to control dependencies.
  • Static code analysis: Enforce “programming style” with an automated tool. Style checkers keep the entire code base consistent. In addition they eliminate “religious arguments” during code reviews. Finally, utilize linters to eradicate all common sources of bugs from your code base.
  • Testing: A comprehensive test suite allows you to iterate quickly without regressing existing functionality. Therefore, take advantage of capable test frameworks to facilitate BDD and TDD. Also, set “code coverage” thresholds to prevent functionality from going untested.
  • Documentation: Generate documentation from code comments. Keep documentation close to the code, and update it whenever the implementation changes. You can enable this entire process with “doc generators”.
  • Production ready: Log relevant debug information and collect metrics as you build your features. Use a structured logger to greatly simplify log post-processing.

Kick start your project with a Green GUAVA template.

Leave a Reply

Your email address will not be published. Required fields are marked *