Object-Oriented Approach Both the problem and its solution is represented as a collection of objects that unify data and behavior descriptive of entities.

Slides:



Advertisements
Similar presentations
Database Systems: Design, Implementation, and Management Tenth Edition
Advertisements

Object-Oriented Application Development Using VB.NET 1 Chapter 5 Object-Oriented Analysis and Design.
Solutions to Review Questions. 4.1 Define object, class and instance. The UML Glossary gives these definitions: Object: an instance of a class. Class:
OOAD Using the UML - Use-Case Analysis, v 4.2 Copyright  Rational Software, all rights reserved 1/18 Use Case Analysis – continued Control Classes.
Use Case Diagram © copyright 2001 SNU OOPSLA Lab..
Object-Oriented Analysis and Design
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 1 Object-Oriented.
Introduction To System Analysis and Design
1 Software Testing and Quality Assurance Lecture 12 - The Testing Perspective (Chapter 2, A Practical Guide to Testing Object-Oriented Software)
Object-Oriented PHP (1)
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
Aalborg Media Lab 23-Jun-15 Inheritance Lecture 10 Chapter 8.
Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.
Modified from Sommerville’s originalsSoftware Engineering, 7th edition. Chapter 8 Slide 1 System models.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
Chapter 10 Classes Continued
Developed by Reneta Barneva, SUNY Fredonia Component Level Design.
Sharif University of Technology Session # 7.  Contents  Systems Analysis and Design  Planning the approach  Asking questions and collecting data 
C++ fundamentals.
1)Never start coding unless you understand the task! 2)Gather requirements first. This means identify the problem and ask questions about it. Now you kind.
Introduction To System Analysis and design
Chapter 7 Requirement Modeling : Flow, Behaviour, Patterns And WebApps.
OO Analysis and Design CMPS OOA/OOD Cursory explanation of OOP emphasizes ▫ Syntax  classes, inheritance, message passing, virtual, static Most.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 12 Object-Oriented Design.
UFCEUS-20-2 : Web Programming Lecture 5 : Object Oriented PHP (1)
C++ Object Oriented 1. Class and Object The main purpose of C++ programming is to add object orientation to the C programming language and classes are.
Systems Analysis and Design in a Changing World, Fifth Edition
11 1 Object oriented DB (not in book) Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel Learning objectives: What.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 12 Object-Oriented.
SOFTWARE ENGINEERING BIT-8 APRIL, 16,2008 Introduction to UML.
OBJECT ORIENTED PROGRAMMING CONCEPTS ISC 560. Object-oriented Concepts  Objects – things names with nouns  Classes – classifications (groups) of similar.
Database Systems: Design, Implementation, and Management Ninth Edition
1 Chapter 2 (Cont.) The BA’s Perspective on Object Orientation.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 20 Object-Oriented.
5 Systems Analysis and Design in a Changing World, Fourth Edition.
Introduction To System Analysis and Design
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
CSE 425: Object-Oriented Programming I Object-Oriented Programming A design method as well as a programming paradigm –For example, CRC cards, noun-verb.
CSC 395 – Software Engineering Lecture 13: Object-Oriented Analysis –or– Let the Pain Begin (At Least I’m Honest!)
SE: CHAPTER 7 Writing The Program
Chapter 2 Introducing Interfaces Summary prepared by Kirk Scott.
Requirements Engineering Methods for Requirements Engineering Lecture-30.
PowerPoint Presentation for Dennis & Haley Wixom, Systems Analysis and Design, 2 nd Edition Copyright 2003 © John Wiley & Sons, Inc. All rights reserved.
5 Systems Analysis and Design in a Changing World, Fifth Edition.
1 What is OO Design? OO Design is a process of invention, where developers create the abstractions necessary to meet the system’s requirements OO Design.
Object Oriented Software Development
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
ITEC 3220A Using and Designing Database Systems Instructor: Gordon Turpin Course Website: Office: CSEB3020.
CSC 131 Fall 2006 Lecture # 6 Object-Oriented Concepts.
Testing OO software. State Based Testing State machine: implementation-independent specification (model) of the dynamic behaviour of the system State:
Software Engineering and Object-Oriented Design Topics: Solutions Modules Key Programming Issues Development Methods Object-Oriented Principles.
OOP Review CS 124.
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall Object-Oriented Systems Analysis and Design Using UML Systems Analysis and Design,
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
ITEC0724 Modern Related Technology on Mobile Devices Lecture Notes #2 1.
Object-Oriented Software Engineering Practical Software Development using UML and Java Modelling with Classes.
5 Systems Analysis and Design in a Changing World, Fourth Edition.
Sections Inheritance and Abstract Classes
Roberta Roth, Alan Dennis, and Barbara Haley Wixom
The Movement To Objects
Object-Oriented Analysis and Design
Chapter 11 Object-Oriented Design
Unified Modeling Language
Copyright 2007 Oxford Consulting, Ltd
Fundaments of Game Design
PPT6: Object-oriented design
Object-Oriented PHP (1)
Object-Oriented Programming
Presentation transcript:

Object-Oriented Approach Both the problem and its solution is represented as a collection of objects that unify data and behavior descriptive of entities involved. Objects are subject to classification based on shared traits or similar characteristics. Hence each object can be an instance of a class.

Object Hierarchy, Base Classes Classes are often organized in a hierarchy with one or more base classes serving as roots of hierarchal relations. Subclasses are derived from base classes (aka superclasses). A derived class inherits all the features of the base class, but can introduce its own specifics or deviations from the original behavior.

Abstract Classes, Polymorphism Abstract class: a class that cannot be instantiated directly, it can only serve as a basis for deriving subclasses. Interface: “distilled” abstract class (no implementation details whatsoever). Behavior: action or transformation an object can perform or be subjected to (can be expressed as a collection of methods and events). Polymorphism reflects the fact that subclasses differ among themselves and from the base class.

