DEV Community

Frank Font
Frank Font

Posted on • Edited on

Wishful Programming

I'm sure I could write that program if I knew how to do that one thing.
And I could do that one thing if I knew how to do that other thing.
Wish I knew how to do that stuff.

Creating Programs With Wishes

There is a practical software development strategy which a Computer Science professor ( many years ago ) described to our class as "wishful programming" and over the years I've successfully applied it, whatever the language.

It is very simple.

Here is the gist of the approach:

  1. Stub out a function ( or method or module ) with just a name and no body content.
  2. For the body, call functions ( or methods etc ) that you wish existed, then stub out those functions and methods too.
  3. Keep doing this until you have a collection of stubs that together, if they did anything real, would complete your program.

The magic is that in the process of doing that you are breaking down the task into smaller pieces. And as you do it, you are shifting the heavy lifting into smaller functions ( or methods ) at the edges.

It really does work.

More recently I've learned the above approach is an example of the "backcasting" technique.

The application of this idea also ties into becoming a more creative person, which I wrote something about here.

If you've worked this way before, let me know. Let's compare notes.

Top comments (0)