CSCI-383 Object-Oriented Programming & Design Lecture 4.

Slides:



Advertisements
Similar presentations
Understand and appreciate Object Oriented Programming (OOP) Objects are self-contained modules or subroutines that contain data as well as the functions.
Advertisements

Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
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.
COMPSCI 105 S Principles of Computer Science 12 Abstract Data Type.
OOP - Object Oriented Programming Object Oriented Programming is an approach to programming that was developed to make large programs easier to manage.
1 CIS601: Object-Oriented Programming in C++ Note: CIS 601 notes were originally developed by H. Zhu for NJIT DL Program. The notes were subsequently revised.
Chapter 1 Introduction to Object- Oriented Programming and Problem Solving.
The Object Oriented Approach to Software Engineering Software Engineering The process of specifying, designing, implementing, testing, maintaining large.
1 Introduction to CS Agenda Syllabus Schedule Lecture: the management of complexity.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
C++ fundamentals.
CSCI-383 Object-Oriented Programming & Design Lecture 15.
Introduction SWE 619. Why Is Building Good Software Hard? Large software systems enormously complex  Millions of “moving parts” People expect software.
Introduction to Object-oriented Programming CSIS 3701: Advanced Object Oriented Programming.
Introduction to Object-oriented programming and software development Lecture 1.
GENERAL CONCEPTS OF OOPS INTRODUCTION With rapidly changing world and highly competitive and versatile nature of industry, the operations are becoming.
MT311 Java Application Development and Programming Languages Li Tak Sing( 李德成 )
O BJECT O RIENTATION F UNDAMENTALS Prepared by: Gunjan Chhabra.
An Object-Oriented Approach to Programming Logic and Design
Sadegh Aliakbary Sharif University of Technology Fall 2011.
CSCI-383 Object-Oriented Programming & Design Lecture 9.
Chapter 3 Introduction to Collections – Stacks Modified
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
University of Toronto Department of Computer Science CSC444 Lec05- 1 Lecture 5: Decomposition and Abstraction Decomposition When to decompose Identifying.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
CSCI-383 Object-Oriented Programming & Design Lecture 3.
An Object-Oriented Approach to Programming Logic and Design Fourth Edition Chapter 6 Using Methods.
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.
Software Engineering Principles. SE Principles Principles are statements describing desirable properties of the product and process.
Object-Oriented Paradigm and UML1 Introduction to the Object- Oriented Paradigm.
Abstraction CMPS Abstraction Abstraction mechanisms are techniques to deal with creating, understanding and managing complex systems Abstraction.
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.
Abstraction ADTs, Information Hiding and Encapsulation.
Programming Paradigms Lecturer Hamza Azeem. What is PP ? Revision of Programming concepts learned in CPLB Learning how to perform “Object-Oriented Programming”
CSCI-383 Object-Oriented Programming & Design Lecture 10.
Chapter 10, Slide 1 ABSTRACT DATA TYPES Based on the fundamental concept of ABSTRACTION:  process abstraction  data abstraction Both provide:  information.
Data Structures and Algorithms Dr. Tehseen Zia Assistant Professor Dept. Computer Science and IT University of Sargodha Lecture 1.
Salman Marvasti Sharif University of Technology Winter 2015.
90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 1: Introduction Data.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Software Engineering and Object-Oriented Design Topics: Solutions Modules Key Programming Issues Development Methods Object-Oriented Principles.
Csci 490 / Engr 596 Special Topics / Special Projects Software Design and Scala Programming Spring Semester 2010 Lecture Notes.
Data Design and Implementation. Definitions Atomic or primitive type A data type whose elements are single, non-decomposable data items Composite type.
Introduction to OOP CPS235: Introduction.
Chapter 1 Data Abstraction: The Walls CS Data Structures Mehmet H Gunes Modified from authors’ slides.
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.
CSCI 383 Object-Oriented Programming & Design Lecture 4 Martin van Bommel.
OOPS CONCEPT.  OOPS  Benefits of OOPs  OOPs Principles  Class  Object Objectives.
Chapter 2 Principles of Programming and Software Engineering.
From Use Cases to Implementation 1. Structural and Behavioral Aspects of Collaborations  Two aspects of Collaborations Structural – specifies the static.
CSCI 383 Object-Oriented Programming & Design Lecture 7 Martin van Bommel.
From Use Cases to Implementation 1. Mapping Requirements Directly to Design and Code  For many, if not most, of our requirements it is relatively easy.
Maitrayee Mukerji. INPUT MEMORY PROCESS OUTPUT DATA INFO.
 The Object Oriented concepts was evolved for solving complex problems. Object- oriented software development started in the 1980s. Object-oriented design.
