The Object-Oriented Thought Process Chapter 07

Slides:



Advertisements
Similar presentations
By Waqas Over the many years the people have studied software-development approaches to figure out which approaches are quickest, cheapest, most.
Advertisements

Object-Oriented Programming Basics Prof. Ankur Teredesai, Computer Science Department, RIT.
Object-Oriented Programming Python. OO Paradigm - Review Three Characteristics of OO Languages –Inheritance It isn’t necessary to build every class from.
L3-1-S1 OO Concepts © M.E. Fayad SJSU -- CMPE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room.
Object-Oriented Databases v OO systems associated with – graphical user interface (GUI) – powerful modeling techniques – advanced data management capabilities.
1 SWE Introduction to Software Engineering Lecture 23 – Architectural Design (Chapter 13)
Object Oriented System Development with VB .NET
Fall 2007ACS-1805 Ron McFadyen1 Programming Concepts Chapter 4 introduces more advanced OO programming techniques. Construction of a programs usually requires:
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter N - 1 Chapter 13 Polymorphism is-a relationships Interfaces.
CSCI-383 Object-Oriented Programming & Design Lecture 15.
BACS 287 Basics of Object-Oriented Programming 1.
CHAPTER ONE Problem Solving and the Object- Oriented Paradigm.
CS 403 – Programming Languages Class 25 November 28, 2000.
Specialization and Inheritance Chapter 8. 8 Specialization Specialized classes inherit the properties and methods of the parent or base class. A dog is.
1 Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill Chapter 2: Object Basics Object-Oriented Systems Development Using the Unified Modeling.
Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Object Oriented.
CSCI-383 Object-Oriented Programming & Design Lecture 10.
Chapter 4 Basic Object-Oriented Concepts. Chapter 4 Objectives Class vs. Object Attributes of a class Object relationships Class Methods (Operations)
Next Back MAP MAP F-1 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All.
Ch 7: From Modules to Objects (Part Two) CSCI 4320.
COP 4331 – OOD&P Lecture 7 Object Concepts. What is an Object Programming language definition: An instance of a class Design perspective is different.
CSCI 383 Object-Oriented Programming & Design Lecture 15 Martin van Bommel.
Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their.
Inheritance Modern object-oriented (OO) programming languages provide 3 capabilities: encapsulation inheritance polymorphism which can improve the design,
Object-Oriented Programming
OOP - Object Oriented Programming
Object-Oriented Design
Sections Inheritance and Abstract Classes
JAVA By Waqas.
OBJECT ORIENTED CONCEPT
CHAPTER 5 GENERAL OOP CONCEPTS.
Object-Oriented Programming Basics
Class 22: Inheritance CS150: Computer Science University of Virginia
The Object-Oriented Thought Process Chapter 1
Chapter 11 Object-Oriented Design
The Object-Oriented Thought Process Chapter 09
Collaborations and Hierarchies
Week 4 Object-Oriented Programming (1): Inheritance
INTRODUCTION TO OOP Objective:
Road Map Inheritance Class hierarchy Overriding methods Constructors
The Object-Oriented Thought Process Chapter 08
Object Oriented Concepts
Object Orientation Yaodong Bi, Ph.D. Department of Computer Sciences
3 Fundamentals of Object-Oriented Programming
Chapter 10 Thinking in Objects
UML Class Diagrams: Basic Concepts
Chapter 10 Thinking in Objects
Engineering Quality Software
The Object-Oriented Thought Process Chapter 05
MSIS 670 Object-Oriented Software Engineering
Object-Oriented Design
Advanced Programming Behnam Hatami Fall 2017.
Inheritance: Introduction
Object-Oriented Programming: Inheritance and Polymorphism
Fundaments of Game Design
Extended Learning Module G
Workshop for Programming And Systems Management Teachers
OBJECT ORIENTED PROGRAMMING
Semantic Nets and Frames
The Object-Oriented Thought Process, Chapter 1
Object Oriented Analysis and Design
Object-Oriented Programming
OBJECT ORIENTED PROGRAMMING
Object Oriented Design & Analysis
Object-Oriented Design
Jim Fawcett CSE687 – Object Oriented Design Spring 2014
The Object Paradigm Classes – Templates for creating objects
Object Oriented Programming (OOP)- Assist. Prof. Dr
The OOTP is intended to get you thinking about how OO concepts are used in designing object-oriented systems. Note: not talking about OO technologies that.
Introduction to Object-Oriented Concepts
Presentation transcript:

The Object-Oriented Thought Process Chapter 07 Mastering Inheritance and Composition

Reusing Objects Perhaps the primary reason that inheritance and composition exist is object reuse. Inheritance represents the is-a relationship. For example, a dog is a mammal. Composition represents a has-a relationship. For example, a car has a(n) engine.

Inheritance Inheritance was defined as a system in which child classes inherit attributes and behaviors from a parent class. If you can say that Class B is a Class A, then this relationship is a good candidate for inheritance.

Generalization and Specialization Consider an object model of a Dog class hierarchy. Factored out some of the commonality between various breeds of dogs is called generalization-specialization. The idea is that as you make your way down the inheritance tree, things get more specific.

Design Decisions Factoring out as much commonality as possible is great. Sometimes it really is too much of a good thing. Although factoring out as much commonality as possible might represent real life as closely as possible, it might not represent your model as closely as possible.

Model Complexity Adding classes can make things so complex that it makes the model untenable. In larger systems, when these kinds of decisions are made over and over, the complexity quickly adds up.

Making Design Decisions with the Future in Mind If you are modeling a system for a veterinarian, you may not currently treat cats. Although you might not treat cats now, sometime in the future you might want to do so. If you do not design for the possibility of treating cats now, it will be much more expensive to change the system later to include them.

Composition It is natural to think of objects as containing other objects. A television set contains a tuner and video display. A computer contains video cards, keyboards, and drives. The computer can be considered an object unto itself, and a flash drive is also considered a valid object.

Model Complexity As with inheritance, using too much composition can also lead to more complexity. A fine line exists between creating an object model that contains enough granularity to be sufficiently expressive and a model that is so granular that it is difficult to understand and maintain.

Why Encapsulation Is Fundamental to OO Whenever the interface/implementation paradigm is covered, we are talking about encapsulation. The basic question is what in a class should be exposed and what should not be exposed. This encapsulation pertains equally to data and behavior.

How Inheritance Weakens Encapsulation Inheritance connotes strong encapsulation with other classes but weak encapsulation between a superclass and its subclasses. The problem is that if you inherit an implementation from a superclass and then change that implementation, the change from the superclass ripples through the class hierarchy. This rippling effect potentially affects all the subclasses.

Object Responsibility The premise of polymorphism is that you can send messages to various objects, and they will respond according to their object’s type. The important point regarding polymorphism is that an object being responsible for itself. The concrete classes themselves perform this function.

Abstract Classes, Virtual Methods, and Protocols Abstract classes, as they are defined in Java, can be directly implemented in .NET and C++ as well. Objective-C does not fully implement the functionality of abstract classes. Protocols are used.