Scaffolding as a Good Way to Get Started

I’ve noticed that a lot of my commit messages the last few months, especially on new branches, simply say scaffolding.

I usually mean it in a very general sense. Not necessarily using some kind of framework or CLI scaffolding, like the famous rails generate scaffold or the generic Yeoman generator, but in a general sense. Just thinking things through and creating/updating files to sketch out the work ahead.

I may or may not know exactly how I’m (we’re) going to do what we plan to do in this branch, but I can put some code into place that applies a bit of structure around it, and that feels useful to me.

  • Scaffolding helps you think out a plan
  • Scaffolding helps you hop into work later and accomplish smaller parts

For example, say the job is to augment an existing API. It’s going to require a variety of work, like altering the schema, writing business logic to fulfill the requests, dealing with permissions, and fiddling with the database and database methods to get/set the data you need. Scaffolding this job means instead of doing all that work up front, you touch all the files you expect will matter in this work. Perhaps you write nearly-empty functions that talk to each other the way you expect they will. Maybe even pass around fake/mocked data. Make sure the types are happy. Make sure the function signatures feel logical. That kind of work should go fairly quickly, and help do the things I mentioned in those two bullet points above.

Once you have that scaffolding in place, you can think out smaller parts and make them work in the whole you’ve already thought out.

This doesn’t even have to be coding work!

You could scaffold writing by jotting down bullet points or a heading structure.

You could scaffold design by drawing some base rectangles or laying out a nested component structure.

If it is coding work, it also doesn’t have to adhere to the scope of a pull request. You could scaffold out a single function if you needed to.

function DoTheThing() {
  // Get the stuff

  // Munge the stuff

  // Conditionally do some things

  // Return the good parts

Leave a Reply

Your email address will not be published.