Advanced Data Structures Lecture 1
Chapter 0: Introduction
OOP - Object Oriented Programming
Visit for more Learning Resources
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING
Object-Oriented Analysis and Design
Data Abstraction: The Walls
About the Presentations
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
Introduction Artificial Intelligent.
Data Structures and Algorithms for Information Processing
CIS601: Object-Oriented Programming in C++
Paper by D.L Parnas And D.P.Siewiorek Prepared by Xi Chen May 16,2003
Presentation transcript:

CSCI-383 Object-Oriented Programming & Design Lecture 4

Adapted From: An Introduction to Object Oriented Programming, 3 rd Edition, by Timothy Budd Finding the Right Level of Abstraction  A critical problem in early stages of development is to determine what details are appropriate at each level of abstraction, and (often more importantly) what details should be omitted  One does not want to ignore or throw away important information  But one does not want to manage too much information, or have the amount of information hide critical details

Adapted From: An Introduction to Object Oriented Programming, 3 rd Edition, by Timothy Budd Finding the Right Level of Abstraction (cont’d)  A chess board problem Can a chess board, which has 64 squares, be tiled by 32 dominoes, each covering exactly two squares?  YES  In order to solve this problem, what details do we need to keep, and what details we can ignore?

Adapted From: An Introduction to Object Oriented Programming, 3 rd Edition, by Timothy Budd Finding the Right Level of Abstraction (cont’d)  The mutilated chess board problem If two diagonally opposite squares are removed, can the remaining 62 squares be tiled by dominoes?

Adapted From: An Introduction to Object Oriented Programming, 3 rd Edition, by Timothy Budd Forms of Abstraction  Abstraction is used to help understand a complex system  In a certain sense, abstraction is the imposition of structure on a system  What are the techniques that we use for handling complexity? E.g., what is a computer?

Adapted From: An Introduction to Object Oriented Programming, 3 rd Edition, by Timothy Budd Is-a and Has-a Abstraction  Two of the most important types of abstraction are the following: Division into parts -- Has-a abstraction Division into specialization -- Is-a abstraction

Adapted From: An Introduction to Object Oriented Programming, 3 rd Edition, by Timothy Budd Has-a Abstraction  Most common technique people use to help understand complex systems  Division into parts takes a complex system, and divides into into component parts, which can then be considered in isolation  Characterized by sentences that have the words “has-a” A car has-a engine, and has-a transmission A bicycle has-a wheel A window has-a menu bar  Allows us to drop down a level of complexity when we consider the component in isolation

Adapted From: An Introduction to Object Oriented Programming, 3 rd Edition, by Timothy Budd Is-a Abstraction  Is-a abstraction takes a complex system, and views it as an instance of a more general abstraction  Characterized by sentences that have the words “is-a” A car is a wheeled vehicle, which is-a means of transportation A bicycle is-a wheeled vehicle A pack horse is-a means of transportation  Allows us to categorize artifacts and information and make it applicable to many different situations Mammals are animals that have hair and nurse their young A cat is a mammal, a dog is a mammal, …

Adapted From: An Introduction to Object Oriented Programming, 3 rd Edition, by Timothy Budd Other Types of Abstraction -- Composition  While is-a and has-a are two important types of abstraction, there are others  Composition is one example; a form of has-a; characterized by the following Primitive forms Rules for combining old values to create new values The idea that new values can also be subject to further combination  Examples include regular expressions, type systems, windows, lots of other complex systems

