Elements of OO Abstraction Encapsulation Modularity Hierarchy: Inheritance & Aggregation 4 major/essential elements3 minor/helpful elements Typing Concurrency.

Slides:



Advertisements
Similar presentations
Software Engineering Key design concepts Design heuristics Design practices.
Advertisements

Ch:8 Design Concepts S.W Design should have following quality attribute: Functionality Usability Reliability Performance Supportability (extensibility,
1 OBJECT-ORIENTED CONCEPTS. 2 What is an object?  An object is a software entity that mirrors the real world in some way.  A software object in OOP.
General OO Concepts and Principles CSE301 University of Sunderland Harry R. Erwin, PhD.
Lecture 9 Improving Software Design CSC301-Winter 2011 – University of Toronto – Department of Computer Science Hesam C. Esfahani
SOLID Object Oriented Design Craig Berntson
Classes and Object- Oriented... tMyn1 Classes and Object-Oriented Programming The essence of object-oriented programming is that you write programs in.
WEL COME PRAVEEN M JIGAJINNI PGT (Computer Science) MCA, MSc[IT], MTech[IT],MPhil (Comp.Sci), PGDCA, ADCA, Dc. Sc. & Engg.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Developed by Reneta Barneva, SUNY Fredonia Component Level Design.
Object-oriented design CS 345 September 20,2002. Unavoidable Complexity Many software systems are very complex: –Many developers –Ongoing lifespan –Large.
OBJECT ORIENTED PROGRAMMING IN C++ LECTURE
 Computer Science 1MD3 Introduction to Programming Michael Liut Ming Quan Fu Brandon.
OO Analysis and Design CMPS OOA/OOD Cursory explanation of OOP emphasizes ▫ Syntax  classes, inheritance, message passing, virtual, static Most.
Object Oriented Programming Development
CLASS DESIGN PRINCIPLES Lecture 2. The quality of the architecture What is a good design? It is the design that at least does not have signs of “bad”.
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
GENERAL CONCEPTS OF OOPS INTRODUCTION With rapidly changing world and highly competitive and versatile nature of industry, the operations are becoming.
Welcome to OBJECT ORIENTED PROGRAMMIN Date: 10/09/2014 Prepared By Prepared By : VINAY ALEXANDER PGT(CS) KV jhagrakhand.
An Introduction to Software Architecture
Ch:10 Component Level Design Unit 4. What is Component? A component is a modular building block for computer software Because components reside within.
Company Confidential – Do Not Duplicate 2 Copyright 2008 McLane Advanced Technologies, LLC S.O.L.I.D. Software Development Achieving Object Oriented Principles,
OODP Prudent OO Design. OODP-2 The Pillars of the Paradigm Abstraction Encapsulation Hierarchy –Association, Aggregation –Inheritance Polymorphism.
CS212: Object Oriented Analysis and Design GRASP Design Principles.
CSE 301 Exam Revision Lecture
Introduction to SOLID Principles. Background Dependency Inversion Principle Single Responsibility Principle Open/Closed Principle Liskov Substitution.
OOP Class Lawrence D’Antonio Lecture 3 An Overview of C++
S.O.L.I.D. Software Development 12 January 2010 (Martin Verboon, Patrick Kalkman, Stan Verdiesen)
SWE © Solomon Seifu ELABORATION. SWE © Solomon Seifu Lesson 12-5 Software Engineering Design Goals.
Kal Bugrara, Ph.DSoftware Engineering Northeastern University Fundamentals Of Software Engineering Lecture V.
Incremental Design Why incremental design? Goal of incremental design Tools for incremental design  UML diagrams  Design principles  Design patterns.
Software Design Patterns Curtsy: Fahad Hassan (TxLabs)
1 Software Engineering: A Practitioner’s Approach, 6/e Chapter 11a: Component-Level Design Software Engineering: A Practitioner’s Approach, 6/e Chapter.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Architecture View Models A model is a complete, simplified description of a system from a particular perspective or viewpoint. There is no single view.
Five design principles
1 Software Design Lecture What’s Design It’s a representation of something that is to be built. i.e. design  implementation.
OOP (Object Oriented Programming) Lecture 1. Why a new paradigm is needed? Complexity Five attributes of complex systems –Frequently, complexity takes.
CHAPTER 3 MODELING COMPONENT-LEVEL DESIGN.
Component Design Elaborating the Design Model. Component Design Translation of the architectural design into a detailed (class-based or module- based)
SOLID Design Principles
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
Lecture 2 Object-oriented programming. Definitions of OOP OOP is a programming paradigm, which utilizes encapsulation, inheritance and polymorphism. (From.
OOD OO Design. OOD-2 OO Development Requirements Use case analysis OO Analysis –Models from the domain and application OO Design –Mapping of model.
Basic Characteristics of Object-Oriented Systems
Welcome to OBJECT ORIENTED PROGRAMMING Prepared By Prepared By : VINAY ALEXANDER PGT(CS) KV jhagrakhand.
Beginning Software Craftsmanship Brendan Enrick Steve Smith
MAITRAYEE MUKERJI Object Oriented Programming in C++
CompSci 280 S Introduction to Software Development
CHAPTER 5 GENERAL OOP CONCEPTS.
Software Architecture & Difference from Design
CSE687 - Object Oriented Design class notes Survey of the C++ Programming Language Jim Fawcett Spring 2004.
CMPE 135: Object-Oriented Analysis and Design October 24 Class Meeting
Copyright © by Curt Hill
Software Engineering: A Practitioner’s Approach, 6/e Chapter 11 Component-Level Design copyright © 1996, 2001, 2005 R.S. Pressman & Associates, Inc.
The Object Oriented Approach to Design
Object Oriented Practices
CSC 205 – Java Programming II
CSC 205 Programming II Lecture 2 Subclassing.
The Object model The Evolution of the Object Model Elements of the Object Model Applying the Object Model.
Object-Oriented Design
Design Tips.
An Introduction to Software Architecture
Software Analysis.
A (partial) blueprint for dealing with change
Object Oriented Design & Analysis
Some principles for object oriented design
UML  UML stands for Unified Modeling Language. It is a standard which is mainly used for creating object- oriented, meaningful documentation models for.
Chapter 10 – Component-Level Design
Presentation transcript:

Elements of OO Abstraction Encapsulation Modularity Hierarchy: Inheritance & Aggregation 4 major/essential elements3 minor/helpful elements Typing Concurrency Persistence

collaboration contract Abstraction An abstraction denotes the essential characteristics of an object that distinguish it from all other kinds of objects and thus provides crisply defined conceptual boundaries, relative to the perspective of the user. Focuses on outside view of an object: Behavior/implementation separation Specifies responsibilities of objects of the same kind Abstraction characteristics responsibilities Defines a contract on which other objects may depend Abstraction characteristics responsibilities client server Every object collaborates with other objects to achieve some behavior

Abstraction perspective of the user essential characteristics kinds of objects crisply defined conceptual boundaries

Encapsulation Encapsulation is the process of compartmentalizing the elements of an abstraction that constitute its structure and behavior; encapsulation serves to separate the contractual interface of an abstraction and its implementation. Works hand-in-hand with abstraction: For abstraction to work, implementations must be encapsulated. Intelligent encapsulation localizes design decisions that are likely to change.

Encapsulation So its client doesn’t need to care about its inner works. A client will not notice it even if its Dog Taunter is replaced.

Modularity Modularity is the property of a system that has been decomposed into a set of cohesive and loosely coupled modules. The essential method that we use to manage complexity is “divide and conquer” The OOA process leads to a set of abstractions used in the domain. The OOD process leads to a set of program modules that can be compiled separately, but which have connections with other modules. Modules: - Conceptual breakdown of a system: subsystems, components, objects - Physical containers of program: packages, classes, etc Objects are too tiny and can hardly be used alone Objects within the same component are closely related Objects within the same component are loosely related

Modularity

Modularity – a real world example Highly cohesive components Loosely coupled components

Cohesion & Coupling

Hierarchy Hierarchy is a ranking or ordering of abstractions. The two most important hierarchies in a complex system are its class structure (the “is-a” hierarchy) and Its object structure (the “part-of” hierarchy) Class structure (generalization/specialization) Object structure (aggregation/composition)

Generalization/Specialization

Aggregation/Composition

Typing Typing is the enforcement of the class of an object, such that objects of different types may not be interchanged, or at the most, they may be interchanged only in very restricted ways. An object-oriented language can be strongly typed, weakly typed, or even untyped. An object-oriented language can support dynamic typing (or binding) or only static typing (or binding). Benefits of strong typing: -Prevents programs from “crashing” mysteriously -Early error detection is extremely valuable -Helps to document programs -Helps compilers generating more efficient object code Polymorphism, made possible by late binding, is the most powerful feature of OOP languages next to their support for abstraction; and is a central concept in OOD.

Typing

Concurrency Concurrency is the property that distinguishes an active object from one that is inactive. Physical concurrency – using multiple CPUs. Vs. Illusionary concurrency – using a single CPU with time-slicing. Heavyweight concurrency – using multiple processes. Vs. Lightweight concurrency – using multiple threads within a single O/S process. Whereas OOP focuses on data abstraction, encapsulation, and inheritance, concurrency focuses on process abstraction and synchronization. Each object (drawn from an abstraction of the real world) that represents a separate thread of control is called active.

Concurrency

Persistence Persistence is the property of an object through which its existence transcends time (i.e., the object continues to exist after its creator ceases to exist) and/or space (i.e., the object’s location moves from the address space in which it is created).

Persistence

Principles of OOD The Single-Responsibility Principle (SRP) The Open-Closed Principle (OCP) The Liskov Substitution Principle (LSP) The Dependency-Inversion Principle (DIP) The Interface-Segregation Principle (ISP)

Design Smells Poor design smells, like a plastic sack of 12-day old kitchen garbage Rigidity = Hard-to-change: changing one place cause never-ending succession of changes. Fragility = A change to one part of the system causes it to break in many other, completely unrelated, parts. Immobility = Hard to disentangle the system into units (or components) that can be reused in other systems Viscosity = The development environment is held together with duct tape and library paste. It takes forever to go around the edit-compile-test loop.

Design Smells (cont’d) Needless Complexity = There are a lot of very clever code structures that are not actually necessary right now, but could be very useful one day. Needless Repetition = The code looks like it was written by two programmers named Cut and Paste. Opacity = Elucidation of the originator’s intent presents certain difficulties related to convolution of expression. Mismanaged dependencies Spaghetti code

The Single Responsibility Principle SRP = A class should have only one reason to change. Violation of SRP Not cohesive Use cohesive classes, each focuses on a single topic

The Open-Closed Principle OCP = Software entities (classes, modules, functions, etc) should be open for extension, but closed for modification.

The Liskov Substitution Principle LSP = subtypes must be substitutable for their base types.

The Dependency Inversion Principle DIP = High-level modules should not depend upon low-level modules. Both should depend upon abstractions. Abstractions should not depend upon details. Details should depend upon abstractions.

The Interface Segregation Principle ISP = client should not depend upon methods that they do not use.