Friday, April 22, 2005

Some simple techniques for modelling

Just a reminder about simple techniques for modelling - figuring out where your behaviour belongs.

Before you start:

UML diagrams. Not with all the detail. Really connected squares. Write down all the objects you're dealing with, connect them all, arrange them. Find two or three combinations that you think might contain the behaviour. Try a few that you think won't and see what you learn. Take no more than 30 minutes.

While you're working:

Blank CRC cards. (Courtesy Brian Marick). Use blank index cards to represent your objects (don't write anything on them.) Use the cards to talk about your objects and responsibilities. Not writing on them will force you to use spatial relationships and be clearer when talking.

Refactor at the end:

Sequence diagrams. Just the important methods. Look at the lines are they all flowing from one or a few objects? Are there objects that don't do anything? Look to move some the behaviour.

Reminder: Modelling is about helping you write code. Keep it in that role. If it overshadows coding, you're not doing anything useful.

0 Comments:

Post a Comment

<< Home