180 likes | 479 Views
Requirement Specification Domain Model. Domain Model Classes and Objects Association Structure. Information Need in the IT System. Information need are found by analysing the problem-domain for the IT system Ask the question: What information should be registered by the IT system ?
E N D
Requirement SpecificationDomain Model Domain Model Classes and Objects Association Structure
Information Need in the IT System • Information need are found by analysing the problem-domain for the IT system • Ask the question: What information should be registered by the IT system ? • The building blocks are objects • binds requirements, design and program together • Result: A model showing the problem-domain – we call it Domain Model • ” The most important model in OO analysis”
Objects binds requirements, design and programming together Implementation Writing the code public class Customer { private int id, private String name; private String address; public Customer(int id) { this.id = id; } public String getName() { return name; } ….. Test Requirement Functional Use case: find customer A sales person wants to find information about customer The sales person types the customers id The system returns information about the customer Non functional The system has to be user friendly Clarify information Customer: id, name, address Design Design of architecture Design of GUI Design of classes Design database Domain object of class Customer 3
Domain model • A domain model is the visual representation of conceptual classes • We illustrate it by drawing a UML class diagram: • Domain objects or conceptual classes • Associations between the objects • Each objects attributes • A conceptual class is described by: • name (symbol) • Definition – the purpose in problem domain (intension) • Examples given on objects created from class (extension)
Example of a conceptual class Customer • Class: • Definition: The customer class is used to describe the company's customers. • An example: • Hans Andersen, Eventyrvej 2, 5000 Odense, phone 75 45 67 89, e-mail: ha@eventyr.dk • …… • Attributes: Name, adress, phone, e-mail Customer Name Adress Phone E-mail
Requirement specification . Try to create this one in UMLet
Association • Relation between a number of objects. Association • A customer can have more orders at once – an order belongs to one customer only. • Drawn as a simple line like this: UML class UML Association with multiplicity
A pattern in a domain model • Called the agreement pattern • A customermakes an agreement with regard to some item • Car rental • Customer, rentcontract, the car • Education student, class, subjects • Library borrower, loan, book copy
Relateringsmønstret (relational pattern)En associering har selv nogle egenskaber (data) Den nedersteer den vi typiskanvender. Erogsåbedre at brugeiforbindelse med databaser
Aggregation • Used when there is a stronger relation between two classes than association can express • Here we have the Item-Descriptor pattern
Generalisation • Used when there are some common attributes shared by several classes (it is implemented as inheritance)
Domain model: Role Pattern I Generalization: A Person is either a Student or a Lecturer
Domain model: Role Pattern II Role pattern: A Person can be Student as well as Lecturer at the same time
Composite Pattern – the problem How to model the fact that an item can be composed of other items with different measurement units? A major building market Items has different measurement units -> generalisation An item can be composed of other items i.e. a kitchen -> reflexive aggregation (recursion)
General implementation and example Composite pattern Composite pattern Problem • How to treat composite objects the same way as atomic (simple) objects? Solution • Define classes for both composite and atomic (simple) objects so they implement the same interface