Presentation is loading. Please wait.

Presentation is loading. Please wait.

Object-Oriented Modeling Chapter 10 CSCI 1302. CSCI 1302 – Object-Oriented Modeling2 Outline The Software Development Process Discovering Relationships.

Similar presentations


Presentation on theme: "Object-Oriented Modeling Chapter 10 CSCI 1302. CSCI 1302 – Object-Oriented Modeling2 Outline The Software Development Process Discovering Relationships."— Presentation transcript:

1 Object-Oriented Modeling Chapter 10 CSCI 1302

2 CSCI 1302 – Object-Oriented Modeling2 Outline The Software Development Process Discovering Relationships Among Classes –Association –Aggregation and Composition –Inheritance Class Design Guidelines –Designing a Class –Using the Visibility Modifiers

3 CSCI 1302 – Object-Oriented Modeling3 Outline Class Design Guidelines (cont.) –Using the static Modifier –Using Inheritance or Composition –Using Interfaces or Abstract Classes Framework-Based Programming Using the Java API

4 CSCI 1302 – Object-Oriented Modeling4 Software Development Process Software products follow a general process

5 CSCI 1302 – Object-Oriented Modeling5 Requirements Specification A formal process that seeks to understand the problem and document in detail what the system should do Close interaction between users and designers Real world projects are not as clearly defined or as simple as examples in class or book

6 CSCI 1302 – Object-Oriented Modeling6 System analysis Analyze the business process in terms of data flow Identify input and output Model the system’s behavior

7 CSCI 1302 – Object-Oriented Modeling7 System design Process of designing the system’s components Many levels of abstraction to decompose the problem into manageable components Identify classes and interfaces and establish relationships among them

8 CSCI 1302 – Object-Oriented Modeling8 Implementation Translate the design into programs Separate programs are written for each component Involves coding, testing, and debugging

9 CSCI 1302 – Object-Oriented Modeling9 Testing Ensures that the code meets the requirements specification and weeds out bugs Independent testers are usually used to conduct testing

10 CSCI 1302 – Object-Oriented Modeling10 Deployment Makes the project available for use Applets – Install on a web server Application – Installing on client’s computer Projects consist of many classes, java often packages all of them into a Java archive file (.jar file)

11 CSCI 1302 – Object-Oriented Modeling11 Maintenance Changing and improving the product Periodic upgrades Bug fixing Incorporate any changes

12 CSCI 1302 – Object-Oriented Modeling12 Discovering Relationships Three types of class relationships –Association –Aggregation –Inheritance

13 CSCI 1302 – Object-Oriented Modeling13 Association General binary relationship that describes an activity between two classes

14 CSCI 1302 – Object-Oriented Modeling14 Association Illustrated using a solid line with optional label (“Take” and “Teach”) Optional triangle to indicate direction of relationship Each class may have a role name (“Teacher”) Each class may specify multiplicity * - unlimited, m..n is an inclusive range Usually represented as a data field

15 CSCI 1302 – Object-Oriented Modeling15 Aggregation and Composition Aggregation is a special form of association that represents an ownership relationship between two classes Models “has-a” relationships Object may be owned by other aggregated objects, if exclusively owned, that is composition Empty diamond – aggregation, filled diamond – composition

16 CSCI 1302 – Object-Oriented Modeling16 Aggregation and Composition

17 CSCI 1302 – Object-Oriented Modeling17 Inheritance Models “is-a” relationship between two classes “Strong is-a” describes direct inheritance, extending a class “Weak is-a” describes a class that has certain properties, implementing an interface

18 CSCI 1302 – Object-Oriented Modeling18 Case Studies Model the application in terms of cooperative objects Building an object-oriented system 1.Identify classes for the system 2.Describe the attributes and methods in each class 3.Establish relationships among classes 4.Create classes

19 CSCI 1302 – Object-Oriented Modeling19 Designing a Class Class should describe a single entity, and all the class operations should fit together to support a coherent purpose Used by many different customers, should be able to customize through properties and methods Designed for reuse (see p. 358) Should provide a public no-arg constructor, override equals and toString

20 CSCI 1302 – Object-Oriented Modeling20 Using Visibility Modifiers Class can present two contracts: one for users, one for extenders Make fields private and accessor/mutator methods public if intended for users Make fields or methods protected if they are intended for extenders Use private to hide data from direct access by clients

21 CSCI 1302 – Object-Oriented Modeling21 Using the static Modifier A shared property among all instances of a class should be declared static Non-instance specific methods should be declared as a static method

22 CSCI 1302 – Object-Oriented Modeling22 Using Inheritance or Composition Inheritance – “is-a” relationship Apple is a Fruit public class Apple extends Fruit Composition – “has-a” relationship Person has a name public class Person { private Name name; }

23 CSCI 1302 – Object-Oriented Modeling23 Using Interfaces or Abstract Classes Both used to generalize common features “Strong is-a” relationship that clearly describes a parent-child relationship should be modeled using classes “Weak is-a” or “is-kind-of” relationship indicates an object has a certain property and should be modeled using interfaces

24 CSCI 1302 – Object-Oriented Modeling24 Framework-Based Programming Classes and interfaces provided by the Java API allow developers to harness the power of the framework GUI API established a framework for developing GUI programs Using these classes and interfaces to create applications is framework-based programming


Download ppt "Object-Oriented Modeling Chapter 10 CSCI 1302. CSCI 1302 – Object-Oriented Modeling2 Outline The Software Development Process Discovering Relationships."

Similar presentations


Ads by Google