Prachet Bhuyan Assistant Professor, CSE,SOT, KIIT University

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

Object-Oriented Programming Basics Prof. Ankur Teredesai, Computer Science Department, RIT.
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.
Classes & Objects Computer Science I Last updated 9/30/10.
Classes and Object- Oriented... tMyn1 Classes and Object-Oriented Programming The essence of object-oriented programming is that you write programs in.
Chapter 10 Introduction to Objects and Classess 1.
Object-Oriented Analysis and Design
Introduction To System Analysis and Design
L3-1-S1 OO Concepts © M.E. Fayad SJSU -- CMPE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room.
Object-Oriented Databases v OO systems associated with – graphical user interface (GUI) – powerful modeling techniques – advanced data management capabilities.
Object Oriented System Development with VB .NET
Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 1 Object-Oriented Analysis and Design - CDT309 Period 4, Spring 2008 Object-oriented concepts.
1 Introduction to C++ Programming Concept Basic C++ C++ Extension from C.
OBJECT ORIENTED PROGRAMMING IN C++ LECTURE
BACS 287 Basics of Object-Oriented Programming 1.
The chapter will address the following questions:
Introduction To System Analysis and design
Object Oriented Software Development
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.
O BJECT O RIENTATION F UNDAMENTALS Prepared by: Gunjan Chhabra.
1 A Student Guide to Object- Orientated Systems Chapter 4 Objects and Classes: the basic concepts.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 20 Object-Oriented.
Introduction To System Analysis and Design
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
1 Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill Chapter 2: Object Basics Object-Oriented Systems Development Using the Unified Modeling.
OBJECT-ORIENTED PROGRAMMING (OOP) WITH C++ Instructor: Dr. Hany H. Ammar Dept. of Electrical and Computer Engineering, WVU.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
What is Object-Oriented?  Organization of software as a collection of discreet objects that incorporate both data structure and behavior.
Programming Paradigms Lecturer Hamza Azeem. What is PP ? Revision of Programming concepts learned in CPLB Learning how to perform “Object-Oriented Programming”
Basic Concepts of Object Orientation Object-Oriented Analysis CIM2566 Bavy LI.
Chapter 4 Basic Object-Oriented Concepts. Chapter 4 Objectives Class vs. Object Attributes of a class Object relationships Class Methods (Operations)
Copyright 2006 Oxford Consulting, Ltd1 January Introduction to C++ Programming is taking A problem Find the area of a rectangle A set of data.
1 CSE Programming in C++. 2 Overview Sign roster list Syllabus and Course Policies Introduction to C++ About Lab 1 Fill Questionnaire.
Lesson 1 1 LESSON 1 l Background information l Introduction to Java Introduction and a Taste of Java.
Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their.
 The Object Oriented concepts was evolved for solving complex problems. Object- oriented software development started in the 1980s. Object-oriented design.
COP Introduction to Database Structures
Object Oriented Systems Design
OBJECT BASICS (CH-2) SCE, KIIT University KIIT CSE/IT (OOSD)
Programming paradigms
Object Oriented Programming
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING
JAVA By Waqas.
Roberta Roth, Alan Dennis, and Barbara Haley Wixom
The Movement To Objects
Object-Oriented Programming Basics
Classes and OOP.
Object-Oriented Analysis and Design
Systems Analysis and Design With UML 2
Object Oriented Concepts -I
Object-Oriented Programming
PRINCIPALES OF OBJECT ORIENTED PROGRAMMING
TIM 58 Chapter 8: Class and Method Design
The Object Oriented Approach to Design
Computer Programming.
Chapter 20 Object-Oriented Analysis and Design
Appendix A Object-Oriented Analysis and Design
CPS120: Introduction to Computer Science
Extended Learning Module G
Workshop for Programming And Systems Management Teachers
Object Oriented Analysis and Design
Chapter 22 Object-Oriented Systems Analysis and Design and UML
Object-Oriented Programming
Object Oriented Design & Analysis
Appendix A Object-Oriented Analysis and Design
Agenda Software development (SD) & Software development methodologies (SDM) Orthogonal views of the software OOSD Methodology Why an Object Orientation?
Object Oriented Programming (OOP)- Assist. Prof. Dr
Presentation transcript:

Prachet Bhuyan Assistant Professor, CSE,SOT, KIIT University OBJECT BASICS (CH-2) Prachet Bhuyan Assistant Professor, CSE,SOT, KIIT University KIIT CSE/IT (OOSD)

