Chapter 2 Object Orientation. Process Phase Affected by This Chapter Requirements Analysis Design Implementation ArchitectureFrameworkDetailed Design.

Slides:



Advertisements
Similar presentations
Introduction to Object Orientation System Analysis and Design
Advertisements

©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
SWE 316: Software Design and Architecture Objectives Lecture 3 Object Orientation SWE 316: Software Design and Architecture NOTE: most slides are adapted.
Ch 12: Object-Oriented Analysis
Requirements and Design
Object-Oriented Analysis and Design
Introduction To System Analysis and Design
7M701 1 Software Engineering Object-oriented Design Sommerville, Ian (2001) Software Engineering, 6 th edition: Chapter 12 )
UML – Class Diagrams.
1 SWE Introduction to Software Engineering Lecture 23 – Architectural Design (Chapter 13)
Object Oriented System Development with VB .NET
Irwin/McGraw-Hill Copyright © 2004 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS6th Edition.
Slide 1 Systems Analysis & Design CS183 Spring Semester 2008 Dr. Jonathan Y. Clark Course Website:
Basic OOP Concepts and Terms
Aalborg Media Lab 23-Jun-15 Inheritance Lecture 10 Chapter 8.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
Software Lifecycle A series of steps through which a software product progresses Lifetimes vary from days to months to years Consists of –people –overall.
ACM/JETT Workshop - August 4-5, 2005 UML Modeling using MagicDraw UML for Java Programmers.
Introduction To System Analysis and design
Introduction to Object Oriented Design. Topics Designing Your Own Classes Attributes and Behaviors Class Diagrams.
Programming Languages and Paradigms Object-Oriented Programming.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Chapter 4 Design Principles I Correctness and Robustness
Systems Analysis and Design in a Changing World, Tuesday, Feb 27
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 2: Modelling.
Object Orientation An Object oriented approach views systems and programs as a collection of interacting objects. An object is a thing in a computer system.
Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed.
Prologue: The Software Process. Main Phases of Software Process 1. Requirements Analysis (answers “WHAT?”) Specifying what the application must do 2.
Chapter 5 Design Principles II: Flexibility, Reusability, and Efficiency.
CONCEPTS OF OBJECT ORIENTED PROGRAMMING. Topics To Be Discussed………………………. Objects Classes Data Abstraction and Encapsulation Inheritance Polymorphism.
Chapter 5 Design Principles II: Flexibility, Reusability, and Efficiency.
1.  A method describes the internal mechanisms that actually perform its tasks  A class is used to house (among other things) a method ◦ A class that.
Recap (önemli noktaları yinelemek) from last week Paradigm Kay’s Description Intro to Objects Messages / Interconnections Information Hiding Classes Inheritance.
Unified Modeling Language, Version 2.0
Introduction To System Analysis and Design
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
Chapter 16 Applying UML and Patterns Craig Larman
SWE 316: Software Design and Architecture Objectives Lecture # 18 Introduction to Components SWE 316: Software Design and Architecture To learn:  benefits.
NJIT UML Class Diagrams Chapter 16 Applying UML and Patterns Craig Larman.
Basic OOP Concepts and Terms. In this class, we will cover: Objects and examples of different object types Classes and how they relate to objects Object.
Introduction To OOP 1.0 Fundamentals Of Java Programming Language 2.0 Exception Handling 3.0 Classes, Inheritance And Polymorphism © 2011 | PN AZRINA.
1 Programming Paradigms Object Orientated Programming Paradigm (OOP)
Slide 1 Systems Analysis and Design With UML 2.0 An Object-Oriented Approach, Second Edition Chapter 2: Introduction to Object-Oriented Systems Analysis.
SWE 316: Software Design and Architecture – Dr. Khalid Aljasser Objectives Lecture 13 Creational Design Pattern SWE 316: Software Design and Architecture.
Chapter 4 Introduction to Classes, Objects, Methods and strings
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
Slide 1 Systems Analysis and Design With UML 2.0 An Object-Oriented Approach, Second Edition Chapter 2: Introduction to Object-Oriented Systems Analysis.
9 - Class & Method Design Model Enhancement Design to Code Proposal Presentation.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 6 Objects and Classes.
Chapter 5 Classes and Methods II Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
Slide 1 Systems Analysis and Design With UML 2.0 An Object-Oriented Approach, Second Edition Chapter 2: Introduction to Object-Oriented Systems Analysis.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Chapter 7 Creational Design Pattern. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFrameworkDetailed.
Presented by Ted Higgins, SQL Server DBA An Introduction to Object – Oriented Programming.
Chapter 7 Classes and Methods III: Static Methods and Variables Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition)
Object Oriented Programming and Data Abstraction Earl Huff Rowan University.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Inheritance Modern object-oriented (OO) programming languages provide 3 capabilities: encapsulation inheritance polymorphism which can improve the design,
DATA REQIREMENT ANALYSIS
Roberta Roth, Alan Dennis, and Barbara Haley Wixom
The Movement To Objects
Object-Oriented Analysis and Design
The Object-Oriented Thought Process Chapter 1
About the Presentations
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
Object Orientation Yaodong Bi, Ph.D. Department of Computer Sciences
OBJECT ORIENTED PROGRAMMING II LECTURE 8 GEORGE KOUTSOGIANNAKIS
Week 6 Object-Oriented Programming (2): Polymorphism
Basic OOP Concepts and Terms
Presentation transcript:

