LECTURE 2: The Object Model

Slides:



Advertisements
Similar presentations
Object Oriented Programming
Advertisements

Chapter 22 Object-Oriented Systems Analysis and Design and UML Systems Analysis and Design Kendall and Kendall Fifth Edition.
Introduction To System Analysis and Design
CS 501: Software Engineering Fall 2000 Lecture 16 System Architecture III Distributed Objects.
Evan Korth New York University Computer Science I Classes and Objects Professor: Evan Korth New York University.
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.
WEL COME PRAVEEN M JIGAJINNI PGT (Computer Science) MCA, MSc[IT], MTech[IT],MPhil (Comp.Sci), PGDCA, ADCA, Dc. Sc. & Engg.
C++ fundamentals.
Object Oriented Software Development
Sadegh Aliakbary Sharif University of Technology Fall 2011.
CSCI-383 Object-Oriented Programming & Design Lecture 9.
Introduction To System Analysis and Design
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Ivan Marsic Rutgers University LECTURE 2: The Object Model.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
Fall 2010 CS4310 Requirements Engineering A Brief Review of UML & OO Dr. Guoqiang Hu Department of Computer Science UTEP 1.
Design.ppt1 Top-down designs: 1. Define the Problem IPO 2. Identify tasks, Modularize 3. Use structure chart 4. Pseudocode for Mainline 5. Construct pseudocode.
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.
Designing Classes Chapter 3. 2 Chapter Contents Encapsulation Specifying Methods Java Interfaces Writing an Interface Implementing an Interface An Interface.
Abstraction ADTs, Information Hiding and Encapsulation.
: Maha Sabri Altememe Lecturer : Maha Sabri Altememe Lecture :1 1.
Salman Marvasti Sharif University of Technology Winter 2015.
Application development with Java Lecture 21. Inheritance Subclasses Overriding Object class.
1 Unified Modeling Language, Version 2.0 Chapter 2.
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.
Mid-Year Review. Coding Problems In general, solve the coding problems by doing it piece by piece. Makes it easier to think about Break parts of code.
Testing in OO Environment The reasons for testing is not any different for any of the design and implementation methodologies, including OO methodology.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
CSCE 240 – Intro to Software Engineering Lecture 3.
Object-Oriented Programming
Deployment Diagram.
Object-Orientated Analysis, Design and Programming
CompSci 280 S Introduction to Software Development
Programming paradigms
Object Oriented Programming
Chapter 7 Object-Oriented Programming
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING
Chapter 1: Introduction to Systems Analysis and Design
Unified Modeling Language
Deployment Diagram.
Object-Oriented Analysis and Design
IS301 – Software Engineering Dept of Computer Information Systems
Design (2).
Systems Analysis and Design With UML 2
The Object-Oriented Thought Process Chapter 1
Object Oriented Concepts -I
Road Map Introduction to object oriented programming. Classes
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
Software Design AITI GP John Paul Vergara.
Object Oriented Analysis and Design
Object Oriented Analysis and Design
Lecture 22 Inheritance Richard Gesick.
Object oriented vs procedural programming
Advanced Programming Behnam Hatami Fall 2017.
Architectural Design.
Object Oriented Programming
Chapter 1: Introduction to Systems Analysis and Design
CPS120: Introduction to Computer Science
Extended Learning Module G
The Object-Oriented Thought Process, Chapter 1
Object Oriented Analysis and Design
Chapter 22 Object-Oriented Systems Analysis and Design and UML
CPS120: Introduction to Computer Science
Object Oriented Design & Analysis
Chapter 1: Introduction to Systems Analysis and Design
Introduction to Object-Oriented Concepts
Presentation transcript:

LECTURE 2: The Object Model Ivan Marsic Rutgers University

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

Objects, Calling & Answering Calls http://www.wolframalpha.com/ 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) Object: ATM machine method-1: Accept card method-2: Read code method-3: Take selection

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

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 Modules are loose groupings of subprograms and data “Promiscuous” access to data often results in misuse Subprograms (behavior) Data (state) Software Module 1 Software Module 2 Software Module 3 Objects encapsulate data Attributes /data (state) Methods (behavior) Software Object 1 Software Object 2 Software Object 3

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

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

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

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, not easy to design organizations well…

How To Design Well OO Systems? 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” http://www.theatlantic.com/past/docs/issues/99may/9905billout.htm http://en.wikipedia.org/wiki/Deus_ex_machina http://en.wikipedia.org/wiki/Plot_device [A plot device]

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

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

Security Conflicting needs of computer security… http://en.wikipedia.org/wiki/Microsoft_Security_Development_Lifecycle Microsoft Security Development Lifecycle (SDL) http://www.microsoft.com/security/sdl/