CSF213 L27
CSF213 L27
BITS Pilani
Hyderabad Campus
BITS Pilani
Hyderabad Campus
Todays Agenda
Software Development Process Class Relationships UML Connectors Example
4. testing
Analysis Phase
Goal : Complete Description of What the Software Product Should do? Result of Analysis Phase is detailed a textual description [Functional Specification]
Design Phase
Goals: 1. 2. 3. Identification of Classes Identification of Responsibilities of each class Identification of Relation ships among various classes
Implementation
Goal: 1. Programming (Coding Phase) 2. 3. Testing Deployment
Object Orientation
We will approach the design of programs from an objectoriented perspective. Key idea (notion?) in object orientation: The real world can be accurately described as a collection of objects that interact. Assumptions:
Describing large, complex systems as interacting objects make them easier to understand than otherwise. The behaviors of real world objects tend to be stable over time. The different kinds of real world objects tend to be stable. (That is, new kinds appear slowly; old kinds disappear slowly.) Changes tend to be localized to a few objects.
CS/IS F213 First Semester 2012-13 BITS Pilani, Hyderabad Campus
An Object Model
Our object model includes four components: objects (i.e., abstract data structures) classes (i.e., abstract data types) inheritance (hierarchical relationships among ADTs) polymorphism by inheritance
Whats Object?
Object is characterized by 1. 2. 3. State [Collection of all information] Behavior [Operations, Responsibilities] Identity [ Unique Attribute] Class is collection of objects with same behavior and attributes An Object is simply an instance of Class
CS/IS F213 First Semester 2012-13 BITS Pilani, Hyderabad Campus
Examples
employee: has a name, employee# and department; an employee is hired, and fired; an employee works in one or more projects
Two different objects may have identical attribute values (like two people with identical name and address)
Associations
Objects do not exist in isolation from one another The concept of association represents relationships between objects and classes. In UML, there are different types of relationships:
Association Aggregation and Composition Generalization Dependency Realization
Note: The last two are not useful during requirements analysis
CS/IS F213 First Semester 2012-13 BITS Pilani, Hyderabad Campus
Class Relationships
1. Association[Uses]
2.
3. 4.
Dependency [ Uses]
Aggregation [ hasA , a-part-of] Inheritance [ isA]
Association
Association describes a link, a link being a connection among objects between classes. Association is shown by a solid line between classes.
Role
Plane
Association name
Association - Properties
Name
Name of the association
Role
The specific role of the association
Multiplicity
Indicates the number of objects that are connected
Type
Plain association, aggregation, composition
Direction
Direction can also be shown for a association
CS/IS F213 First Semester 2012-13 BITS Pilani, Hyderabad Campus
Notes
Name : works for Is the name of the relationship. Role : Person plays the role employee and the Company plays the role employer. Multiplicity : Many employees to one company. Type : This shows a plain association (normally referred to as association)
Customer
Order
Purchased Sold to
Product
Association Multiplicity
Some examples of specifying multiplicity: Optional (0 or 1) 0..1 Exactly one Zero or more One or more A range of values 1 0..* 1..* 2..6 = 1..1 =*
Association - Multiplicity
A Student can take up to five Courses. Student has to be enrolled in at least one course. Up to 300 students can enroll in a course. A class should have at least 10 students.
Association - Multiplicity
A teacher teaches 1 to 3 courses (subjects) Each course is taught by only one teacher. A student can take between 1 to 5 courses. A course can have 10 to 300 students.
Association - Multiplicity
Company can have many employees. An employee can only work for one company.
Association - Multiplicity
Aggregation (a-part-of)
Object Containment Composition [Strong Ownership]
1 Team 1..10 Player
Aggregation
1 Human
1 Heart Composition
1
Human
2 Eyes Composition
isA [Inheritance]
Inheritance Relationship [Reusability]
Account
Saving
Checking
Dependency [Uses]
One Class depends upon another class if it manipulates the Objects of another class
UML Connectors
Uses Aggregation Composition Association Directed Association Inheritance
Interface Implementation
CS/IS F213 First Semester 2012-13 BITS Pilani, Hyderabad Campus
Class Diagrams
Summary
Software development process consists of three major phases. While the transition of programming in small to large managing the classes is difficult and hence we use design phase. Classes and objects in an application do not exist on their own but they will have to interact to do a task and hence relationshiph exists between them.