Object-Oriented and Classical Software Engineering Sixth Edition, WCB/McGraw-Hill, 2005 Stephen R. Schach srs@vuse.vanderbilt.edu.

Slides:



Advertisements
Similar presentations
Slide 7A.1 © The McGraw-Hill Companies, 2005 Object-Oriented and Classical Software Engineering Sixth Edition, WCB/McGraw-Hill, 2005 Stephen R. Schach.
Advertisements

UHD::CS3320::CHAP61 INTRODUCTION TO OBJECTS Chapter 6.
1 From Modules to Objects Xiaojun Qi. 2 What Is a Module? A lexically contiguous sequence of program statements, bounded by boundary elements, with an.
Slide 7.1 © The McGraw-Hill Companies, 2002 Object-Oriented and Classical Software Engineering Fifth Edition, WCB/McGraw-Hill, 2002 Stephen R. Schach
1 COMP 144 Programming Language Concepts Felix Hernandez-Campos Lecture 24: Dynamic Binding COMP 144 Programming Language Concepts Spring 2002 Felix Hernandez-Campos.
Lecture 13: Object- Oriented Concepts Anita S. Malik Adapted from Schach (2004) Chapter 7.
Object-oriented design CS 345 September 20,2002. Unavoidable Complexity Many software systems are very complex: –Many developers –Ongoing lifespan –Large.
Advanced Inheritance Concepts. In this chapter, we will cover: Creating and using abstract classes Using dynamic method binding Creating arrays of subclass.
UFCEUS-20-2 : Web Programming Lecture 5 : Object Oriented PHP (1)
Introduction to Object-oriented programming and software development Lecture 1.
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott COMP6325 Advanced Web Technologies Dr. Paul Walcott The University.
MT311 Java Application Development and Programming Languages Li Tak Sing( 李德成 )
An Object-Oriented Approach to Programming Logic and Design
Slide 7.1 Copyright © 2011 by The McGraw-Hill Companies, Inc. All rights reserved. Object-Oriented and Classical Software Engineering Eighth Edition, WCB/McGraw-Hill,
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Guided Notes Ch. 9 ADT and Modules Ch. 10 Object-Oriented Programming PHP support for OOP and Assignment 4 Term project proposal C++ and Java Designer.
Slide 7.1 © The McGraw-Hill Companies, 2007 Object-Oriented and Classical Software Engineering Seventh Edition, WCB/McGraw-Hill, 2007 Stephen R. Schach.
Slide 20.1 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. An Introduction to Object-Oriented Systems Analysis and Design with.
Chapter 12 Support for Object oriented Programming.
1 Programming Paradigms Object Orientated Programming Paradigm (OOP)
Slide 13.1 © The McGraw-Hill Companies, 2002 Object-Oriented and Classical Software Engineering Fifth Edition, WCB/McGraw-Hill, 2002 Stephen R. Schach.
Dr D. Greer, Queens University Belfast )Chapter Six 1 Software Engineering Chapter Six Software Design Quality Learning Outcomes.
OOPs Object oriented programming. Abstract data types  Representationof type and operations in a single unit  Available for other units to create variables.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Software Engineering Zhang Shuang
1 Foundations of Software Design Fall 2002 Marti Hearst Lecture 7: Object-Oriented Design.
Java Programming, Second Edition Chapter Twelve Advanced Inheritance Concepts.
Ch 7: From Modules to Objects (Part Two) CSCI 4320.
Design CS 470 – Software Engineering I Sheldon X. Liang, PH.D.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
CSCE 240 – Intro to Software Engineering Lecture 3.
Chapter 12: Support for Object- Oriented Programming Lecture # 18.
Java Programming: Guided Learning with Early Objects Chapter 9 Inheritance and Polymorphism.
Slide 7.1 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Object-Oriented Software Engineering WCB/McGraw-Hill, 2008 Stephen R.
Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their.
Object Oriented Systems Design
Object-Oriented Programming
CompSci 280 S Introduction to Software Development
Object-Oriented Programming Concepts
Sachin Malhotra Saurabh Choudhary
Concepts of Object Oriented Programming
Object-Oriented Software Engineering WCB/McGraw-Hill, 2008 Stephen R
CHAPTER 5 GENERAL OOP CONCEPTS.
Sections Basic Concepts of Programming
Chapter 11 Object-Oriented Design
Data Abstraction: The Walls
OOP What is problem? Solution? OOP
Object Oriented Programming in Java
Object-Oriented and Classical Software Engineering Eighth Edition, WCB/McGraw-Hill, 2011 Stephen R. Schach 1.
Week 4 Object-Oriented Programming (1): Inheritance
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
Types of Programming Languages
SNSCT_CSE_PROGRAMMING PARADIGM_CS206
Object Oriented Programming
Object Oriented Analysis and Design
Object-Oriented and Classical Software Engineering Sixth Edition, WCB/McGraw-Hill, 2005 Stephen R. Schach
Chapter 10 Thinking in Objects
FROM MODULES TO OBJECTS.
Object Oriented Programming: Inheritance
Chapter 20 Object-Oriented Analysis and Design
Advanced Java Programming
Object-Oriented and Classical Software Engineering Fifth Edition, WCB/McGraw-Hill, 2002 Stephen R. Schach
Object-Oriented and Classical Software Engineering Eighth Edition, WCB/McGraw-Hill, 2011 Stephen R. Schach.
Fundaments of Game Design
Advanced Inheritance Concepts
Inheritance and Polymorphism
Programming Languages and Paradigms
Chapter 2. Problem Solving and Software Engineering
Object-Oriented PHP (1)
Object-Oriented and Classical Software Engineering Sixth Edition, WCB/McGraw-Hill, 2005 Stephen R. Schach
Presentation transcript:

Object-Oriented and Classical Software Engineering Sixth Edition, WCB/McGraw-Hill, 2005 Stephen R. Schach srs@vuse.vanderbilt.edu

CHAPTER 7 — Unit C FROM MODULES TO OBJECTS

Continued from Unit 7B

7.5 Abstract Data Types The problem with both implementations We need: There is only one queue, not three We need: Data type + operations performed on instantiations of that data type Abstract data type

Abstract Data Type Example Figure 7.24 (Problems caused by public attributes solved later)

Another Abstract Data Type Example Figure 7.25 (Problems caused by public attributes solved later)

7.6 Information Hiding Data abstraction Procedural abstraction The designer thinks at the level of an ADT Procedural abstraction Define a procedure — extend the language Both are instances of a more general design concept, information hiding Design the modules in a way that items likely to change are hidden Future change is localized Changes cannot affect other modules

Information Hiding (contd) C++ abstract data type implementation with information hiding Figure 7.26

Information Hiding (contd) Figure 7.27 Effect of information hiding via private attributes

Major Concepts of Chapter 7 Figure 7.28

7.7 Objects First refinement Second refinement The product is designed in terms of abstract data types Variables (“objects”) are instantiations of abstract data types Second refinement Class: an abstract data type that supports inheritance Objects are instantiations of classes

Inheritance Define HumanBeing to be a class A HumanBeing has attributes, such as age, height, gender Assign values to the attributes when describing an object

Inheritance (contd) Define Parent to be a subclass of HumanBeing A Parent has all the attributes of a HumanBeing, plus attributes of his/her own nameOfOldestChild, numberOfChildren A Parent inherits all attributes of a HumanBeing

Inheritance (contd) The property of inheritance is an essential feature of all object-oriented languages Such as Smalltalk, C++, Ada 95, Java But not of classical languages Such as C, COBOL or FORTRAN

Inheritance (contd) UML notation Figure 7.29 UML notation Inheritance is represented by a large open triangle

Java Implementation Figure 7.30

Aggregation Figure 7.31 UML notation for aggregation — open diamond

Association UML notation for association — line Figure 7.32 UML notation for association — line Optional navigation triangle

Equivalence of Data and Action Classical paradigm record_1.field_2 Object-oriented paradigm thisObject.attributeB thisObject.methodC ()

7.8 Inheritance, Polymorphism and Dynamic Binding Figure 7.33a Classical paradigm We must explicitly invoke the appropriate version

Inheritance, Polymorphism and Dynamic Binding (contd) Figure 7.33(b) Object-oriented paradigm

Inheritance, Polymorphism and Dynamic Binding (contd) Classical code to open a file The correct method is explicitly selected Figure 7.34(a)

Inheritance, Polymorphism and Dynamic Binding (contd) Object-oriented code to open a file The correct method is invoked at run-time (dynamically) Method open can be applied to objects of different classes “Polymorphic” Figure 7.34(b)

Inheritance, Polymorphism and Dynamic Binding (contd) Figure 7.35 Method checkOrder (b : Base) can be applied to objects of any subclass of Base

Inheritance, Polymorphism and Dynamic Binding (contd) Can have a negative impact on maintenance The code is hard to understand if there are multiple possibilities for a specific method A strength and a weakness of the object-oriented paradigm

7.9 The Object-Oriented Paradigm Reasons for the success of the object-oriented paradigm The object-oriented paradigm gives overall equal attention to data and operations At any one time, data or operations may be favored A well-designed object (high cohesion, low coupling) models all the aspects of one physical entity Implementation details are hidden

The Object-Oriented Paradigm (contd) The reason why the structured paradigm worked well at first The alternative was no paradigm at all

The Object-Oriented Paradigm (contd) How do we know that the object-oriented paradigm is the best current alternative? We don’t However, most reports are favorable Experimental data (e.g., IBM [1994]) Survey of programmers [2000]

The Object-Oriented Paradigm (contd) How do we know that the object-oriented paradigm is the best current alternative? We don’t However, most reports are favorable Experimental data (e.g., IBM [1994]) Survey of programmers [2000]

Weaknesses of the Object-Oriented Paradigm Development effort and size can be large One’s first object-oriented project can be larger than expected Even taking the learning curve into account Especially if there is a GUI However, some classes can frequently be reused in the next project

Weaknesses of the Object-Oriented Paradigm (contd) Inheritance can cause problems The fragile base class problem To reduce the ripple effect, all classes need to be carefully designed up front Unless explicitly prevented, a subclass inherits all its parent’s attributes Objects lower in the tree can become large “Use inheritance where appropriate” Exclude unneeded inherited attributes

Weaknesses of the Object-Oriented Paradigm (contd) As already explained, the use of polymorphism and dynamic binding can lead to problems It is easy to write bad code in any language It is especially easy to write bad object-oriented code

The Object-Oriented Paradigm (contd) Someday, the object-oriented paradigm will undoubtedly be replaced by something better Aspect-oriented programming is one possibility But there are many other possibilities