5 Strategies You Can Use Today To Write More, Better Code

https://xkcd.com/303/
  • Bugs or features that can “only be demonstrated” on a non-local environment
  • Long-running analysis or simulation processes

Failure to get into a flow state

One of the great joys of software engineering is the flow state that we achieve when we’re flying through code and adding features at the speed of thought. When your thought process is constantly interrupted by the need to wait to test your changes, the flow state is never achieved and development progresses more slowly.

Increased likelihood of bugs

When feedback cycles are longer, the tendency for the developer is to write more code per test. This increases the likelihood that not all of the code under development is rigorously tested, and therefore increases the chance of bugs creeping in.

Lower developer creativity

When it takes so long to get feedback on code changes, less creative “risks” will be taken and tested. This results in sub-optimal code and design in the name of “just getting it working”.

Simply takes longer

Of course when you have an additional wait for each code/test cycle, everything is going to take longer, resulting in fewer features being added in the long run.

Test Driven Development

I won’t go into the details of TDD here, as there are ample resources out there. If you’re unfamiliar with TDD, I encourage you to learn and embrace the approach, but also be pragmatic about when to use it.

Write a Test Harness

Similar to TDD, a test harness can be used to exercise only a small part of your whole code base. This can be useful in the case that your code is part of a bigger application and you want a way of only testing a small feature.

Use Test Data

A lot of the code I write is for data analytics and simulation. In these cases running a full simulation can often take hours. A good approach here would be to invest the time to develop a test dataset or parameter set that is smaller or quicker to run, but still exhibits the same features as a full dataset.

Use Modern Web Development Tools

Many “modern” (read: post-2015) web dev tools come with features that promote faster feedback cycles. As an example, webpack-dev-server automatically reloads the page on changes, and even for languages requiring a transpilation step like TypeScript this is super quick.

Use A Different Language To Prototype

What if you have a requirement to produce code in a compiled language like C++? Is there a way to get around the long feedback cycles?

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mike Tinning

Mike Tinning

CTO at Bitbloom. Turning bits into blooms for a greener future. Follow me for tips on levelling up your software skills.