We can either
build a model that roughly corresponds to some existing code, or then build a small
representative model and corresponding code.
268 GENERATOR DEFINITION
Let??™s assume that you have no code to start with, so ?¬?rst you want to build a model.
Such a model might have one instance of each of the three or four main object types.
Sketch out an implementation of that which would work with your current code, and
check that the model can give you the information you need. If it is at least close, that
will be ?¬?ne. You can allow yourself some assumptions for now: maybe an object type
could map to one of two different kinds of code, but just choose the more common
solution for now. Go ahead and write the application and get it to run. Aim to write
code similar to current best practice in your applications, but do not waste time
striving for perfection or minimalism. The best code at this point is the kind that you
could explain easily to a new employee, not the kind that will save two bytes or
ten milliseconds because of a clever trick with a certain version of a library. But have
no fear: if you can specify when to perform that trick, you can later add a condition to
that part of the generator and reap the saving every time it is possible.
Now you have a matching pair of a model and the desired output.
Pages:
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494