Ivan Marsic Rutgers University LECTURE 2: The Object Model.

Slides:



Advertisements
Similar presentations
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.
Advertisements

Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 1 Software Engineering September 12, 2001 Capturing.
Chapter 22 Object-Oriented Systems Analysis and Design and UML Systems Analysis and Design Kendall and Kendall Fifth Edition.
Module 2: Object-Oriented Programming
Sucha Smanchat  Steps in OOAD using UML  Use Case Diagram  Sequence Diagram / Communication Diagram  Class Diagram  State.
Object-Oriented Analysis and Design
Chapter 1 Object-Oriented System Development
Introduction To System Analysis and Design
Evan Korth New York University Computer Science I Classes and Objects Professor: Evan Korth New York University.
Lecture a: Additional UML Models: Package, Activity, Deployment Lecture b: Generalization, Aggregation and Additional Domain Model Notation Copyright W.
1 Introduction to C++ Programming Concept Basic C++ C++ Extension from C.
© Copyright 2012 by Pearson Education, Inc. All Rights Reserved. 1 Chapter 7 Object-Oriented Programming.
Object Oriented Concepts. Movement toward Objects Instead of data-oriented or process-oriented Analysis, many firms are now moving to object-oriented.
C++ fundamentals.
1 Chapter 8 Objects and Classes. 2 Motivations After learning the preceding chapters, you are capable of solving many programming problems using selections,
UML Sequence Diagrams Michael L. Collard, Ph.D. Department of Computer Science Kent State University.
Object Oriented Software Development
Introduction to Object-oriented Programming CSIS 3701: Advanced Object Oriented Programming.
Introduction to Object Oriented Design. Topics Designing Your Own Classes Attributes and Behaviors Class Diagrams.
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-Oriented Software Testing. C-S 5462 Object-Oriented Software Testing Research confirms that testing methods proposed for procedural approach are.
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
MT311 Java Application Development and Programming Languages Li Tak Sing( 李德成 )
OBJECT ORIENTED PROGRAMMING CONCEPTS ISC 560. Object-oriented Concepts  Objects – things names with nouns  Classes – classifications (groups) of similar.
Sadegh Aliakbary Sharif University of Technology Fall 2011.
CSCI-383 Object-Oriented Programming & Design Lecture 9.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 20 Object-Oriented.
Unified Modeling Language, Version 2.0
1. 2 Object-Oriented Concept Class & Object Object-Oriented Characteristics How does it work? Relationships Between Classes Development Tools Advantage.
Introduction To System Analysis and Design
Object-Oriented Analysis and Design An Introduction.
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Computer Science II 810:062 Section 01. How is CS I different from CS II? When you teach Java there are a series of decisions that have to be made…
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
CSE 303 – Software Design and Architecture LECTURE 4.
Object-Oriented Design Simple Program Design Third Edition A Step-by-Step Approach 11.
UHD::3320::CH121 DESIGN PHASE Chapter 12. UHD::3320::CH122 Design Phase Two Aspects –Actions which operate on data –Data on which actions operate Two.
Fall 2010 CS4310 Requirements Engineering A Brief Review of UML & OO Dr. Guoqiang Hu Department of Computer Science UTEP 1.
Object-Oriented Paradigm and UML1 Introduction to the Object- Oriented Paradigm.
The Unified Modeling Language Part II Omar Meqdadi SE 2730 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
BCS 2143 Object Oriented Design Using UML. Objectives Objects Interactions Finding Classes Relationship Between Classes Attribute and Operation Class.
Designing Classes Chapter 3. 2 Chapter Contents Encapsulation Specifying Methods Java Interfaces Writing an Interface Implementing an Interface An Interface.
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
CSC 131 Fall 2006 Lecture # 6 Object-Oriented Concepts.
Abstraction ADTs, Information Hiding and Encapsulation.
Lecture 2 Intro. To Software Engineering and Object-Oriented Programming (1/2)
: Maha Sabri Altememe Lecturer : Maha Sabri Altememe Lecture :1 1.
Salman Marvasti Sharif University of Technology Winter 2015.
Testing OO software. State Based Testing State machine: implementation-independent specification (model) of the dynamic behaviour of the system State:
Application development with Java Lecture 21. Inheritance Subclasses Overriding Object class.
1 Unified Modeling Language, Version 2.0 Chapter 2.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
OO in Context Lecture 13: Dolores Zage. Confused about OO Not alone, there is much confusion about OO many programs are claimed to be OO but are not really.
1 Foundations of Software Design Fall 2002 Marti Hearst Lecture 7: Object-Oriented Design.
ITEC0724 Modern Related Technology on Mobile Devices Lecture Notes #2 1.
Chapter 7 Classes and Methods III: Static Methods and Variables Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition)
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Chapter 11 An introduction to object-oriented design.
Lecture 2 Intro. To Software Engineering and Object-Oriented Programming (1/2)
Sadegh Aliakbary Sharif University of Technology Fall 2010.
CSCE 240 – Intro to Software Engineering Lecture 3.
CPS120: Introduction to Computer Science Lecture 16A Object-Oriented Concepts.
IS 350 Course Introduction. Slide 2 Objectives Identify the steps performed in the software development life cycle Describe selected tools used to design.
Object-Oriented Analysis and Design
The Object-Oriented Thought Process Chapter 1
Object Oriented Analysis and Design
LECTURE 2: The Object Model
Introduction to Object-Oriented Concepts
Presentation transcript:

