Object Oriented Intro. Objectives Why Object-Oriented? Real-World Object/Programmed Objects? What we want in objects? Object Relationships?

Slides:



Advertisements
Similar presentations
4. Object-Oriented Programming Procedural programming Structs and objects Object-oriented programming Concepts and terminology Related keywords.
Advertisements

Department of Computer Engineering Faculty of Engineering, Prince of Songkla University 1 5 – Abstract Data Types.
CS324e - Elements of Graphics and Visualization A Little Java A Little Python.
Unified Modeling Language
Introduction to Object Oriented Programming Java.
Ch 12: Object-Oriented Analysis
Object Oriented Design An object combines data and operations on that data (object is an instance of class) data: class variables operations: methods Three.
2-1 © Prentice Hall, 2007 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
CS-2135 Object Oriented Programming
CS 117 Spring 2002 What's Next. Files How to get data from a file instead of the keyboard How to save data to a file You know most of this from using.
Guide To UNIX Using Linux Third Edition
© The McGraw-Hill Companies, 2006 Chapter 7 Implementing classes.
INTRODUCTION TO JAVA PROGRAMMING Chapter 1. What is Computer Programming?
C++ fundamentals.
BACS 287 Basics of Object-Oriented Programming 1.
Object Oriented Programming
Intro to CS – Honors I Programming Basics GEORGIOS PORTOKALIDIS
Object Oriented Software Development
Expressions, Data Conversion, and Input
Introduction to Object Oriented Design. Topics Designing Your Own Classes Attributes and Behaviors Class Diagrams.
Programming Languages and Paradigms Object-Oriented Programming.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Object Orientation An Object oriented approach views systems and programs as a collection of interacting objects. An object is a thing in a computer system.
Introduction to Object-oriented programming and software development Lecture 1.
Module 7: Object-Oriented Programming in Visual Basic .NET
An Object-Oriented Approach to Programming Logic and Design
OBJECT ORIENTED PROGRAMMING CONCEPTS ISC 560. Object-oriented Concepts  Objects – things names with nouns  Classes – classifications (groups) of similar.
Object Oriented Programming Key Features of OO Approach Data encapsulation –data and methods are contained in a single unit, object –promotes internal.
1 Java Inheritance. 2 Inheritance On the surface, inheritance is a code re-use issue. –we can extend code that is already written in a manageable manner.
Features of Object Oriented Programming Lec.4. ABSTRACTION AND ENCAPSULATION Computer programs can be very complex, perhaps the most complicated artifact.
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
OOP IN PHP `Object Oriented Programming in any language is the use of objects to represent functional parts of an application and real life entities. For.
Encapsulation, Inheritance & Polymorphism. OOP Properties Encapsulation ­The process of creating programs so that information within a class is not accessible.
Advanced Object- Oriented Programming Programming Right from the Start with Visual Basic.NET 1/e 14.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
Simple Classes. ADTs A specification for a real world data item –defines types and valid ranges –defines valid operations on the data. Specification is.
Object Oriented Analysis and Design Class and Object Diagrams.
Learners Support Publications Object Oriented Programming.
Lecture 2 Intro. To Software Engineering and Object-Oriented Programming (1/2)
Test 2 Review. General Info. All tests are comprehensive. You are still responsible for the material covered prior to the first exam. You will be tested.
Data Design and Implementation. Definitions Atomic or primitive type A data type whose elements are single, non-decomposable data items Composite type.
Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.
CS Data Structures I Chapter 2 Principles of Programming & Software Engineering.
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  The fundamental idea behind object-oriented programming is:  The real world consists of objects. Computer programs.
© 2004 Pearson Addison-Wesley. All rights reserved January 23, 2006 Creating Objects & String Class ComS 207: Programming I (in Java) Iowa State University,
1 C++ Classes & Object Oriented Programming Overview & Terminology.
Lecture 2 Intro. To Software Engineering and Object-Oriented Programming (1/2)
CPRG 215 Introduction to Object-Oriented Programming with Java Module 3- Introduction to Object Oriented Programming concepts Topic 3.1 Fundamental Concepts.
Programming paradigms
The Object-Oriented Thought Process Chapter 1
OOP What is problem? Solution? OOP
Creating Objects & String Class
Object-Oriented Programming
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
Object Oriented Concepts
Computer Programming.
Chapter 10 Thinking in Objects
Object-oriented Design in Processing
Object-Oriented Programming
Object-oriented Design in Processing
CIS601: Object-Oriented Programming in C++
Introduction to Data Structure
The Object-Oriented Thought Process, Chapter 1
Introduction to Object-Oriented Programming
What Is Good Software(Program)?
Object-oriented Design in Processing
Object-oriented Design in Processing
Unit 2 – Section 1 “Solving One-Step Equations”
Presentation transcript:

Object Oriented Intro

Objectives Why Object-Oriented? Real-World Object/Programmed Objects? What we want in objects? Object Relationships?

The Data Type Problem Program Data Types double float String int long Problem Space Account Vehicle Student Branch Employee

The Data Type Problem w O-O Program Data Types Account Vehicle Student Branch Employee Problem Space Account Vehicle Student Branch Employee

What is an Object. An object has state. An object has behaviour. An object can be created. An object can be destroyed. Some objects are similar to other objects. Objects even when similar often differ in details. Objects interact with other objects.

What is an Programmed Object. Can represent both state and behaviour in one program element. Program element should be able to specify an inheritance relationship. You use variable/type declarations or references to represent the state of an object. You use methods to represent the behaviour of an object.

Example:Robot Simulation State. A robot simulation would retain information of where it is located on a grid. Behaviour. A robot simulation would have the capability to move() or perhaps perform actions like pickup() objects.

What is an Object-Oriented System. A set of interacting objects responding to an environment.

Problem-Solving the O-O Way. Encapsulation. Bundling of state information and behaviour. It is possible (and desirable) to hide the state information from all other elements of the program. Inheritance Ability to define one class of objects in terms of another class of objects (Class X is a special case of Class Y). element should be able to specify an inheritance relationship. Polymorphism. Allows you to treat different classes of objects in a similar manner to simplify programming.

Encapsulation double x; State: Exponent Exponent Sign Fraction Fraction Sign Behaviour: Addition Subtraction Division Multiplication Instantiation Activities Destruction Activities.

Encapsulation A Key benefit of the object-oriented approach. By hiding internal data of an object from the rest of the program (system) you make it less likely that a statement will accidentally change the data incorrectly. By associating data with only one program element, it means you will not have to search as many lines of code for debugging.

Encapsulation accountNo balance getAccountNo () setBalance () getBalance () setAccountNo() User

Inheritance Specification of an is-a relationship. A car is-a type of vehicle. A salaried employee is-a type of employee. A keyboard is-a type of device. Allows us to separate out elements that are similar between different classes of objects from those that are specific to individual classes.

Composition Specification of an has-a relationship. A car has-a engine. A salaried employee has-a payment history. A pc has-a keyboard. Allows us to compose new classes out of existing classes.

Other relationships. There are other relationships (association) but these will be covered later.

Questions. Name one capability in problem-solving allowed with object-oriented programs that is not available in traditional languages? Give a simple definition of an object-oriented system? What is the purpose of encapsulation? What are the benefits of encapsulation?