Fundamentals Of Software Engineering Lecture V Kal Bugrara
Fundamentals Of Software Engineering Lecture V Kal Bugrara, Ph. D Software Engineering Northeastern University
Steps of the Modeling Process The Output: An Object Model Kal Bugrara, Ph. D Software Engineering Northeastern University
The steps 1. Scope the problem domain 2. Capture the key concepts within the problem domain 3. Generalize and specialize concepts as necessary 4. Surface any relationships between concepts 5. Formalize the concepts by mapping them to class definitions define class attributes define operations on the class inheritance class relationships Kal Bugrara, Ph. D Software Engineering Northeastern University
An Object Model Objects Classes Attributes Class relationships Operations on the classes Inheritance relationships Kal Bugrara, Ph. D Software Engineering Northeastern University
Object n n A concrete manifestation of an abstraction; an entity with a well-defined boundary and identity that encapsulates state and behavior; an instance of a class. (Booch, 1999) An object has: • State (set of conditions in which an object exists, implemented by a set of properties (attributes) with their values and the relationships with other objects) • Behavior (the way the object responds to events as well as how it interacts with other objects) • Identity (makes two objects different even in case they have the same state and behavior) Kal Bugrara, Ph. D Software Engineering Northeastern University
Classes n n A class denotes a set of objects that share the same attributes, operations, relationships, and semantics (Booch, 1999). • An object is an instance of a class A class is an abstraction: • Emphasizes relevant characteristics • Hides details Kal Bugrara, Ph. D Software Engineering Northeastern University
Classes vs. Objects n n A class is an abstract definition of an object. It defines the structure and the behavior of each object. A class is template for producing objects of a certain type. Objects are grouped into classes An object is a runtime instances of the corresponding class Kal Bugrara, Ph. D Software Engineering Northeastern University
Object Model Examples Kal Bugrara, Ph. D Software Engineering Northeastern University
Classes Kal Bugrara, Ph. D Software Engineering Northeastern University
Class: Student Attributes Operation What other characteristics define the Student class? Kal Bugrara, Ph. D Software Engineering Northeastern University
Class: Course Attributes Operation What other characteristics define the Course class? Kal Bugrara, Ph. D Software Engineering Northeastern University
Class: Student Account Attributes Operation What other characteristics define the Student Account class? Kal Bugrara, Ph. D Software Engineering Northeastern University
Class Relationship
Functions and Object Model Relationships Function[f] f Domain(f) Range(f) There is the idea of a mapping from an object in one class (called the domain of the function) to a subclass of another class (called the range of the function) Kal Bugrara, Ph. D Software Engineering Northeastern University
Mapping a b f f(a) { b} When the function f is argumented with object “a”, it returns a set containing object “b”. b is passed as an argument to invoke some operation. Kal Bugrara, Ph. D Software Engineering Northeastern University
Mapping GM Ford employees Ford f: employees Class: Company Class: Employee employees(Ford) Kal Bugrara, Ph. D Software Engineering { John, Joe, Jim, etc} Northeastern University
Cardinality Abbreviated as Zero to many 0. . * One to many 1. . * Zero to one 0. . 1 One to one 1. . 1 Kal Bugrara, Ph. D Software Engineering * 1 Northeastern University
Cardinality 0 to many One of A is associated with 0 or more of B f* A B 0 to 1 One of A is associated with 0 or 1 of B f 0. . 1 A B 1 to 1 One of A is associated with 1 of B Kal Bugrara, Ph. D f 1 A Software Engineering B Northeastern University
Cardinality 0 to many One of B is associated with 0 or more of A A f* B 0 to 1 One of B is associated with 0 or 1 of A A f 0. . 1 B 1 to 1 One of B is associated with 1 of A Kal Bugrara, Ph. D A f 1 Software Engineering B Northeastern University
Cardinality 0 to many A business unit can have 0 or more job positions Job positions * Business Unit Job Positions 0 to 1 An Inertnet communication channel can be idle (0 users) or used by one user at the time Internet Connection Internet user 0. . 1 User 1 to 1 An invoice is associated with one and only one customer Kal Bugrara, Ph. D customer 1 Invoice Software Engineering Customer Northeastern University
Cardinality one to one A job position is associated with one an only one business unit Business Unit Business unit 1. . 1 Job Positions zero to many A user can have zero or more internet connections Internet Connection i connections * User zero to many A customer can have 0 or more invoices Kal Bugrara, Ph. D Invoice invoices * Software Engineering Customer Northeastern University
What is the Cardinality on this relationship? Employee Kal Bugrara, Ph. D Employees employer Software Engineering Company Northeastern University
What is the Cardinality on this relationship? Business Unit Kal Bugrara, Ph. D Business unit Job positions Software Engineering Job Position Northeastern University
What is the Cardinality on this relationship? Job Postion Kal Bugrara, Ph. D Job positions in roles Software Engineering Job Function Northeastern University
What is the Cardinality on these relationships? Person Job Position Business Unit Skill Set Job Function Activity Kal Bugrara, Ph. D Software Engineering Northeastern University
What is the Cardinality on this relationship? Address Kal Bugrara, Ph. D Person’s Address Persons with address Software Engineering Person Northeastern University
What is the Cardinality on this relationship? Product products product part of catalog Product Catalog Company Kal Bugrara, Ph. D Software Engineering Northeastern University
What is the Cardinality on this relationship? Student students student directory Department Directory Department Kal Bugrara, Ph. D Software Engineering Northeastern University
What is this? Account Kal Bugrara, Ph. D Super account Sub account Software Engineering Account Northeastern University
Operation (Methods) n n An operation is the implementation of a service that can be requested from any object of the class to affect behavior (Booch, 1999) An operation can be: • Question (does not change the value of the object) • Command (may change the value of the object) • For example: • is. Full. Time. Employee() • Calculate. Total. Income(); • get. Full. Name() Kal Bugrara, Ph. D Software Engineering Northeastern University
We extracted the following classes from the original model. The focus is on classes to do with revenues. For a more modular design financial matters are separated from the student class. The result is the addition of a Student Account class. Detailed Object Model
The power behind Object Models Student related questions start here Department related questions start here
Review of Object Oriented Paradigm • • Abstraction Encapsulation Modularity Hierarchy Kal Bugrara, Ph. D Software Engineering Northeastern University
Abstraction n n Abstraction allows us to manage complexity by focusing on the features that matter. OO uses abstraction to define classes that make up the system. Kal Bugrara, Ph. D Software Engineering Northeastern University
Encapsulation n Encapsulation separates the implementation of objects operations from its public interface It is called “information hiding” -- it allows object’s behavior to be used without knowing its implementation Offers two kinds of security: • Protects object’s internal state from being changed by outside users. • Changes can be done to the behavior implementation without affecting other objects Operation Implementatio public Interface Data Kal Bugrara, Ph. D Software Engineering Northeastern University
Static Inheritance Supplier Larry Person Mary May Joe Employee Kim Joan Susan Customer Lora Kevin Kal Bugrara, Ph. D Software Engineering Northeastern University
Static Inheritance Person Customer Employee Supplier All instances of Customer, Employee, and Supplier, all inherit all the features of Person Kal Bugrara, Ph. D Software Engineering Northeastern University
For example Address address Person Customer Employee Customer and Employee will inherit the address relationship. Inhertance allows you to reuse what already defined. There is no need to define an Address for Customer and Employee Kal Bugrara, Ph. D Software Engineering Northeastern University
Inheritance (contd. ) Address Person Customer Kal Bugrara, Ph. D Software Engineering Employee Northeastern University
Inheritance (contd. ) Address Home Address Kal Bugrara, Ph. D Address Primary Address Software Engineering Person Customer Employee Northeastern University
Modularity n n The process of breaking up of a complex situation into small, self contained pieces that can be managed independently Classes are independent modules (distribute responsibility across classes) Job Skill Set Job Function Task We could have lumped all these ideas to get one class Kal Bugrara, Ph. D Software Engineering Northeastern University
Hierarchy n n Any ranking or ordering of abstractions into a complex structure. Type of hierarchies: • Class • Aggregation Super account • Containment • Inheritance Account • Partition Sub account • Specialization customer Person employee supplier Kal Bugrara, Ph. D Software Engineering Northeastern University
Hierarchies and the OO Paradigm OO paradigm allows you to capture two types hierachical structures: Dynamic using relationships for example, an organizational structure Static using inheritance for example, classification of different resource types that share common features Kal Bugrara, Ph. D Software Engineering Northeastern University
Generating a hierarchical structure where all the elements are instances of Business Unit super unit Business Unit Sub unit Corporate Client Services Sales and Marketing Customer Service Operations Kal Bugrara, Ph. D Call Center III Software Engineering Call Center II Call Center I Northeastern University
For each level of the hierarchy we generate 0 or more instances of job positions super unit Job Positions Business unit 1. . 1 Job positions * Business Unit Sub unit Corporate c 1 c 3 c 2 Client Services Customer Service s 1 s 3 s 2 s 4 At every level there are 0 or more Instances of job positions Kal Bugrara, Ph. D j 1 j 3 j 2 j 4 Call Center II Software Engineering Call Center I Northeastern University
A job function (role) is a hierarchy of (sub) job functions (subroles) Super role Job Function Sub role Manager Client Representative Operations Manager Service Representative Project Lead Performer Kal Bugrara, Ph. D Proposal Writer Software Engineering Northeastern University
A job function describes a set of work responsiblities Super role Activity Job Function Activities (work resps) * Sub role Manager a 1 a 3 a 2 Client Representative a 4 a 5 a 6 Each instance of Job Function defines an associated set of activities (work responsibilities Kal Bugrara, Ph. D Service Representative Proposal Writer a 7 a 8 Software Engineering Each is an instance of Job Function Northeastern University
Basic Concepts of Object Orientation n n n Object Class Relationships Attribute Operation Interface (Polymorphism) Kal Bugrara, Ph. D Software Engineering Northeastern University
Kal Bugrara, Ph. D Software Engineering Northeastern University
- Slides: 49