Object Oriented Programming in Java Habib Rostami Lecture 2.

Slides:



Advertisements
Similar presentations
By Waqas Over the many years the people have studied software-development approaches to figure out which approaches are quickest, cheapest, most.
Advertisements

OO Programming in Java Objectives for today: Overriding the toString() method Polymorphism & Dynamic Binding Interfaces Packages and Class Path.
General OO Concepts Objectives For Today: Discuss the benefits of OO Programming Inheritance and Aggregation Abstract Classes Encapsulation Introduce Visual.
Department of Computer Engineering Faculty of Engineering, Prince of Songkla University 1 5 – Abstract Data Types.
Computer Science Dept. Fall 2003 Object models Object models describe the system in terms of object classes An object class is an abstraction over a set.
BITS Pilani Avinash Gautam Department of Computer Science and Information Systems.
Inheritance Java permits you to use your user defined classes to create programs using inheritance.
1 Object-Oriented Programming Concepts. 2 Recap from last lecture Variables and types –int count Assignments –count = 55 Arithmetic expressions –result.
ITEC200 – Week03 Inheritance and Class Hierarchies.
Object-Oriented Metrics. Characteristics of OO ● Localization ● Encapsulation ● Information hiding ● Inheritence ● Object abstraction.
1 SWE Introduction to Software Engineering Lecture 23 – Architectural Design (Chapter 13)
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;
Introduction to Object-Oriented Programming (OOP)
Stéphane Ducasse6.1 Essential Concepts Why OO? What is OO? What are the benefits? What are the KEY concepts? Basis for all the lectures.
The Object Oriented Programming Languages (OOPL). Done by: Tayeb El Alaoui Supervised by: Dr Driss Kettani.
1 Introduction to CS Agenda Syllabus Schedule Lecture: the management of complexity.
Object-oriented Programming Concepts
Vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie Themes and Variations abstraction -- the object metaphor modeling -- understanding.
1 COMP 144 Programming Language Concepts Felix Hernandez-Campos Lecture 22: Object-Oriented Programming COMP 144 Programming Language Concepts Spring 2002.
Lecture 13: Object- Oriented Concepts Anita S. Malik Adapted from Schach (2004) Chapter 7.
Object Oriented Concepts. Movement toward Objects Instead of data-oriented or process-oriented Analysis, many firms are now moving to object-oriented.
Object-oriented design CS 345 September 20,2002. Unavoidable Complexity Many software systems are very complex: –Many developers –Ongoing lifespan –Large.
Chapter 7 - Generalization/Specialization and Inheritance1 Chapter 7 Generalization/Specialization and Inheritance.
Introduction to Object-oriented Programming Introduction to Object-oriented Programming CMPS 2143.
BACS 287 Basics of Object-Oriented Programming 1.
1 Pertemuan 6 Object Oriented Programming Matakuliah: T0053/Web Programming Tahun: 2006 Versi: 2.
Comparison of OO Programming Languages © Jason Voegele, 2003.
Inheritance using Java
Object-Oriented Programming Concepts
Introduction to Object-oriented programming and software development Lecture 1.
MT311 Java Application Development and Programming Languages Li Tak Sing( 李德成 )
OOPs Object oriented programming. Based on ADT principles  Representation of type and operations in a single unit  Available for other units to create.
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
Object Oriented Design and Programming Alan Goude Room: Sheaf 9323.
Recap (önemli noktaları yinelemek) from last week Paradigm Kay’s Description Intro to Objects Messages / Interconnections Information Hiding Classes Inheritance.
Unified Modeling Language, Version 2.0
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.
CS200 Algorithms and Data StructuresColorado State University Part 4. Advanced Java Topics Instructor: Sangmi Pallickara
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.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 24P. 1Winter Quarter C++ Lecture 24.
Object Oriented Programming Principles Lecturer: Kalamullah Ramli Electrical Engineering Dept. University of Indonesia Session-3.
Chapter 12 Support for Object oriented Programming.
1 Programming Paradigms Object Orientated Programming Paradigm (OOP)
Lecture 12 March 16, The Scope of a Variable What if there are two variables with the same name? –A local or block-local variable can have the same.
CSC 131 Fall 2006 Lecture # 6 Object-Oriented Concepts.
OBJECT ORIENTED AND FUNCTION ORIENTED DESIGN 1 Chapter 6.
 Objects versus Class  Three main concepts of OOP ◦ Encapsulation ◦ Inheritance ◦ Polymorphism  Method ◦ Parameterized ◦ Value-Returning.