Adapted From: An Introduction to Object Oriented Programming, 3 rd Edition, by Timothy Budd Patterns  When faced with a new problem, most people will consider successful solutions to previous problems with similar characteristics  Patterns are another attempt to document and reuse abstractions

Adapted From: An Introduction to Object Oriented Programming, 3 rd Edition, by Timothy Budd A Short History of Abstraction Mechanisms  Another way to better understand OOP is to put it in context with the history of abstraction in computer science Assembly languages Procedures Modules ADT The Service View Objects The future....

Adapted From: An Introduction to Object Oriented Programming, 3 rd Edition, by Timothy Budd Assembly Languages  Assembly languages and linkers were perhaps the first tools used to abstract features of the bare machine Addresses could be represented symbolically, not as a number Symbolic names for operations Linking of names and locations performed automatically  Abstraction allowed the programmer to concentrate more effort on defining the task to be performed and less on the steps necessary to complete the task

Adapted From: An Introduction to Object Oriented Programming, 3 rd Edition, by Timothy Budd Procedures and Functions  Libraries of procedures and functions (such as mathematical or input/output libraries) provided the first hints of information hiding  They permit the programmer to think about operations in high level terms, concentrating on what is being done, not how it is being performed  But they are not an entirely effective mechanism of information hiding

Adapted From: An Introduction to Object Oriented Programming, 3 rd Edition, by Timothy Budd Procedures and Functions int datastack[100]; int datatop = 0; void init() // initialize the stack { datatop = 0; } void push(int val) // push a value on to the stack { if (datatop < 100) datastack [datatop++] = val; } int pop() // pop element from the stack { if (datatop > 0) return datastack [--datatop]; return 0; }  Where can you hide the implementation?

Procedures and Functions  In the "good ol' days" of programming, data and functions coexisted on a casual basis  During the 1960s and 1970s, structured programming helped bring organization to this picture by emphasizing the use of Abstract Data Types (ADTs):

Adapted From: An Introduction to Object Oriented Programming, 3 rd Edition, by Timothy Budd Modules  The solution to the problem of global name space congestion what the introduction of the idea of a module  A module provides the ability to divide a name space into 2 parts The public part is accessible outside the module The private part is only accessible within the module

Adapted From: An Introduction to Object Oriented Programming, 3 rd Edition, by Timothy Budd Parnas's Principles  David Parnas described two principles for the proper use of modules: One must provide the intended user of a module with all the information needed to use the module correctly, and with nothing more One must provide the implementor of a module with all the information needed to complete the module, and nothing more

Adapted From: An Introduction to Object Oriented Programming, 3 rd Edition, by Timothy Budd Modules  Solves the problem of encapsulation -- but what if your programming task requires two or more stacks?

Abstract Data Type  A type is a collection of values E.g., Boolean, Integer  A data type is a type together with a collection of operations to manipulate the type E.g., Integer data type  An abstract data type (ADT) is the realization of a data type as a software component. It does not specify how the data type is implemented

Adapted From: An Introduction to Object Oriented Programming, 3 rd Edition, by Timothy Budd Abstract Data Types  An Abstract Data Type is a programmer-defined data type that can be manipulated in a manner similar to system-provided data types Must have the ability to instantiate many different copies of the data type Data type can be manipulated using provided operations, without knowledge of internal representation  But ADTs were important not because they were data structures, but because they provided an easily characterized service to the rest of an application

Adapted From: An Introduction to Object Oriented Programming, 3 rd Edition, by Timothy Budd What Does the Future Hold  What will be the next evolutionary step in software?  Prediction is hard, particularly about the future  However, one you have accepted the idea of an application formed from interacting agents, there is no reason why those components must exist on the same computer (distributed computing) or be written in the same language (components)  So some of the trends we see today in software are natural results of the OOP mind set