Printf Design

closely related to PrintfDebugging, except its before the fact instead of after the fact.

The idea is to code your intentions into printf statements and observe the dynamic behaviour before writing bunches of code.

You can start with some pseudo code in comments.

Once some of it is ready to run you can wrap the comments in printf statements.

What you see is messages telling you whats going to happen when its all working !

you can also embellish the printf comments with messages to yourself like "NOT IMPLEMENTED", "UNDER CONSTRUCTION", "UNDER TEST" etc.

Its like building a model of the code you intend to write, and testing the model beforehand.

Another way of doing TestFirstDesign.

RichardCollins


This is a useful pattern, but it it does not work when the code is supposed to compute some value. You can print that you want to return the LU-factorisation of some matrix, but you cannot return it until you actually wrote the code. For these cases, you can use BottomUpProgramming.


EditText of this page (last edited April 12, 2000) or FindPage with title or text search