OOPs Object oriented programming. Abstract data types  Representationof type and operations in a single unit  Available for other units to create variables.
1 Unified Modeling Language, Version 2.0 Chapter 2.
Object-Oriented Principals Dwight Deugo Nesa Matic
Lesson 1 1 LESSON 1 l Background information l Introduction to Java Introduction and a Taste of Java.
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
Object orientation and Packaging in Java Object Orientation and Packaging Introduction: After completing this chapter, you will be able to identify.
OOPS CONCEPT.  OOPS  Benefits of OOPs  OOPs Principles  Class  Object Objectives.
A Survey of Object-Oriented Concept Oscar Nierstrasz.
1 n Object Oriented Programming. 2 Introduction n procedure-oriented programming consists of writing a list of instructions and organizing these instructions.
ISBN Chapter 12 Support for Object-Oriented Programming.
1 THE OBJECT-ORIENTED TECHNOLOGY: An Executive Summary 서울대학교 컴퓨터공학부 Internet Database Lab 교수 김형주 Spring 2007.
Chapter 12: Support for Object- Oriented Programming Lecture # 18.
Slide 1 Unified Modeling Language, Version 2.0 Object-Oriented SAD.
Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their.
Object-Oriented Programming
Object-Oriented Design
JAVA By Waqas.
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
PRINCIPALES OF OBJECT ORIENTED PROGRAMMING
Types of Programming Languages
Object Oriented Analysis and Design
Object Oriented Analysis and Design
Presentation transcript:

Object Oriented Programming in Java Habib Rostami Lecture 2

Today’s Presentation  What is an Object?  What is a Class?  What is a Message?  Requirements of Object-Oriented language  Step by step explanation

What is an Object? An object is a software bundle of related variables and methods. Software objects are often used to model real-world objects you find in everyday life. Visual representation of a software object A bicycle modeled as a software object

Classification

What is a Class? A class is a blueprint or prototype that defines the variables and the methods common to all objects of a certain kind.  Class is an implementation of an abstract data type and so encapsulates both data and operations.  Object is run-time instance of class.  Classes just sit there, objects do the real work.  Memory is allocated for Objects not for Classes.

What is a Message? Software objects interact and communicate with each other using messages.  The object to which the message is addressed (YourBicycle)  The name of the method to perform (changeGears)  Any parameters needed by the method ( lowerGear )

To be object oriented, a language must support  Encapsulation  Inheritance  Dynamic Binding Some of the popular OO languages are C++ Smalltalk Java Eiffel FORTRAN90 CLOS(Common Lisp Object System) Ada95 Modula-3

Encapsulation: Packaging an object's variables within the protective custody of its methods is called encapsulation. Often, for practical reasons, an object may wish to expose some of its variables or hide some of its methods. Access Levels: SpecifierClassSubclassPackageWorld PrivateX ProtectedXXX PublicXXXX

What is Inheritance? A class inherits state and behavior from its superclass. Inheritance provides a powerful and natural mechanism for organizing and structuring software programs. Super Class Subclasses

Properties:  Each subclass inherits state (in the form of variable declarations) from the superclass.  Subclasses can add variables and methods to the ones they inherit from the superclass.  Subclasses can also override inherited methods and provide specialized implementations for those methods.  You are not limited to just one layer of inheritance. The inheritance tree, or class hierarchy, can be as deep as needed. Benefits:  Re-Usability Subclasses provide specialized behaviors from the basis of common elements provided by the superclass. Through the use of inheritance, programmers can reuse the code in the superclass many times.  Can define Abstract Classes Programmers can implement superclasses called abstract classes that define "generic" behaviors.

Dynamic Binding:  Dynamic binding occurs when the type of variable changes at run-time.  A common way for a variable to change its type is via assignment. Bike:= MoutainBike is safe MountainBike:=Bike is not safe MountainBike is declared to have all the features of Bike so the assignment does no harm.  A variable that starts life of the type Bike may be attached to any object that is a kind of Bike, including MountainBike,RacingBike,…  A variable that starts life of the type MountainBike can only be attached to MountainBike objects but does not include RacingBike or general Bike.

Next Lecture Object Orientation in Java