Topics to be Discussed INTRODUCTION AN OBJECT ORIENTED PHILOSOPHY OBJECTS CLASSES OBJECT RESPONDS TO MESSAGES OBJECT RELATIONSHIP AND ASSOCIATIONS CONSUMER-PRODUCER ASSOCIATION AGGREGATION AND OBJECT CONTAINMENT KIIT CSE/IT (OOSD)

INTRODUCTION What is an object ? Ans: A car is an object; a real world entity , identifiably separate from its surroundings. Car has well defined attributes: Color Manufacturer Cost Owner KIIT CSE/IT (OOSD)

1. INTRODUCTION contd…. Car has well defined set of things we do with it(i.e methods) : Drive it Lock it Tow it Carry passenger What do object have to do with system development ? KIIT CSE/IT (OOSD)

1. INTRODUCTION contd…. Properties or attributes describe the state (data) of an object. Methods (procedures) defines its behavior. KIIT CSE/IT (OOSD)

2. AN OBJECT ORIENTED PHILOSOPHY Most programming languages are computationally equivalent (a proces describable in one is describable in another). But the difference comes among them are : The ease of description Reusability Extensibility Readability Computational efficiency Ability to maintain the description KIIT CSE/IT (OOSD)

2. AN OBJECT ORIENTED PHILOSOPHY contd…. It has been said that one should speak: English for business German for engineering Persian for poetry A similar quip can be made for programming languages. Traditional languages were more machine dependant KIIT CSE/IT (OOSD)

2. AN OBJECT ORIENTED PHILOSOPHY contd…. Fundamental characteristic of OOP is that it allows the base concepts of the language to be extended to include ideas and terms closer to those of its application. New data types can be defined in terms of existing data types. FUNDAMENTAL DIFFERENCE BETWEEN THE OBJECT ORIENTED SYSTEMS AND TRADITIONAL SYSTEMS ARE: KIIT CSE/IT (OOSD)

2. AN OBJECT ORIENTED PHILOSOPHY contd…. Traditional Systems: Most traditional development methodologies are either algorithm centric or data centric. In an algorithm centric methodology you can think of an algorithm that can accomplish the task, then build data structures for that algorithm to use. In a data centric methodology, you think how to structure the data, then build the algorithm around that structure. KIIT CSE/IT (OOSD)

2. AN OBJECT ORIENTED PHILOSOPHY contd…. In traditional approach a lot of code was written to do all the things that have to be done. The code is the plan, brick, and mortar for building a structure(Code Centric). Code is the active entity here. KIIT CSE/IT (OOSD)

2. AN OBJECT ORIENTED PHILOSOPHY contd…. Object-Oriented Systems: Here the algorithm and the data structures are packaged together as an object, which has a set of attributes or properties. The state of these attributes is reflected in the values stored in its data structures. Objects has a collection of methods or procedures Attributes and methods are equal and inseparable parts of the object KIIT CSE/IT (OOSD)

2. AN OBJECT ORIENTED PHILOSOPHY contd…. It is more like employing a lot of helpers that take on an active role & form a community whose interactions become the application. OOP languages bridge the semantic gap between the ideas of the application and those of the underlying machine & Objects represent the application data in a way that is not forced by hardware architecture. KIIT CSE/IT (OOSD)

3. OBJECTS The term object was first utilized in the Simula language. The term object means a combination of data and logic that represent some real world entity. Eg: A Porsche automobile can be represented in a computer program as an object KIIT CSE/IT (OOSD)

3. OBJECTS contd…. Find “data” & “logic” part of this car. The “data” part of this object would be: Car’s name , color, number of doors, price etc The “logic” part of the object could be collection of program: Show mileage, change mileage, stop, go KIIT CSE/IT (OOSD)

3. OBJECTS contd…. When developing an object-oriented application, two basic questions always arise: What objects does the application need ? What functionality should those object have ? Programming in an object-oriented system consists of adding new kinds of objects to the system an defining how they behave. Eg: of objects: Windows, Spreadsheet, etc. KIIT CSE/IT (OOSD)

4. CLASSES Classes are used to distinguish one type of object from another. Eg: class eagle or class airplane, class car. As per O-O systems, a class is a set of objects that share a common structure and a common behavior; a single object is simply an instance of a class. A class is a specification of structure (instance variables), behavior (methods), and inheritance for objects. KIIT CSE/IT (OOSD)

