DEV Community

Johannes Scharlach
Johannes Scharlach

Posted on

Choosing Good Defaults: Boost Your Productivity

If you've read one of my previous blog posts, you'll know that I love tools. I even love creating my own tools.

Over the time I've found out that the most impactful decision you can make is all about defaults. This is my decision framework.

1. Think About First Time Users

If you've done anything with webpack a couple of years ago, you know what I mean. Getting started was one of the hardest parts, because in order to get anything done, you needed to create and understand a complex configuration.

Good defaults make it easy for first time users to get started. If you choose your defaults well, the tool "just works".

2. Make Functionality Discoverable Through Defaults

If you're hiding useful settings in configurations and CLI flags, most of your users will never discover that the functionality even exists. E.g. if your tool can self-upgrade, then doing that should probably be the default. 90% of your users will never read through the documentation, so the default is how they will use your tool.

3. Make It Clear How To Turn It Off

Boolean flags for CLI tools are particularly difficult to turn off. Is it --no-cache or --cache=off or maybe something entirely different like --prefer-online? My experience is that when possible you should avoid the negative CLI flag by choosing the opposite expression, --prefer-online in the above case. If there is no good such expression, make sure you document how to turn the flag off.

4. Provide An Escape Hatch For Power Users

Your power users will quickly get tired of specifying the same flags over and over again. They might need a configuration file to save their settings. Or just have a pre-configured version of the command in an npm script so that people can run npm run start for your regular users and npm run start:minimal as an alternative.

5. If the Tool Is Internal, Start With Default On

If you're unsure about a new configuration, then start with turning it on by default. People will quickly tell you if that was the wrong approach and you can adjust it then. Embracing the concept of fail fast that will give you the quickest feedback if the setting is useful, how it can be improved and if it's not useful at all, you can simply swap the default and carve a new release.

Top comments (0)