1 CMSC 132: Object-Oriented Programming II Nelson Padua-Perez William Pugh Department of Computer Science University of Maryland, College Park.

Slides:



Advertisements
Similar presentations
COM vs. CORBA.
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.
Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
Introduction To System Analysis and Design
Object-Oriented Design & Programming Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
7M701 1 Software Engineering Object-oriented Design Sommerville, Ian (2001) Software Engineering, 6 th edition: Chapter 12 )
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.
Chapter 1 Introduction to Object- Oriented Programming and Problem Solving.
Unified Modeling (Part I) Overview of UML & Modeling
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.
Chapter 1 Principles of Programming and Software Engineering.
1 CMSC 132: Object-Oriented Programming II Software Development III Department of Computer Science University of Maryland, College Park.
Object Oriented Databases - Overview
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
1 CMSC 132: Object-Oriented Programming II Nelson Padua-Perez William Pugh Department of Computer Science University of Maryland, College Park.
Object-Oriented Design 2 Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
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
1 CS101 Introduction to Computing Lecture 19 Programming Languages.
UML Sequence Diagrams Michael L. Collard, Ph.D. Department of Computer Science Kent State University.
PROGRAMMING LANGUAGES The Study of Programming Languages.
Computers Are Your Future Tenth Edition Chapter 11: Programming Languages & Program Development Copyright © 2009 Pearson Education, Inc. Publishing as.
1 BTEC HNC Systems Support Castle College 2007/8 Systems Analysis Lecture 9 Introduction to Design.
Introduction to Object-oriented programming and software development Lecture 1.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 12 Object-Oriented.
BCS 2143 Introduction to Object Oriented and Software Development.
Welcome to OBJECT ORIENTED PROGRAMMIN Date: 10/09/2014 Prepared By Prepared By : VINAY ALEXANDER PGT(CS) KV jhagrakhand.
COM vs. CORBA Computer Science at Azusa Pacific University September 19, 2015 Azusa Pacific University, Azusa, CA 91702, Tel: (800) Department.
Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
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.
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.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
SNPL1 Woochang Lim What (Variable) + How (Function) = Object Objects are the physical and conceptual things we find in the universe around us. Object-Oriented.
Data Structures Using C++1 Chapter 1 Software Engineering Principles and C++ Classes.
1 Ch. 1: Software Development (Read) 5 Phases of Software Life Cycle: Problem Analysis and Specification Design Implementation (Coding) Testing, Execution.
Dale Roberts Object Oriented Programming using Java - Introduction Dale Roberts, Lecturer Computer Science, IUPUI Department.
Cmpe 589 Spring 2006 Lecture 2. Software Engineering Definition –A strategy for producing high quality software.
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.
Lecture 2 Intro. To Software Engineering and Object-Oriented Programming (1/2)
Data Structures Using C++ 2E
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 1: Introduction Data.
Object-Oriented Programming Chapter Chapter
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
PC204 Lecture 5 Programming Methodologies Copyright 2000 by Conrad Huang and the Regents of the University of California. All rights reserved.
1 Unified Modeling Language, Version 2.0 Chapter 2.
CSI 1340 Introduction to Computer Science II Chapter 1 Software Engineering Principles.
CMSC 345 Fall 2000 OO Design. Characteristics of OOD Objects are abstractions of real-world or system entities and manage themselves Objects are independent.
Introduction To OOP 1.0 Fundamentals Of Java Programming Language 2.0 Exception Handling 3.0 Classes, Inheritance And Polymorphism © 2011 | PN AZRINA.
Lesson 1 1 LESSON 1 l Background information l Introduction to Java Introduction and a Taste of Java.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
Procedural programming Procedural programming is where you specify the steps required. You do this by making the program in steps. Procedural programming.
Lecture 2 Intro. To Software Engineering and Object-Oriented Programming (1/2)
Welcome to OBJECT ORIENTED PROGRAMMING Prepared By Prepared By : VINAY ALEXANDER PGT(CS) KV jhagrakhand.
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
Subprograms and Programmer Defined Data Type
Ada – 1983 History’s largest design effort
What Is Good Software(Program)?
Presentation transcript:

1 CMSC 132: Object-Oriented Programming II Nelson Padua-Perez William Pugh Department of Computer Science University of Maryland, College Park

2 Lecture Overview Software Development Choosing a software development process Algorithm and Data Structures Coding and Debugging Testing and Verification Documentation Support Maintenance Object-oriented design Goals Techniques Object-oriented view Examples

3 Choosing a software development process Which software life cycle is appropriate when? For projects like 132 programming projects, just code and test probably suffices But the world isn’t like 132 programming projects

4 Big questions Do you understand what you are trying to build? What is the cost of change? How easy is it to get the entire thing in your head? How many people have to interact with the design?

5 Do you understand the problem? In many cases, the things we want software to do are not well understood: provide a web interface for students applying for the PhD program build software that allows users to view and manipulate photographs Build a better search engine You have to understand the real-world constraints/interactions May have to build prototype to understand how users can effectively use it

6 What is the cost of change? Say you’ve already completed much of the coding, and realize you need to change something in the design or even the requirements how expensive is that? If it is hugely expensive, you better get the requirements and design right before you start most of the coding

7 Has the cost of change changed? Some people have said that recent software development techniques have substantially changed the cost of change safe programming languages (e.g., not C/C++/assembly language) OO design programming test driven development

8 Sometimes, change is still expensive Key nexus in a large system Stuff that interacts with hardware that is being co-designed Stuff that interacts with software being developed externally can’t change an API once it is published

9 How easy is it to understand? When building and developing software, you need to understand it (at least, parts of it) For 100 lines of code, just read the code That doesn’t work for 100,000 lines of code Need to have ways of documenting the requirements and design at a higher level

10 How many people interact with design? How many people interact with the design? Part of the cost of change if you make a change, how many people need to be aware of or consulted on the design change Design changes that interact with a lot of people are expensive and need to be minimized try to get these design choices right early and document them

11 Algorithms and Data Structures Goal Select algorithms and data structures to implement each component Problems Functionality Provides desired abilities Efficiency Provides desired performance Correctness Provides desired results

12 Algorithms and Data Structures Example Implement list as array or linked list

13 Coding and Debugging Goal Write actual code and ensure code works Problems Choosing programming language Functional design Fortran, BASIC, Pascal, C Object-oriented design Smalltalk, C++, Java Using language features Exceptions, streams, threads

14 Testing and Verification Goal Demonstrate software correctly match specification Problem Program verification Formal proof of correctness Difficult / impossible for large programs Empirical testing Verify using test cases Unit tests, integration tests, alpha / beta tests Used in majority of cases in practice

15 Documentation and Support Goal Provide information needed by users and technical maintenance Problems User documentation Help users understand how to use software Technical documentation Help coders understand how to modify, maintain software

16 Maintenance Goal Keep software working over time Problems Fix errors Improve features Meet changing specification Add new functionality

17 Object-Oriented Design Goals Improve software design Reduce implementation effort Scalable to large software projects Try to take advantage of two techniques Abstraction Encapsulation

18 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

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

20 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()

21 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

22 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

23 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

24 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

25 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()

26 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

27 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

28 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

29 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

30 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

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

32 Object Example Thermostat StatePropertyValue DesiredTempinteger78 o CurrentTempinteger72 o HeaterStatebooleanON

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

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

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