Chapter 2 Object Orientation

Process Phase Affected by This Chapter Requirements Analysis Design Implementation ArchitectureFrameworkDetailed Design Key:= less so Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Before Object Orientation Real world concepts Software Design Entities Skljkvjkvjfkavjafkk saovjsdvjfvkfjvkfjk Skljkvjkvjfkavjafkk saovjsdvjfvkfjvkfjk Skljkvjkvjfkavjafkk saovjsdvjfvkfjvkfjk Skljkvjkvjfkavjafkk saovjsdvjfvkfjvkfjk Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

How Do We Express Ourselves? "Customers Montague and Susan entered the Ajax bank and were served by teller Andy..... " AJAX BANK Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

How We Express Ourselves " Customer s Montague and Susan entered the Ajax bank and were served by teller Andy..... " CLASSES OBJECTS Note that Java code convention reverses this capitalization. Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Object Orientation Real world concepts Software design entities Skljkvjkvjfkavjafkk saovjsdvjfvkfjvkfjk Skljkvjkvjfkavjafkk saovjsdvjfvkfjvkfjk Skljkvjkvjfkavjafkk saovjsdvjfvkfjvkfjk Skljkvjkvjfkavjafkk saovjsdvjfvkfjvkfjk Account getDetails() Transaction execute() Customer getFirstName() Direct correspondence Graphics reproduced with permission from Corel. Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Key Concept:  Benefits of OO  Object orientation provides a direct mapping between concepts and code. Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Class Introduction AjaxCustomer Real worldClass in Design (UML notation) Class in Source code (Java) class AjaxCustomer {.... } PermissionToPay class PermissionToPay {.... } Mental concept Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

aliceBrownBMW:Auto … The Members of a Class Auto public int vehicleID … protected int mileage … private myPrivateVariable … static int numAutosMade … Class model Toyota numAutosMade mileage jaynesCar:Auto … mileage Objects of Auto Subclasses have these members too myToyota:Toyota … mileage 2105 … Static variable: One version only Non-static variable: One version for every object Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Attribute Types (Shlaer & Mellor) o Naming: o fixed for each object o distinguishes individuals o Descriptive: o varies through life of object o Referential: o ties instance of one class to instance(s) of another o == aggregation Auto vehicleID mileage owner Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Key Concept:  Classes and Objects  A class expresses a concept such as “HondaCivic.” An object is an instance of a class such as “the Honda Civic with vehicle ID 89R783HJD894.”

