Object-Oriented Design & Programming Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.

Slides:



Advertisements
Similar presentations
When is Orientated Programming NOT? Mike Fitzpatrick.
Advertisements

Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
Introduction To System Analysis and Design
7M701 1 Software Engineering Object-oriented Design Sommerville, Ian (2001) Software Engineering, 6 th edition: Chapter 12 )
1 CMSC 132: Object-Oriented Programming II Nelson Padua-Perez William Pugh Department of Computer Science University of Maryland, College Park.
Chapter Object-Oriented Practices. Agenda Object-Oriented Concepts Terminology Object-Oriented Modeling Tips Object-Oriented Data Models and DBMSs.
Programming Language Paradigms: summary. Object-oriented programming Objects are the fundamental building blocks of a program. Interaction is structured.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
1 SWE Introduction to Software Engineering Lecture 23 – Architectural Design (Chapter 13)
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Software Development Study Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Stéphane Ducasse6.1 Essential Concepts Why OO? What is OO? What are the benefits? What are the KEY concepts? Basis for all the lectures.
Department of Computer Science University of Maryland, College Park
1 CMSC 132: Object-Oriented Programming II Software Development IV Department of Computer Science University of Maryland, College Park.
1 CMSC 132: Object-Oriented Programming II Nelson Padua-Perez William Pugh Department of Computer Science University of Maryland, College Park.
Midterm 1 Overview Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
1 CMSC 132: Object-Oriented Programming II Software Development III Department of Computer Science University of Maryland, College Park.
Unified Modeling Language (UML)
Lecture 9 Concepts of Programming Languages
Abstract Data Types and Encapsulation Concepts
Object-Oriented Design 2 Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
OOP in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Object-oriented design CS 345 September 20,2002. Unavoidable Complexity Many software systems are very complex: –Many developers –Ongoing lifespan –Large.
C++ fundamentals.
1 INTRODUCTION TO OOP Objective: Know the difference between functional programming and OOP Know basic terminology in OOP Know the importance of OOP Know.
UML and Object Oriented Concepts
CIT241 Prerequisite Knowledge ◦ Variables ◦ Operators ◦ C++ Syntax ◦ Program Structure ◦ Classes  Basic Structure of a class  Concept of Data Hiding.
1 CS101 Introduction to Computing Lecture 19 Programming Languages.
Programming Languages and Paradigms Object-Oriented Programming.
Classes Mark Hennessy Dept. Computer Science NUI Maynooth C++ Workshop 18 th – 22 nd Spetember 2006.
C++ Object Oriented 1. Class and Object The main purpose of C++ programming is to add object orientation to the C programming language and classes are.
Introduction to Object-oriented programming and software development Lecture 1.
Welcome to OBJECT ORIENTED PROGRAMMIN Date: 10/09/2014 Prepared By Prepared By : VINAY ALEXANDER PGT(CS) KV jhagrakhand.
Database Management System Prepared by Dr. Ahmed El-Ragal Reviewed & Presented By Mr. Mahmoud Rafeek Alfarra College Of Science & Technology Khan younis.
Unified Modeling Language, Version 2.0
Introduction To System Analysis and Design
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
 OOPLs  Help companies reduce complexity  Increase competition in open markets  Speeds up development  Improves maintenance, resusability, modifiability.
CS200 Algorithms and Data StructuresColorado State University Part 4. Advanced Java Topics Instructor: Sangmi Pallickara
Guided Notes Ch. 9 ADT and Modules Ch. 10 Object-Oriented Programming PHP support for OOP and Assignment 4 Term project proposal C++ and Java Designer.
SNPL1 Woochang Lim What (Variable) + How (Function) = Object Objects are the physical and conceptual things we find in the universe around us. Object-Oriented.
OBJECT-ORIENTED PROGRAMMING (OOP) WITH C++ Instructor: Dr. Hany H. Ammar Dept. of Electrical and Computer Engineering, WVU.
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.
 Programming Language  Object Oriented Programming  JAVA – An Introduction  JAVA Milestones  JAVA Features.
