Design Hints


When starting out a design, work out your main use cases

. When starting on your first class diagram

  1. Focus first on your over-all structure.
  2. Make sure you have your interfaces right, particularly
    1. interfaces for major parts of the system (i.e. packages)
    2. interfaces for information that must be shared between major parts

Think of anything your tossing back and forth that is not a primitive as an object, then focus not on what it is (e.g. formatted string) but what methods it must have (what it will do for you).


It is worthwhile getting complex drawings right. Good designers produce drawings of clarity.

Here is a drawing I spent perhaps five extra hours on once I had got the basics worked out. See comments beneath

The drawing is more complex than I like but I wanted to focus on the interplay between the three processes in the system. Breaking the drawing into three as I would normally do would destroy the structure I'm trying to see. I'm using the drawing to study/design the crucial connectivities between the sub-systems. I'll break it up into parts later.
There is a great deal of symmetry between the client (view, player) and server(model, gameworks) sides. The drawing is arranged to bring that out.
I don't normally colour class diagrams—they are hard/expensive to reproduce in print. However, there is a lot going on here and I felt the colours added clarity. In particular it makes it easy to see what classes are produced by the rmic, which are the rmic sources, and which are the interfaces I have to build. While I was at it I distinguished the separate processes as well.
There's more connectivity shown than I like, although the symmetry helps keep it clear. It is justified here as I really wanted to understand all the connections in this quite complex scheme.
I have tried to lay this out so that classes higher in the inheritance hierarchy go at top and lower towards the bottom. Although this makes some of the lines longer and forces some crossings, my eye can quickly grasp the inheritance hierarchies without having to constantly examine the associations in detail to see what their decorators are. Similarly, client is on the left, the framework is on the right and things that both depend upon to communicate are in the middle. Make your drawings flow.
Notice the only methods I have put in yet are for the interfaces. Notice that I'm using interfaces for critical junctions in the project, namely the two sides and the information that they will exchange.

If you want to know what the actual design is all about here is a link to the appropriate page in my project log book. The drawing is a slightly older version of the one you see above (which will go into my next page once I have finished working interfaces out in more detail and got a skeleton version running in code).