Object-Oriented Programming (OOP) Lecture No. 2

Slides:



Advertisements
Similar presentations
F27SB2 Software Development 2 Lecture 1: Introduction.
Advertisements

COMPSCI 105 S Principles of Computer Science 12 Abstract Data Type.
GUI Testing. High level System Testing Test only those scenarios and outputs that are observable by the user Event-driven Interactive Two parts to test.
Solutions to Review Questions. 4.1 Define object, class and instance. The UML Glossary gives these definitions: Object: an instance of a class. Class:
OOP Design Patterns Chapters Design Patterns The main idea behind design patterns is to extract the high level interactions between objects and.
Abstract Data Types (ADTs) An ADT consists of: –a set of values, and –a set of operations on those values. Example: rational numbers –some values: 15/7,
 2006 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Software Development Software Life Cycle UML Diagrams.
What is an object? Your dog, your desk, your television set, your bicycle. Real-world objects share two characteristics: They all have state and behavior;
Design The goal is to design a modular solution, using the techniques of: Decomposition Abstraction Encapsulation In Object Oriented Programming this is.
Object-oriented Programming Concepts
1 Writing a Good Program 5. Objects and Classes in C++
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
WEL COME PRAVEEN M JIGAJINNI PGT (Computer Science) MCA, MSc[IT], MTech[IT],MPhil (Comp.Sci), PGDCA, ADCA, Dc. Sc. & Engg.
Computer Organization
Sadegh Aliakbary Sharif University of Technology Fall 2011.
Object Oriented Programming with JAVA Arash N. Kia AlZahra University Definitions – Part 1.
Object-Oriented Programming (OOP) CSC-2071 (3+1=4 Credits) Lecture No. 1 MBY.
Object Oriented Programming Principles Lecturer: Kalamullah Ramli Electrical Engineering Dept. University of Indonesia Session-3.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
Chapter 17 Creating a Database.
Movement-Machines-Cars Question: How do cars work?
Object-Oriented Design Simple Program Design Third Edition A Step-by-Step Approach 11.
CSC241 Object-Oriented Programming (OOP) Lecture No. 1.
Programming Paradigms Lecturer Hamza Azeem. What is PP ? Revision of Programming concepts learned in CPLB Learning how to perform “Object-Oriented Programming”
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
Salman Marvasti Sharif University of Technology Winter 2015.
Object-Oriented Programming (OOP) Lecture No. 2. Information Hiding ► Information is stored within the object ► It is hidden from the outside world ►
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Object-Oriented Programming (OOP) Lecture No. 3 Downloaded From:
Chapter 4 Basic Object-Oriented Concepts. Chapter 4 Objectives Class vs. Object Attributes of a class Object relationships Class Methods (Operations)
CHAPTER 14 Classes, Objects, and Games XNA Game Studio 4.0.
STEP MOTOR Yisheng Zhang. Overview What is a step motor? How to control it? Why to use it? Where to use it? How to select it? Where to get it?
OOPS CONCEPT.  OOPS  Benefits of OOPs  OOPs Principles  Class  Object Objectives.
Object-Oriented Paradigm (OOP) Course Code: SE 101 Lecture No. 1.
Object Oriented Paradigm OOP’s. Problems with Structured Programming As programs grow ever larger and more complex, even the structured programming approach.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
Chapter 11: Abstract Data Types Lecture # 17. Chapter 11 Topics The Concept of Abstraction Advantages of Abstract Data Types Design Issues for Abstract.
 The Object Oriented concepts was evolved for solving complex problems. Object- oriented software development started in the 1980s. Object-oriented design.
Object-Oriented Programming
Development Environment
Programming Logic and Design Seventh Edition
Programming paradigms
Visit for more Learning Resources
JAVA By Waqas.
The Object-Oriented Thought Process Chapter 1
Object-Oriented Programming (OOP) Lecture No. 1
CS101 Introduction to Computing Lecture 19 Programming Languages
Object-Oriented Programming
PRINCIPALES OF OBJECT ORIENTED PROGRAMMING
IM, Presence, and Contacts
Introduction to Computing Lecture # 1
Service-centric Software Engineering
Encapsulation & Visibility Modifiers
Subprograms and Programmer Defined Data Type
Object-Oriented Programming
Object oriented vs procedural programming
Advanced Programming Behnam Hatami Fall 2017.
Introduction to Classes and Objects
Object-Oriented Programming
Software Design Lecture : 9.
Object-Oriented Programming
Producing Production Quality Software
Introduction to Visual Basic and Object Oriented Programming
Object-Oriented Programming (OOP) Lecture No. 5
Object-Oriented Programming
Defining Classes and Methods
Software Design Lecture : 35.
Object-Oriented Programming
Object Oriented Design & Analysis
Presentation transcript:

Object-Oriented Programming (OOP) Lecture No. 2

Information Hiding Information is stored within the object It is hidden from the outside world It can only be manipulated by the object itself

Example – Information Hiding Ali’s name is stored within his brain We can’t access his name directly Rather we can ask him to tell his name

Example – Information Hiding A phone stores several phone numbers We can’t read the numbers directly from the SIM card Rather phone-set reads this information for us

Information Hiding Advantages Simplifies the model by hiding implementation details It is a barrier against change propagation

Encapsulation Data and behaviour are tightly coupled inside an object Both the information structure and implementation details of its operations are hidden from the outer world

Example – Encapsulation Ali stores his personal information and knows how to translate it to the desired language We don’t know How the data is stored How Ali translates this information

Example – Encapsulation A Phone stores phone numbers in digital format and knows how to convert it into human-readable characters We don’t know How the data is stored How it is converted to human-readable characters

Encapsulation – Advantages Simplicity and clarity Low complexity Better understanding

Object has an Interface An object encapsulates data and behaviour So how objects interact with each other? Each object provides an interface (operations) Other objects communicate through this interface

Example – Interface of a Car Steer Wheels Accelerate Change Gear Apply Brakes Turn Lights On/Off

Example – Interface of a Phone Input Number Place Call Disconnect Call Add number to address book Remove number Update number

Implementation Provides services offered by the object interface This includes Data structures to hold object state Functionality that provides required services

Example – Implementation of Gear Box Data Structure Mechanical structure of gear box Functionality Mechanism to change gear

Example – Implementation of Address Book in a Phone Data Structure SIM card Functionality Read/write circuitry

Separation of Interface & Implementation Means change in implementation does not effect object interface This is achieved via principles of information hiding and encapsulation

Example – Separation of Interface & Implementation A driver can drive a car independent of engine type (petrol, diesel) Because interface does not change with the implementation

Example – Separation of Interface & Implementation A driver can apply brakes independent of brakes type (simple, disk) Again, reason is the same interface

Advantages of Separation Users need not to worry about a change until the interface is same Low Complexity Direct access to information structure of an object can produce errors

Messages Objects communicate through messages They send messages (stimuli) by invoking appropriate operations on the target object The number and kind of messages that can be sent to an object depends upon its interface

Examples – Messages A Person sends message (stimulus) “stop” to a Car by applying brakes A Person sends message “place call” to a Phone by pressing appropriate button