The Clients of a Class class Customer {... String getName() { … } int computeBalance() { … }... } class AjaxWebsiteGenerator {... void makeProfile( Customer c ) { … String name = c.getName() … }... } class AjaxAssets {... int computeAssets() {... Customer c = customers[ i ]; assets += c.computeBalance();... }... } Client of Customer Class Customer Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Aspects of OO Useful for Application Development  Class Introduction (section 2.2.1) o basic motive of Object Orientation o identifying parts that corresponds to the real world  Instantiation (section 2.2.2) o creating instances of encapsulated concepts  Inheritance (section 2.3.1) o capturing the way concepts occur in hierarchy  Polymorphism (section 2.3.2) o capturing use of single action word to represent different things, depending on context Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Requirements For Creation Example 1. Summary: Produces text for various types of customers. 2. Detailed requirements 2.1 The application displays choices to the console, as shown in figure xx. 2.2 For customers delinquent more than 90 days, the message generated is the statement shown in figure xx. Page 1 of 4 Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Typical Interaction for Creation Example Page 2 of 4 Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

2.3 All non-delinquent customers receive a tailored messages as follows Mountain customers: This month we have a special on West Face tents. Only $ lots more output specialized to mountaineering customers Regular customers: All items are marked down 20% for this month only.... lots more output for regular customers... Requirements For Creation Example Page 3 of 4 Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Requirements For Creation Example 2.4 The is to be displayed on the console. 3. Future enhancements We anticipate that the text is likely to change frequently, and that new kinds of customers are likely to be specified, each with its own new set of requirements. Page 4 of 4 Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Disadvantages of Branching o Code for each case not cohesive (“cohesive”: forms a comprehensible unity) o All types of customers coded together in single class Expensive to … o … add new functionality o bloat switch or if - then code o … remove functionality o hunt for all parts that must be removed o … change functionality o hunt for all parts that must be changed Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Aspects of the Customer Design Needing Improvement o We need to visualize the design o Code not an effective way to understand design o The design’s maintainability still has flaws o As the application grows, specialized class(es) will be required to interact with the user Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Key Concept:  Polymorphism  - the use of several versions of a method, one in each derived class. This enables objectOfBaseClass.theMethod() to be interpreted variously at runtime, depending on what derived class objectOfBaseClass belongs to. Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

What’s Needed to Specify Functionality o Name of the function Example: add o Argument types(if any) Example: o First parameter: integer o Second parameter: float o Return type Example: double, reference type, void o Exceptions (if any) Example: IOException o More(?) o Are parameters inputs and/or outputs? o Describe what the function does (natural language) Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

The Need For Interfaces: Simplify … class Draw { … int setColor( String ) { … } Pen getStandardPen() { … } int getLogoStyle() { … } void setColor( int ) { … } void drawLogo( int, int ) { … } void speedUpPen( int ) { … } … }

Interface Example: a Draw Class o Functions dealing with the pen used o Pen getStandardPen() o void speedUpPen( int ) o... o Functions dealing with the colors available o void setColor( int ) o int setColor( String ) o... o Functions covering the drawing of the company’s logo o void drawLogo( int, int ) o int getLogoStyle() o... o } } } Pen interface Color interface Logo interface Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Key Concept:  Interfaces  An interface is a set of function prototypes (each with name, parameter types, return type, exception type). Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Issues to be Addressed o How do we visualize a set of classes? o How can classes relate to each other? o How should classes relate to each other? o How can we describe functionality occurring among several classes? o How do we describe the manner in which objects respond to events occurring on them? o Are there patterns of class usage that recur? o So we can existing design parts Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Summary of This Chapter o A Class represents a concept o Example: House o An Object is an instance of a class o Example: 23 Main Street, Springfield o Classes can relate in several ways: Mainly … o A Client of a class refers to that class in one of its methods o Inheritance: “kind of” relationship o Aggregation: “has a” relationship, explained in chapter xx o Polymorphism means “action depends on context” o Executing anObject.aMethod() actually executes the version of aMethod() in the subclass that anObject belongs to Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Typical Interaction for Auto Description Exercise Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.