Benefit of Objects Abstraction: makes difficult concepts look simple Encapsulation: hides unnecessary detail Polymorphism: allows for specialization of general behavior Do objects really make the expression of your process / problem simpler?

OO Solution If you can express your problem or process in terms of objects and interrelations among them you have an abstract OO solution. Good OO design is such that it makes this OO solution look simple. Then coding amounts to filling in blanks in method and property implementations.

OO Example: Validation Problem: Validate address Solution: Define class that has an IsValid() method. E.g. if ( ) … And you are done! But what does IsValid() do??

OO Decomposition is comprised of LocalPart and Domain. is valid when: -It can be parsed into LocalPart and Domain -and when both are valid. => bool :IsValid() { return Parse() && LocalPart.IsValid() && Domain.IsValid(); } * class needs Parse() method LocalPart and Domain member classes.

Domain: OO Decomposition is comprised of LocalPart and Domain. is valid when: -It can be parsed into LocalPart and Domain -and when both are valid. => bool :IsValid() { return Parse() && LocalPart.IsValid() && Domain.IsValid(); } * class needs Parse() method LocalPart and Domain member classes.

Subdomain and TLD Relation TLD is a special case of Subdomain. Namely TLD is a subdomain to which additional validation rules apply (e.g. the list of TLD values is determined by ICANN). Therefore these objects are related. In fact Subdomain is a base class for TLD. TLD::IsValid() is inherited and overriden: bool TLD::IsValid() { return Subdomain::IsValid() && InIcanList(); }

Fill In the Blanks Implement :Parse(), Domain::Parse(), Subdomain::IsValid(), TLD::InIcannList(). But even with these methods blank you have an abstract solution that is correct in principle and easy to grasp.

Use Cases: Tool of OO Design Pertain to requirement elicitation, help understand the way system/object us used. Use cases describe a dialog between an object and an actor, which could be a user, a device or an external system. Use cases can be expressed graphically (e.g. via UML) or textually as “scenario scripts”. In principle a requirement for any process can be given as a comprehensive collection of use cases. When the system is complete the use cases can provide a basis for acceptance testing.

Use Cases Diagrams Actor: entity interacting with object Use Case: depiction of functionality Extension: extends the case to illustrate a different or deeper perspective Use: application / re-uses of the already-defined case.

Use Cases Diagram Example Start by listing a sequence of steps a user might take in order to complete an action. For example a user placing an order with a sales company might follow these steps: Browse catalog and select items Call sales representative. Supply shipping information. Supply payment information. Receive conformation number from salesperson

Use Cases Questions What actors pertain to the use the object? What actors / systems are needed for the object to perform its functions? What external systems send / receive information to / from the object? Answering these helps make the use cases complete.

Use Cases Checks Is the terminology consistent? I.e. does everyone use the same terms to describe the same entity, actor or action? Do the activities match perspectives and are they consistent? Are the interactions clear and complete? Are there missing interactions? Are there any redundant activities or actors? Is it clear where each activity starts and ends?

OO System Design After identifying entities (object candidates) in requirements and expressing their interrelations via use cases we need to see what entities share common characteristics. Then we can express these common traits in a base class. However, it is conceivable that the identified objects are too dissimilar. But we still can go with OO design as long as the functionality we identified is tightly coupled to the objects.

OO System Design, cont’d Actions documented in use cases and in specifications are good method candidates. Permanent data and state information are properties candidate.

Object Relationships Association: classes appear together, and the relationship is preserved for some time. Aggregation: one class is a part (i.e. member) of another class. Dependency: changes to the definition of one class affect the other (not a good idea for classes, OK for packages).

OO Program Design First Steps: 1)Declaring classes outlined in specification 2)Declaring methods according to interface specification 3)Building an abstract solution operating with empty methods and incomplete classes 4)Making sure that your abstract solution is correct in principle and 5)Filling the blanks (method implementations)

OO Program Design, cont’d Filling in the blanks: Creating additional (utility) classes that are not described in specification Creating additional (private) methods and (private) data members Implementing solution in a hierarchal way providing more and more implementation details with each step.

OO Program Design, cont’d Finding and Resolving Problems: -You may be using previously developed (e.g. reusable) or 3 rd party objects that are not fully compatible or require modification / tuning – Drop reusable code? Modify design? -You may discover that object interfaces listed in specification are inadequate or inconvenient and need modification – amend spec -You may find inconsistencies or omissions in specification (as well as flaws in the requirements) - amend spec / requirement

OO Program Recommendations -Use private to hide all you can -Provide get-accessors for read-only properties -Indicate const methods and mark read-only parameters as such -Avoid using output parameters (use return values instead) -Try to minimize state information in favor of passing additional parameters -Use static (early) binding in favor of late -Throw exceptions in favor of error codes -Never use global objects / global variables -Always follow consistent and predictable coding patterns -Workout a reusable framework if working on similar projects

Data Management Design How do you store and recover persistent objects? We may need a data model (and a data modeler as well as database administrator in developer team). Relational data always needs to be properly constrained!

Asynchronous Tasks Is our process event driven or time driven? Or is it sequential? If our process is event driven and involves communicating object state changes there are two approaches: -Global Observer: monitors state changes of all objects involved and issues notifications for dependent objects -Concrete Observer: each object monitors its own subject

OO Design Measures Provide numeric measure of qualities of your OO design in order to optimize: -Number of base classes -Density of utility classes -Specialization Index: SI = Overridden*level/methods -Methods per class -Weighted methods per class (account for code length-complexity) -Levels of inheritance -Lack of cohesion

Reading Chapter 6 in Pfleeger; Chapter 10 in my book.