5. OBJECT RESPONDS TO MESSAGES Object capabilities are determined by the methods defined for it. Methods are conceptually equal to the function definitions used in procedural language. Objects perform operations in response to messages. Eg: When you press on the break pedal of a car, you send a stop message to the car object. KIIT CSE/IT (OOSD)

5. OBJECT RESPONDS TO MESSAGES contd…. Messages essentially are nonspecific function calls. A message is different from a subroutine call; how ? Since different objects can respond to the same message in different way. KIIT CSE/IT (OOSD)

Eg: Cars, motorcycles & bicycles will all respond to a stop message but differently. KIIT CSE/IT (OOSD)

5. OBJECT RESPONDS TO MESSAGES contd…. NOTE: Messages makes no assumptions about the class of the receiver or the arguments; they are simply objects. It is the receiver’s responsibilities to respond to the message appropriately. This gives flexibility, as different objects can respond to the same message in different ways. This is known as polymorphism. It is the main difference between a message and a subroutine call. KIIT CSE/IT (OOSD)

Difference Between Message & Method Vegetable Biriyani Instruction Way it is Prepared 1.Cook Rice 2.Wash All the vegetables. 3. Marinate the same with Yogurt & ginger-garlic paste for about an hour. 4Heat a fry-pan with Oil , add Onions etc 5.Cover & let it sit for a few minutes before serving. MESSAGE METHOD OBJECT KIIT CSE/IT (OOSD)

5. OBJECT RESPONDS TO MESSAGES contd…. In other words, message is the instruction and the method is the implementation. Objects respond to messages according to methods in its class. Brake Car Object ………………………………….…… * 7 ………………………………….…… 5 Object KIIT CSE/IT (OOSD)

5. OBJECT RESPONDS TO MESSAGES contd…. A message has a name, just like a method, such as cost, set cost, cooking time. An object understands a message when it can match the message to a method that has a same name as the message. A message differs from a function in that a function says “how to do something” and a message says “what to do”. KIIT CSE/IT (OOSD)

Some more O-O Concepts Encapsulation & Information hiding. Class Hierarchy Single Inheritance Multiple Inheritance Multilevel Inheritance Dynamic Inheritance: Allows objects to change and evolve over time. It refers to the ability to add, delete, or change parents from objects(or Classes) at run time. Eg: Window object changing to an icon and a Vice versa. Polymorphism KIIT CSE/IT (OOSD)

6. OBJECT RELATIONSHIP AND ASSOCIATIONS ASSOCIATIONS represents the relationships between objects and classes. Cardinality specifies how many instances may relate to a single instance of an associated class. Eg: one or many, one to many etc Multiplicity value (i.e the number of objects that participate in the association) Can fly Flown by PILOT AIRPLANES KIIT CSE/IT (OOSD)

KIIT CSE/IT (OOSD)

6. OBJECT RELATIONSHIP AND ASSOCIATIONS contd…. Notations associated in an association: Eg: KIIT CSE/IT (OOSD)

7. CONSUMER-PRODUCER ASSOCIATION It is a special form of association also known as client-server association or use relationship. It is viewed as one-way interaction. Request for printing PrintServer Item PRODUCER provides service CONSUMER object requests service KIIT CSE/IT (OOSD)

8. AGGREGATION AND OBJECT CONTAINMENT Some objects may be composed of and may contain other objects. Since each object has an identity, one object can refer to other objects. This is known as AGGREGATION, where an attribute can be an object itself. Eg: A car object is an aggregation of engine, seat, wheels, and other objects. KIIT CSE/IT (OOSD)

8. AGGREGATION AND OBJECT CONTAINMENT contd…. Fig:A car object showing aggregation. Car Engine Seat Wheel KIIT CSE/IT (OOSD)

CASE STUDY Do Self Study of A PAY ROLL PROGRAM of both Structured Approach and O-O Approach. KIIT CSE/IT (OOSD)

SUMMARY AN OBJECT ORIENTED PHILOSOPHY OBJECTS its methods & attributes. CLASSES OBJECT RESPONDS TO MESSAGES DIFFERENCE B/W A MESSAGE & METHOD OBJECT RELATIONSHIP AND ASSOCIATIONS CONSUMER-PRODUCER ASSOCIATION AGGREGATION AND OBJECT CONTAINMENT KIIT CSE/IT (OOSD)