Dale Roberts Object Oriented Programming using Java - Introduction Dale Roberts, Lecturer Computer Science, IUPUI Department.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
ITEC 3220A Using and Designing Database Systems Instructor: Gordon Turpin Course Website: Office: CSEB3020.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
Learners Support Publications Object Oriented Programming.
CS 3050 Object-Oriented Analysis and Design. Objectives What is “Object-Oriented?” Object-Oriented Approach Vs. Structured Approach How Has the Object-Oriented.
CS451 - Lecture 2 1 CS451 Lecture 2: Introduction to Object Orientation Yugi Lee STB #555 (816) * Acknowledgement:
Object-Oriented Programming Chapter Chapter
ISBN Object-Oriented Programming Chapter Chapter
Principles of programming languages 10: Object oriented languages Isao Sasano Department of Information Science and Engineering.
OOP Review CS 124.
1 CS Programming Languages Class 22 November 14, 2000.
Introduction To OOP 1.0 Fundamentals Of Java Programming Language 2.0 Exception Handling 3.0 Classes, Inheritance And Polymorphism © 2011 | PN AZRINA.
Welcome to OBJECT ORIENTED PROGRAMMING Prepared By Prepared By : VINAY ALEXANDER PGT(CS) KV jhagrakhand.
Abstract Data Types and Encapsulation Concepts
Object-Oriented Analysis and Design
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
Lecture 9 Concepts of Programming Languages
Abstract Data Types and Encapsulation Concepts
11.1 The Concept of Abstraction
Lecture 9 Concepts of Programming Languages
Presentation transcript:

Object-Oriented Design & Programming Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

Overview Object-oriented design Goals Techniques Object-oriented view Examples

Goals Improve software design Reduce implementation effort Scalable to large software projects Try to take advantage of two techniques Abstraction Encapsulation

Techniques – Abstraction Abstraction Provide simple high-level model of Physical entity Activity Helpful for managing complexity Enables information hiding Can change implementation & representation Will not affect other software components

Types of Abstraction Procedural abstraction Specify what actions should be performed Hide algorithms Data abstraction Specify data objects for problem Hide representation

Abstraction Example Abstraction of a Student Roster Data List of student names Actions Create roster Add student Remove student Print roster STUDENT ROSTER List of names Create() AddStudent() RemoveStudent() Print()

Techniques – Encapsulation Encapsulation Confine information so it is only visible / accessible through an associated external interface Approach For some entity X in program Abstract data in X Abstract actions on data in X Collect data & actions on X in same location Protects and hides X

Encapsulation Extension of abstraction Always abstract data & function together Encapsulated entity  Abstract Data Type (ADT) Examples List ADT May be implemented as array, linked list, etc… Java collections library

Benefits of Encapsulation Easier to make code modifications Due to information hiding Promotes code reuse Interface to data structure clearly defined Easier to reuse code Code reuse increases productivity

Object-Oriented Design View software as A collection of entities (objects) Functions associated with each object Communication between objects Exploits abstraction & encapsulation Can rely on programming language support

Object-Oriented View Example problem description Thermostat uses dial setting to control a heater to maintain constant temperature in room Room Thermostat (dial) Heater getTemperature() heaterOn()

History of Object-Oriented Design Preceded by procedure-oriented view Earliest approach to programming Uses procedure abstraction Similar to actual machine instructions Focus on control flow, program scope Examples: Fortran, Cobol, Pascal, Basic Example Thermostat() 1. Get room temperature 2. If (temperature < setting) turn heater on 3. Else turn heater off 4. Goto step 1

OO Programming Languages Development history Simula (Dahl & Nygaard, 1962) Modeling discrete event simulation Smalltalk (Kay, 1972) General programming C++ (Stroustrup, 1979) Manage complexity in huge software projects Java (Gosling, 1991) Designed for embedded processors

Factors in Success of OO Design Growing demand More experience with large software projects Improvements in language design Made OO programming easier Improvements compiler technology Support more language features efficiently Improvements in hardware Handled inefficiencies in OO programming Made performance less critical

Elements of Object-Oriented Design Objects Entities in program Methods Functions associated with objects Classes Groups of objects with similar properties Inheritance Relationship between classes

Objects Definition Entity that has state, behavior, and identity State (data) Properties possessed by object Current values of those properties Behavior (methods) How objects react to changes in state How objects interact with each other Identity (references) Mechanism to distinguish between objects

Object Example Thermostat State DesiredTemp CurrentTemp HeaterState Behavior SetDesiredTemp() TurnHeaterOn() TurnHeaterOff() Identity this

Object Example Thermostat StatePropertyValue DesiredTempinteger78 o CurrentTempinteger72 o HeaterStatebooleanON

Object State Properties Static, unchanging May view as types Values Dynamic, changes Within bounds set by properties

Methods Definition Procedures associated with object Specify behavior of objects Invocation  sending message to object Example myThermostat.setDesiredTemp(78) myThermostat.turnHeaterOn() myThermostat.turnHeaterOff()

Method Types Accessor Return state information Mutator Modify state information Constructor Create & initialize new object Destructor Remove object & free up resources

Identity How to distinguish between objects Reference variables Used in object-oriented programming languages Points to objects Multiple variables may point to same object

Reference Variables Example

Identity Equivalence Whether two objects are equal Name equivalence Reference variables point to same object Content equivalence Objects from same class State in each object are identical

Equivalence Example Name EquivalentContent Equivalent