Object-Oriented Design Concepts University of Sunderland.

Slides:



Advertisements
Similar presentations
Exceptions CSE301 University of Sunderland Harry Erwin, PhD.
Advertisements

Ch:8 Design Concepts S.W Design should have following quality attribute: Functionality Usability Reliability Performance Supportability (extensibility,
Chapter 10 Introduction to Arrays
Software Engineering Software Design Slide 1 Software Engineering Software Design.
Software Design Hoang Huu Hanh, Hue University hanh-at-hueuni.edu.vn.
Chapter 22 Object-Oriented Systems Analysis and Design and UML Systems Analysis and Design Kendall and Kendall Fifth Edition.
Classes & Objects Computer Science I Last updated 9/30/10.
2-1 © Prentice Hall, 2007 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
Introduction To System Analysis and Design
Object-Oriented Databases v OO systems associated with – graphical user interface (GUI) – powerful modeling techniques – advanced data management capabilities.
Software Testing and Quality Assurance
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
© 2006 Pearson Addison-Wesley. All rights reserved4-1 Chapter 4 Data Abstraction: The Walls.
What is UML? A modeling language standardized by the OMG (Object Management Group), and widely used in OO analysis and design A modeling language is a.
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
© 2006 Pearson Addison-Wesley. All rights reserved4-1 Chapter 4 Data Abstraction: The Walls.
Chapter 10 Classes Continued
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation (Adapted) Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra,
Ranga Rodrigo. Class is central to object oriented programming.
Comparison of OO Programming Languages © Jason Voegele, 2003.
MADALINA CROITORU Software Engineering week 4 Madalina Croitoru IUT Montpellier.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 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.
11 1 Object oriented DB (not in book) Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel Learning objectives: What.
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
1/19 Component Design On-demand Learning Series Software Engineering of Web Application - Principles of Good Component Design Hunan University, Software.
OBJECT-ORIENTEDNESS KCDCC. WHAT IS OBJECT-ORIENTEDNESS? KCDCC model system as a collection of interacting objects O-O Modelling O-O Programming similar.
An Object-Oriented Approach to Programming Logic and Design
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Object Oriented Programming with JAVA Arash N. Kia AlZahra University Definitions – Part 1.
Object Oriented Analysis & Design & UML (Unified Modeling Language)1 Part V: Design The Design Workflow Design Classes Refining Analysis Relationships.
Introduction To System Analysis and Design
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Chapter 7 Objects and Classes 1 Fall 2012 CS2302: Programming Principles.
Software Design Deriving a solution which satisfies software requirements.
Low-Level Detailed Design SAD (Soft Arch Design) Mid-level Detailed Design Low-Level Detailed Design Design Finalization Design Document.
OOP Class Lawrence D’Antonio Lecture 3 An Overview of C++
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Object-Oriented Design Simple Program Design Third Edition A Step-by-Step Approach 11.
1 Class Diagrams: Advanced Concepts. 2 Overview Class diagrams are the most commonly used diagrams in UML. Class diagrams are the most commonly used diagrams.
Design Model Lecture p6 T120B pavasario sem.
Data Structures Using C++ 2E
Basic Concepts of Object Orientation Object-Oriented Analysis CIM2566 Bavy LI.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Object-Oriented Design Concepts CSE301 University of Sunderland Harry R. Erwin, PhD.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Chapter 10: Classes and Data Abstraction. Objectives In this chapter, you will: Learn about classes Learn about private, protected, and public members.
Object-Oriented Programming © 2013 Goodrich, Tamassia, Goldwasser1Object-Oriented Programming.
Data Design and Implementation. Definitions Atomic or primitive type A data type whose elements are single, non-decomposable data items Composite type.
Chapter 20 Concepts for Object-Oriented Databases Copyright © 2004 Pearson Education, Inc.
Copyright © 2004, Keith D Swenson, All Rights Reserved. OASIS Asynchronous Service Access Protocol (ASAP) Tutorial Overview, OASIS ASAP TC May 4, 2004.
CSCI 383 Object-Oriented Programming & Design Lecture 7 Martin van Bommel.
Object Design More Design Patterns Object Constraint Language Object Design Specifying Interfaces Review Exam 2 CEN 4010 Class 18 – 11/03.
COP 4331 – OOD&P Lecture 7 Object Concepts. What is an Object Programming language definition: An instance of a class Design perspective is different.
 Description of Inheritance  Base Class Object  Subclass, Subtype, and Substitutability  Forms of Inheritance  Modifiers and Inheritance  The Benefits.
Chapter 11: Abstract Data Types Lecture # 17. Chapter 11 Topics The Concept of Abstraction Advantages of Abstract Data Types Design Issues for Abstract.
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
Principles of Programming & Software Engineering
Data Abstraction: The Walls
Cmpe 589 Spring 2006.
Design by Contract Jim Fawcett CSE784 – Software Studio
Design by Contract Jim Fawcett CSE784 – Software Studio
Interface Java 7 COMP T1.
About the Presentations
Section 11.1 Class Variables and Methods
More Object-Oriented Programming
Chapter 22 Object-Oriented Systems Analysis and Design and UML
Presentation transcript:

Object-Oriented Design Concepts University of Sunderland

Terminology Object Oriented Design Modularity Design by Contract Abstraction

Object-Oriented Design An object-oriented system solves a design problem using a collection of peer subsystems interacting via interfaces. –Subsystems may be composite, with multiple subsystems, or atomic, consisting of a single class or object. –‘Peer’ means that there is no single subsystem in charge.

Objects An ‘object’ is anything with the characteristics of: –Identity –Attributes –Behavior Rows in a relational database table are not objects because they lack identity. Attributes are usually implemented as member data in Java classes. Behavior is usually implemented as member functions or methods in Java classes.

Methods A method is a portion of the behavior of a class or class instance. Public methods are class or instance behavior that responds to messages from other classes or objects.

Message-Passing Conceptually in object-oriented programming, parameters are passed to a function call as a message. Ideally, a message is an object, and it is sent to a 'port' on the destination object that is specified as an interface. In Java or C++, the syntax is: o.foo(msg) Where o is the destination object, foo is a method in the interface (the port), and msg is the message.

Messages in C++ and Java C++ and Java define this ‘port’ somewhat differently. In Java, any class that implements the functions listed in an interface can state it implements the interface. In C++, an interface is an abstract class with all function members and the destructor being abstract and virtual. The class of the object receiving the message must inherit from that abstract class.

An Approach to Object-Oriented Design Define your subsystems and interfaces first. –In Java, subsystems are often (but not necessarily) packages. –Interfaces in Java are more fundamental than inheritance. Define interfaces early and consider inheritance during detailed design. Decompose your problem into interacting subsystems. Having a single main process is not good O-O design. Each subsystem and object should have one primary function. Avoid trying to do too much; instead delegate responsibilities to associated classes. Don’t dive to the bottom; define high-level subsystems before low-level subsystems.

Modularity Meyer (1988) examined modular design formally. He identified five criteria for software modularity and five principles of good modular design. Meyer’s five criteria were: 1.modular decomposability—A design method meets this if it helps in the decomposition of a novel problem into independent subproblems. 2.modular composability—A design method meets this if it favors the production of components. 3.modular understandability—A method favors this if the modules it produces can be separately understood. 4.modular continuity—A method satisfies this if a small change does not propagate through the entire design. 5.modular protection—A method meets this if a minor exception condition does not propagate through the entire system.

Meyer’s (1988) Five Principles of Good Modular Design These principles describe the features of a language that encourage good modular design: 1.linguistic modular units—Modules must correspond well to the syntactic units in the language. 2.few interfaces—Every module should naturally communicate with as few others as possible. 3.small interfaces—If any two modules communicate, they should exchange as little information as possible. 4.explicit interfaces—When two modules communicate, it should be obvious from the text of at least one. 5.information hiding—All information about a module should be private by default.

Design by Contract Meyer designed Eiffel to implement ‘design by contract’. This means the a design should satisfy two rules: 1.There are only two ways a routine call may terminate: either it fulfills its contract or it fails to fulfill it. 2.If a routine fails to fulfill its contract, the current execution of the caller also fails to fulfill its own contract. You must publicly specify the contract for each interface. These include the preconditions that must hold whenever the routine is called and the postconditions that it guarantees when it returns. A routine should check that its preconditions are satisfied, and before completing it should check that its postconditions are met. In Java, a routine ‘throws an exception’ to indicate that it cannot fulfill its contract.

Weak and Strong Design by Contract Note there are weak and strong versions of ‘design by contract’. –The weak version is that a method that cannot fulfill its contract must leave the system operable. –The strong version is that a method that cannot fulfill its contract must return the system to the state it was in when the method was called. To determine whether a system supports weak or strong design by contract, you examine the code to see where exceptions may be thrown: –Operations creating and manipulating reference types may throw. –Operations with primitive types generally don’t throw.

Abstraction Abstraction is usually viewed as an information wall in an object- oriented language that prevents the programmer from viewing the private contents of data objects. It goes further. There are four principles of abstraction (from Pratt and Zelkowitz, 1996): Specialization—This is the most common form of inheritance, where the derived object has more precise properties than the base object. The inverse concept is generalization. Decomposition—This is the principle of separating an abstraction into its components. The inverse concept is aggregation. Instantiation—This is the process of creating instances of a class. Essentially a copy operation. The inverse concept is classification. Individualization—The grouping of similar objects for common purposes. Here, an object of a given class has a given purpose or role. The inverse concept is grouping.

Summary Concepts to remember: –Object-orientation –Object –Method –Modularity –Design by contract –Abstraction