Blog
Object Oriented Analysis & Design MSc IT 3rd Term Past Paper 2019 UOS
University of Sargodha M.Sc. IT 3rd term Object Oriented Analysis & Design (SE-3311) past paper 2019, retyped from the original paper, with solved answers below.
Solved answers
Q1 – Short questions
(i) UML structural diagrams: diagrams that show the static structure of a system — class, object, component, deployment, package and composite-structure diagrams.
(ii) Simple vs composition aggregation: simple aggregation (hollow diamond) is a weak whole–part relationship where the part can exist independently and be shared (Department–Professor). Composition (filled diamond) is a strong relationship: the part belongs to one whole only and is created/destroyed with it (Order–OrderLine, House–Room).
(iii) Uses of use case diagrams: capturing functional requirements, showing system scope and context, identifying actors and their interactions, communicating with stakeholders, and providing a basis for test cases and iteration planning.
(iv) Domain model: a visual representation of the conceptual classes (real-world objects) in a problem domain, with their attributes and associations, drawn as a class diagram without operations. It represents the vocabulary and concepts of the domain, not software classes.
(v) Event, state, transition: an event is a significant occurrence that can trigger a change (e.g. “off hook”); a state is a condition of an object at a moment in time between events (e.g. Idle); a transition is a relationship between two states showing that when an event occurs the object moves from one state to the other.
(vi) Relationships in class diagrams: association, aggregation, composition, generalization (inheritance), dependency and realization.
(vii) Elaboration: the second phase of the Unified Process, in which the core architecture is programmed and tested, most requirements are discovered and stabilised, major risks are resolved, and realistic estimates are made.
(viii) Component: a modular, replaceable part of a system that encapsulates its implementation and exposes interfaces, e.g. a PaymentService component, a .jar/.dll library, or a database access module.
(ix) Package diagram: groups related model elements (classes, use cases) into packages and shows dependencies between them, organising large models into layers or subsystems.
(x) Traditional vs OO views: the traditional (structured) view sees software as functions/procedures that operate on separate data; the object-oriented view sees software as a collection of interacting objects that combine data and behaviour, supporting encapsulation, inheritance and polymorphism.
(xi) System sequence diagram: shows, for one scenario of a use case, the events that external actors send to the system (treated as a black box) and the system’s responses in time order; it identifies system operations.
(xii) Interaction diagram: shows how objects interact by sending messages. Types: sequence diagram, communication (collaboration) diagram, interaction overview diagram and timing diagram.
(xiii) Analysis vs design: analysis investigates the problem and requirements — what the system must do (domain models, use cases). Design provides a conceptual solution that satisfies the requirements — how it will be done (software classes, interactions, architecture).
(xiv) Instance: a concrete object created from a class, with its own values, e.g. Student s1 = new Student("Ali"); a particular Car “LEA-123” is an instance of class Car.
(xv) Deployment diagram: shows the physical architecture — hardware nodes (servers, devices), execution environments and the artifacts deployed on them, with communication paths.
(xvi) Fork and join: a fork (thick bar) splits one flow into several concurrent flows; a join (thick bar) synchronises concurrent flows back into one, continuing only when all incoming flows have completed.
Q2 – Course-ware management system
a) Use case diagram — actors: Course Administrator and Tutor.
+--------------------------------------------+
| Course-ware Management System |
| |
Course | (Manage Courses) --<<include>>--(Manage |
Administrator -| Topics) |
| | (Define Course Schedule) |
|-----------| (Assign Course to Tutor) |
| | (Publish Course Calendar) |
| | (Manage Tutor Information) |
| (View Course Calendar) ---------------------|- Tutor
Tutor ---------| (View Assigned Courses) |
| (Update Availability) |
| (Login) <<include>> from all use cases |
+--------------------------------------------+b) Class diagram:
+----------------------+ 1..* +------------------+
| Course |<>------------| Topic |
|----------------------| composed of |------------------|
| courseId : String | | topicId : String |
| title : String | | name : String |
| area : String | | duration : int |
| duration : int | +------------------+
|----------------------|
| addTopic() | 0..* 1..* +---------------------+
| updateContent() |-----------------------| Tutor |
+----------------------+ assigned to |---------------------|
| 0..* | tutorId : String |
| scheduled in | name : String |
| 1..* | specialization:Str |
+----------------------+ | availability : Date |
| CourseSchedule | |---------------------|
|----------------------| 0..* 1 | viewSchedule() |
| startDate : Date |-----------------------| updateAvailability()|
| endDate : Date | taught by +---------------------+
| venue : String |
+----------------------+
| 1..* part of
1 |
+----------------------+ manages 1..* 1 +-----------------------+
| CourseCalendar |----------------| CourseAdministrator |
|----------------------| |-----------------------|
| year : int | | adminId, name |
| publish() | | assignTutor() |
+----------------------+ | defineSchedule() |
| manageCourse() |
+-----------------------+A Course is composed of one or more Topics (composition); Tutors are assigned courses according to specialization and availability; each CourseSchedule (class/session) is taught by one Tutor and belongs to the yearly CourseCalendar, which is managed by Course Administrators.
Q3
a) Object: an instance of a class having identity, state (attribute values) and behaviour (operations), representing a real-world or conceptual entity. Main advantage of OO development: it models the problem domain naturally, giving reusable, maintainable and extensible software through encapsulation, inheritance and polymorphism, with a lower representational gap between the domain and the code.
b) Strategies to identify conceptual classes:
- Reuse or modify existing models (published domain models and analysis patterns for common domains).
- Use a category list of common conceptual classes: physical objects, transactions, transaction line items, roles of people, places, events, catalogs, containers, organizations, records, etc.
- Identify noun phrases (linguistic analysis) in use cases and requirements; nouns are candidates for classes or attributes.
Steps to create a domain model: (1) find the conceptual classes using the strategies above; (2) draw them as classes in a UML class diagram; (3) add associations needed to record relationships, with multiplicities; (4) add attributes needed to fulfil information requirements (no operations).
Q4 – Telephone line
a) State transition diagram:
[*]
|
v
+--------+ off hook +------------+ digit dialed +-----------+
| Idle |------------>| Dial Tone |---------------->| Dialing |<--+ digit
+--------+ +------------+ +-----------+---+
^ ^ ^ | after(timeout) invalid | | valid number
| | | v v v
| | | +------------+ +-----------+ +------------+
| | +-on hook-----| Time Out | | Invalid | | Connecting |
| | +------------+ | (recorded | | (routing) |
| +-------------------- on hook ---------------- | message) | +------------+
| +-----------+ | called party
| +-----------+ v answers
+------- on hook -------| Connected |<------------------------- +-----------+
(disconnect) | (talking) | | Ringing |
+-----------+ +-----------+States: Idle, Dial Tone, Dialing, Time Out, Invalid (recorded message), Connecting (routing), Ringing, Connected (talking). From any active state, “on hook” returns the line to Idle.
b) State machine diagrams model the dynamic behaviour of one object over its lifetime in response to events. Components (using the telephone line):
- Initial state (filled circle) → Idle; final state (bull’s-eye), if the object’s life ends.
- States (rounded rectangles): Idle, Dial Tone, Dialing, Connecting, Ringing, Connected; a state can have entry/exit/do activities, e.g. Dial Tone: do/play dial tone; Invalid: entry/play recorded message.
- Events/triggers: off hook, digit(n), valid number, invalid number, called party answers, on hook; time events: after(timeout).
- Transitions (arrows) labelled event [guard] / action, e.g. digit(n) [number complete and valid] / route call.
- Guard conditions and actions; composite states (e.g. an Active superstate containing all non-idle states, with a single “on hook” transition to Idle) and history states.
Q5
a) GRASP and Observer patterns:
- Information Expert: assign a responsibility to the class that has the information needed to fulfil it (e.g. Sale calculates its total because it knows its line items).
- Creator: assign class B the responsibility to create A if B contains/aggregates A, records A, closely uses A or has the initialising data (e.g. Sale creates SalesLineItem).
- Controller: assign the responsibility of handling system events from the UI to a non-UI class representing the system (facade controller) or a use-case scenario (use-case controller), e.g. ProcessSaleHandler.
- Observer (publish–subscribe): define a one-to-many dependency so that when a subject changes state, all registered observers are notified automatically (e.g. a sale total change updates several UI displays); gives low coupling between subject and observers.
b) Elements of an activity diagram: initial node, activity/action nodes, control flow arrows, decision and merge nodes (diamonds with guards), fork and join bars for concurrency, object nodes, swimlanes (partitions), activity final and flow final nodes. Example — course registration: start → enter student ID → [valid?] → select course → fork (check prerequisites ‖ check seat availability) → join → [OK] register and print confirmation → end; [not OK] show error → end.
Q6 – GoF patterns and phases of UP
GoF (Gang of Four) patterns: 23 design patterns described by Gamma, Helm, Johnson and Vlissides, grouped into three categories:
- Creational (object creation): Singleton, Factory Method, Abstract Factory, Builder, Prototype.
- Structural (composition of classes/objects): Adapter, Bridge, Composite, Decorator, Facade, Flyweight, Proxy.
- Behavioural (communication between objects): Observer, Strategy, Command, State, Template Method, Iterator, Mediator, Memento, Chain of Responsibility, Visitor, Interpreter.
Examples: Adapter converts one interface to another expected by clients (adapting different tax-calculator APIs); Factory centralises object creation; Singleton ensures one instance with global access; Strategy encapsulates interchangeable algorithms (pricing policies); Composite treats a group of objects like one object.
Phases of the Unified Process:
Inception --> Elaboration --> Construction --> Transition
(iteration) (iterations 1..n) (iterations 1..n) (iterations)
Each iteration runs the disciplines: business modelling, requirements,
design, implementation, test and deployment (effort varies by phase).- Inception: approximate vision, business case, scope, key use cases, vague estimates; decide whether to proceed.
- Elaboration: refine the vision, iteratively build and test the core architecture, resolve high risks, identify most requirements and make realistic estimates.
- Construction: iteratively implement the remaining lower-risk elements and prepare for deployment; most coding and testing.
- Transition: beta tests and deployment to users, training, fixing defects, release.
