DEV Community

Quick Tip: Programming by Wishful Thinking

Frederik 👨‍💻➡️🌐 Creemers on October 06, 2017

You can also read this post on my own blog. You've probably heard the advice to break your work up into manageable chunks, or to break a complex p...
Collapse
 
aigarius profile image
Aigars Mahinovs

This combines very well with Test Driven Development and Mocks. At every step, before writing out a function, write 1-2 simple tests that call that function with a sample input and check its sample output. Once you have written the function plug the wished for functions with mocks that return expected results for the inputs. And presto - you already have test data for your next level of functions! When all is done, add a couple more calls to the top level function without any mocks and see how they all work in concert. Done!

Collapse
 
dmerejkowsky profile image
Dimitri Merejkowsky

If you're willing to go through a rather long article I've written you can get an other example of using the pattern.

TL;DR: I was integrating some C++ code in an Android app, but to get started I just pretended the library code existed while starting working on the GUI.

Worked pretty well ;-)

Collapse
 
jwmevans_77 profile image
James Evans

How does that differ from the top down development model?

Collapse
 
_bigblind profile image
Frederik 👨‍💻➡️🌐 Creemers

In practice, I don't really think it does. It's just my way of thinking about solving problems.

Collapse
 
_bigblind profile image
Frederik 👨‍💻➡️🌐 Creemers

I'm not sure how much of a quick tip this is actually. I wanted my series of quick tip posts to be short and snappy posts, but this one grew slightly longer than expected.