Ivan Marsic Rutgers University LECTURE 2: The Object Model

Topics Objects and Method Calls Interfaces UML Notation Object Relationships Process/Algorithm –Oriented vs. Object Oriented Approaches

Objects, Calling & Answering Calls Prime factorization of 905: 5  181 (2 distinct factors) Prime factorization of 1988: 2  2  7  71 (4 factors, 3 distinct) Two integers are said to be coprime or relatively prime if they have no common factor other than 1 or, equivalently, if their greatest common divisor is 1.

Objects Don’t Accept Arbitrary Calls Acceptable calls are defined by object “methods” (a.k.a. Operations, Procedures, Subroutines, Functions) method-1: Accept card method-2: Read code method-3: Take selection Object: ATM machine

Object Interface Interface defines method “signatures” Method signature: name, parameters, parameter types, return type method-1 method-2 method-3 Interface Object hides its state (attributes). The attributes are accessible only through the interface.

Clients, Servers, Messages Objects send messages by calling methods Client object: sends message and asks for service Server object: provides service” and returns result

Interfaces An interface is a set of functional properties (services) that a software object provides or requires. Methods define the “services” the server object implementing the interface will offer The methods (services) should be created and named based on the needs of client objects that will use the services “On-demand” design—we “pull” interfaces and their implementations into existence from the needs of the client, rather than “pushing” out the features that we think a class should provide

Objects are Modules Software Module

Modules versus Objects Objects encapsulate data Methods (behavior) Attributes /data (state) Software Object 1 Subprograms (behavior) Data (state) Modules are loose groupings of subprograms and data Software Module 2Software Module 3Software Module 1 Software Object 2Software Object 3 “Promiscuous” access to data often results in misuse

UML Notation for Classes «interface» BaseInterface + operation() ClassName # attribute_1 : int # attribute_2 : boolean # attribute_3 : String + operation_1() : void + operation_2() : String + operation_3(arg1 : int) Software Class Three compartments: 1.Classifier name 2.Attributes 3.Operations Class1Implement + operation() Class2Implement + operation() Software Interface Implementation Inheritance relationship: BaseInterface is implemented by two classes

Object Relationships (1) Composition: using instance variables that are references to other objects Inheritance: inheriting common properties through class extension B acts as “front-end” for A and uses services of A (i.e., B may implement the same interface as A) Derived Class B + operation() Base Class A + operation() Composition Inheritance Derived Class B + operation() Base Class A + operation()

Object Relationships (2) Both inheritance and composition extend the base functionality provided by another object INHERITANCE: Change in the “base” class propagates to the derived class and its client classes –BUT, any code change has a risk of unintentional introducing of bugs. COMPOSITION: More adaptive to change, because change in the “base” class is easily “contained” and hidden from the clients of the front-end class

Object-Oriented versus Process-Oriented Approaches (a) Process orientedObject oriented

Object vs. Process-Oriented (1) Process-oriented is more intuitive because it is person-centric –thinking what to do next, which way to go Object-oriented may be more confusing because of labor-division –Thinking how to break-up the problem into tasks, assign responsibilities, and coordinate the work –It’s a management problem…

Object vs. Process-Oriented (2) Process-oriented does not scale to complex, large-size problems –Individual-centric, but… Large scale problems require organization of people instead of individuals working alone Object-oriented is organization-centric –But, hard to design well organizations…

How To Design Well OO Systems? That’s the key topic of this course! Decisive Methodological Factors: –Traceability –Testing –Measurement –Security (Section 2.1.2)

Traceability (1) It should be possible to trace the evolution of the system, step-by-step, from individual requirements, through design objects, to code blocks.

Traceability (2) Avoid inexplicable leaps! …where did this come from?! “Deus ex machina”

Testing (1) Test-Driven Development (TDD) Every step in the development process must start with a plan of how to verify that the result meets a goal The developer should not create a software artifact ( a system requirement, a UML diagram, or source code ) unless they know how it will be tested But, testing is not enough…

Testing (2) A Rube Goldberg machine follows Test-Driven Development (TDD) —the test case is always described Automatic alarm clockOversleeping cure …it’s fragile— works correctly for one scenario

Measuring (1) We need tools to monitor the product quality And tools to monitor the developers productivity But, measuring is not enough…

Measuring (2) Maurits Escher designs, work under all scenarios (incorrectly) —robust but impossible RelativityWaterfall

Security Conflicting needs of computer security… Microsoft Security Development Lifecycle (SDL)