How unit 4 is examined
This unit covers conventional versus OO design, CRC cards, UML design diagrams and case studies; the marks sit in the conventional-versus-OO comparison and the component/deployment diagrams.
Conventional v/s OO design approach
Medium weight
Definition. Conventional (structured) design decomposes a system into functions and data flows, whereas object-oriented design decomposes it into objects that bundle data with the operations on that data.
Key points.
- Conventional design is function-oriented: the system is split top-down into procedures, and data is shared globally between them.
- OO design is object-oriented: the system is a set of collaborating objects, each hiding its own data behind methods.
- Conventional design is modelled with data flow diagrams, structure charts and flowcharts; OO design uses UML diagrams such as class, sequence and state chart diagrams.
- OO design supports inheritance and polymorphism, so new behaviour is added by extending classes instead of editing working code.
- Modularity in OO is by class, which is a cohesive unit; in conventional design it is by function, which is tightly coupled through shared data.
- Reusability and maintenance are better in OO because changes stay inside one class.
| Basis | Conventional (structured) | Object-oriented |
|---|---|---|
| Philosophy | Function-oriented, "what the system does" | Object-oriented, "who does it" |
| Decomposition | Top-down into functions | Bottom-up into objects and classes |
| Data | Global, shared, exposed | Encapsulated, private to the object |
| Modelling tools | DFD, structure chart | UML class, sequence, state diagrams |
| Reusability | Low, functions are tied to context | High, through inheritance and composition |
| Maintenance | Change ripples across functions | Change is localised in a class |
| Outcome | Procedures and modules | Classes, objects and components |
Answer frame. Open with the definition of both approaches; then draw the 7-row table above; add points 4-6 as two lines on inheritance, modularity and maintenance; close with "OO design gives more reusable and maintainable systems than conventional design".
Asked: [7 marks] (May 2022, Jun 2025) Differentiate Conventional v/s OO design approach; compare their philosophies, processes and outcomes.
Design of CRC cards
Low weight
Definition. A CRC card is an index card that records a Class, its Responsibilities and its Collaborators, used to find the design of a system by role-playing.
Key points.
- The card has the class name at the top, responsibilities (what the class knows or does) on the left, and collaborators (other classes it needs help from) on the right.
- Step 1: identify classes from the nouns in the requirements or use cases.
- Step 2: write each class's responsibilities from the verbs, one short phrase each.
- Step 3: for each responsibility, list the collaborating classes that supply the missing help.
- Step 4: walk through a scenario with the team, moving cards to test and refine the design.
| Class: Account | |
|---|---|
| Responsibilities | Collaborators |
| Hold balance Debit and credit |
Transaction Customer |
Asked: [7 marks] (May 2022) What is a CRC card? How do you design it? Explain in detail.
Class diagram
Not asked since 2022
Definition. A class diagram is a UML static structure diagram that shows classes with their attributes and operations, and the relationships between them.
Key points.
- Each class is a three-compartment box: name, attributes, operations, with visibility marks
+public,-private,#protected. - Relationships shown are association, aggregation, composition, generalization (inheritance) and dependency, with multiplicity such as 1..* on the ends.
- It is the main design diagram, and code skeletons are generated from it.
Interaction Diagram
Low weight
Definition. An interaction diagram is a UML behavioural diagram that shows how objects exchange messages to carry out one use case or operation.
Key points.
- Behavioural modelling describes how a system acts over time, and interaction diagrams do this at object level.
- A sequence diagram arranges objects across the top with vertical lifelines and shows messages as horizontal arrows in time order from top to bottom, so it emphasises time.
- A collaboration (communication) diagram shows the same objects as nodes with links and numbered messages (1, 1.1, 2), so it emphasises structural organization.
- The two are semantically equivalent and convertible; sequence suits time flow, collaboration suits object links.
- Example, ATM withdrawal: Customer sends 1: insertCard to ATM, ATM sends 2: verifyPIN to Bank, Bank returns 3: ok, and ATM sends 4: dispense.
Asked: [7 marks] (Jun 2025) What are interaction diagrams in UML, and how do they contribute to behavioral modeling? Discuss sequence and collaboration diagrams and their significance.
State chart Diagram
Low weight
Definition. A state chart diagram shows the states an object passes through during its life, and the events, guards and actions that cause transitions between them.
Key points.
- It has an initial state (solid dot), states (rounded boxes), transitions (arrows labelled event [guard] / action) and a final state (bull's eye).
- For the Course and Registration System, a Course object moves Open, then Closed when full or on the deadline, then Cancelled or Completed.
- A Registration object moves Pending, then Confirmed when the fee is paid and a seat is free, then Dropped or Completed.
- Guards such as [seats available] decide whether a transition fires, and actions such as / send confirmation run on it.
Asked: [7 marks] (May 2022) Compose the state chart diagram for Course and Registration System.
Implementation Diagram: Component and deployment Diagram
Medium weight
Definition. A component is a replaceable, executable physical part of a system that hides its contents and exposes its behaviour through interfaces.
Key points.
- A component diagram is the implementation view: it shows components, their provided and required interfaces, and the dependencies between them.
- A provided interface (lollipop) is a service the component offers; a required interface (socket) is a service it needs from another component.
- A component realizes one or more interfaces, and other components depend only on the interface, not on the internals.
- Organization is shown by grouping components in packages or layers, and dependencies as dashed arrows toward the supplier.
- A deployment diagram shows nodes (hardware such as server, client, database machine), the artifacts deployed on them and the communication links between nodes.
| Basis | Component | Class |
|---|---|---|
| Nature | Physical implementation unit | Logical abstraction |
| Contents | Groups many classes | Attributes and operations |
| Access | Only through its interfaces | Direct through public members |
| Existence | At run time, replaceable file or module | Design-time concept |
Answer frame. For the definition question: define component, give the table, then explain interface relation (points 2-3). For the purpose question: define the diagram as the implementation view, draw the figure, then organization (4), and deployment (5); close with an example of an online shop.
Asked: [7 marks] (May 2022) Define component. What are the differences between components and classes? How are component and interface related? Asked: [7 marks] (Jun 2025) Explain the purpose of component diagrams and how they illustrate the organization and dependencies of components in a system.
Illustrative Case Studies like ATM, Payroll, Course and Registration System
Low weight
Definition. A case study applies OO design to a real system by finding its classes, relationships and behaviour, then modelling them in UML.
Key points.
- Payroll classes are Employee (with subclasses Permanent and Contract), Payroll, Salary, Department and Attendance.
- Encapsulation keeps salary data private behind methods; inheritance lets Permanent and Contract employees share Employee and override calculateSalary(); association links Department to Employee (1 to many) and Employee to Attendance.
- The Salary state chart moves Draft, then Calculated, then Approved, then Paid, ending in the final state.
- The activity diagram flows: read attendance, calculate salary, deduct tax, approve, generate payslip, transfer payment.
- For ATM the classes are Customer, Account, Card, Transaction and Bank; for Course Registration they are Student, Course, Registration and Faculty.
Asked: [7 marks] (Jun 2025) Discuss the design of a payroll system using object-oriented principles: primary classes, and its behavior through state chart and activity diagrams.
Last-minute revision
- Conventional design is function-oriented and top-down; OO design is object-oriented and bottom-up.
- CRC stands for Class, Responsibility, Collaborator.
- A CRC card is designed in four steps: classes, responsibilities, collaborators, scenario walkthrough.
- A class box has name, attributes and operations compartments.
- Sequence diagram emphasises time; collaboration diagram emphasises object links.
- A state chart has initial dot, states, transitions (event [guard] / action) and final bull's eye.
- Provided interface is a lollipop; required interface is a socket.
- A component diagram is the implementation view; a deployment diagram shows nodes.
- Payroll classes: Employee, Payroll, Salary, Department, Attendance.
Memory hooks
- CRC: "Class Really Cooperates".
- Sequence goes down with time, collaboration goes around with numbers.
- Lollipop gives, socket takes.
- Component is a "box of classes", node is a "box of hardware".
Coverage checklist
- Conventional v/s OO design approach: Q1 (May 2022, Jun 2025)
- Design of CRC cards: Q2
- Class diagram: no past question
- Interaction Diagram: Q6
- State chart Diagram: Q7
- Implementation Diagram: Component and deployment Diagram: Q4, Q5
- Illustrative Case Studies like ATM, Payroll, Course and Registration System: Q3