The Shohoj Token system has been running at an upazila health complex for six months, and the director has a small request. Tokens are printed as T-045. From next week they should read D2-045, with the doctor's room number in front. It sounds like a ten-minute job. Rahim, the programmer, changes the printing code, and the SMS that goes to the patient now shows the old format. He fixes the SMS, and the daily report, which cuts every token at the dash, crashes. He fixes the report, and the "call next patient" screen, which sorts tokens as text, puts D2-100 before D2-20. By Thursday he has opened nine files for a change the director thought was cosmetic.
Nothing is wrong with Rahim's programming. The trouble is that the token number was never given a home: every part of the system knew what a token looks like, so every part had to change. Someone should have decided, before the first line of code, which module owns that knowledge and how the others ask it. That decision is design.
This chapter teaches how design is done and how it is drawn. You will say what a design contains and explain the ideas that make one good: abstraction, modularity, information hiding, stepwise refinement and more. You will classify code by its cohesion and coupling, using the full ladder exam papers use. You will name the 14 UML diagrams, split them into structural and behavioural, and read and draw the five asked most: class, use case, sequence, activity and state machine. Last, you will judge a user interface against golden rules and heuristics, and say how usability is measured.
We go in six parts. Part 1 is what a design is and what it contains. Part 2 is the ideas behind a good design. Part 3 is cohesion and coupling in full. Part 4 is UML as a language, with the diagrams that show structure. Part 5 is the diagrams that show behaviour. Part 6 is user-interface design. Shohoj Token, the health-complex system from the first chapter, is our running example.