Object Oriented Programming Principles Lecturer: Kalamullah Ramli Electrical Engineering Dept. University of Indonesia Session-3.

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

4. Object-Oriented Programming Procedural programming Structs and objects Object-oriented programming Concepts and terminology Related keywords.
Department of Computer Engineering Faculty of Engineering, Prince of Songkla University 1 5 – Abstract Data Types.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
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.
BITS Pilani Avinash Gautam Department of Computer Science and Information Systems.
OBJECT ORIENTED PROGRAMMING M Taimoor Khan
Fall 2006AE6382 Design Computing1 Object Oriented Programming in Matlab Intro to Object- Oriented Programming (OOP) An example that creates a ASSET class.
Classes & Objects Computer Science I Last updated 9/30/10.
Object-Oriented Analysis and Design
Chapter 1 Object-Oriented System Development
Object Oriented System Development with VB .NET
Basic OOP Concepts and Terms
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.
Object-oriented Programming Concepts
Chapter 1 Principles of Programming and Software Engineering.
1 Introduction to C++ Programming Concept Basic C++ C++ Extension from C.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
OBJECT ORIENTED PROGRAMMING IN C++ LECTURE
1 INTRODUCTION TO OOP Objective: Know the difference between functional programming and OOP Know basic terminology in OOP Know the importance of OOP Know.
CSCI-383 Object-Oriented Programming & Design Lecture 15.
UML and Object Oriented Concepts
BACS 287 Basics of Object-Oriented Programming 1.
Programming Paradigms Imperative programming Functional programming Logic programming Event-driven programming Object-oriented programming A programming.
Introduction To System Analysis and design
Copyright © 2002, Systems and Computer Engineering, Carleton University Intro.ppt * Object-Oriented Software Development Unit 1 Course.
Introduction to Object-oriented programming and software development Lecture 1.
Objects and Components. The adaptive organization The competitive environment of businesses continuously changing, and the pace of that change is increasing.
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.
Object-Oriented Programming (OOP) CSC-2071 (3+1=4 Credits) Lecture No. 1 MBY.
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.
1 Systems Analysis and Design in a Changing World, Thursday, January 18, 2007.
OBJECT-ORIENTED PROGRAMMING (OOP) WITH C++ Instructor: Dr. Hany H. Ammar Dept. of Electrical and Computer Engineering, WVU.
Basic OOP Concepts and Terms. In this class, we will cover: Objects and examples of different object types Classes and how they relate to objects Object.
CSC241 Object-Oriented Programming (OOP) Lecture No. 1.
1 Programming Paradigms Object Orientated Programming Paradigm (OOP)
CS 3050 Object-Oriented Analysis and Design. Objectives What is “Object-Oriented?” Object-Oriented Approach Vs. Structured Approach How Has the Object-Oriented.
Programming Paradigms Lecturer Hamza Azeem. What is PP ? Revision of Programming concepts learned in CPLB Learning how to perform “Object-Oriented Programming”
Lecture 2 Intro. To Software Engineering and Object-Oriented Programming (1/2)
1 CMIS301 O-O Thinking Understanding O-O Programming by T Budd.
Salman Marvasti Sharif University of Technology Winter 2015.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
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.
Basic Concepts of OOP.  Object-Oriented Programming (OOP) is a type of programming added to php5 that makes building complex, modular and reusable web.
OOPS CONCEPT.  OOPS  Benefits of OOPs  OOPs Principles  Class  Object Objectives.
Lecture 2 Intro. To Software Engineering and Object-Oriented Programming (2/2)
Object-Oriented Paradigm (OOP) Course Code: SE 101 Lecture No. 1.
Industrial Group Project Introduction to Object Oriented Programming Adelina Basholli, February, 2016.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
Object Oriented Programming in Java Habib Rostami Lecture 2.
Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their.
Principles of Programming & Software Engineering
Object-Oriented Programming
Programming paradigms
What is an Object Objects are key to understanding object-oriented technology. An object can be considered a "thing" that can perform a set of related.
Object Oriented Programming
JAVA By Waqas.
Principles of Programming and Software Engineering
OOP What is problem? Solution? OOP
PRINCIPALES OF OBJECT ORIENTED PROGRAMMING
Advanced Programming Behnam Hatami Fall 2017.
Workshop for Programming And Systems Management Teachers
Basic OOP Concepts and Terms
Object-Oriented Programming
Agenda Software development (SD) & Software development methodologies (SDM) Orthogonal views of the software OOSD Methodology Why an Object Orientation?
Presentation transcript:

Object Oriented Programming Principles Lecturer: Kalamullah Ramli Electrical Engineering Dept. University of Indonesia Session-3

Slide - 2 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng Object-Oriented Programming: A New Programming Paradigm…  What is Matlab's programming paradigm?  Matlab is procedural: the focus is on the functions (procedures)  What is the programming paradigm in OOP?  As the name suggests, in OOP the focus is on  OBJECTS  This doesn't say much unless we understand what we mean with the term Object… So let's move on.

Slide - 3 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng Objects Combine Properties & Behavior [1/2]  Remember following Structures:  person.firstname = 'John';  person.lastname = 'Leonard';  person.address1 = '803 Shallowford Lane';  person.city = 'Peachtree City';  person.state = 'GA';  person.zip = ' ';  A structure contains data in an organized fashion.

Slide - 4 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng Objects Combine Properties & Behavior [2/2]  If we add functions or methods to a structure, it becomes an object:  person.print_address();  person.set_lastName('Paredis');

Slide - 5 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng More Examples of Objects [1/2]  Car:  Properties: color, speed, fuel consumption, HP…  Behaviors: start, stop, turning, …  Triangle:  Properties: area, perimeter, linestyle, location,…  Behaviors: translate, rotate, shrink, flip,…  Date:  Properties: year, month, day, …  Behaviors: setDate, getMonth, isGreater, …

Slide - 6 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng More Examples of Objects [1/2]  Properties: information about the object  Behaviors: methods to set, get and process properties  Combining properties and behaviors in objects is called  Encapsulation

Slide - 7 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng Objects Combine Properties and Behavior: So What? Why should we care? [1/2]  Black Box Philosophy:  Objects perform computation by making requests of each other through the passing of messages  The only way to interact with an object is through its methods! Messages Code Data

Slide - 8 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng Objects Combine Properties and Behavior: So What? Why should we care? [2/2]  This is called Information Hiding  (the data is hidden from the user)  The collection of all methods is called the interface of the object

Slide - 9 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng Encapsulation and Data Hiding [1/2]  Properties (Variables)  Speed  RPM  Current Gear  Methods (Functions)  Braking  Acceleration  Turn  Changing Gears

Slide - 10 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng Encapsulation and Data Hiding [2/2]  These methods are independent of how the bicycle has been built (hides the implementation)  You can control access to members of an object

Slide - 11 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng Working with Objects: Messages [1/2]  Objects perform computation by making requests of each other through the passing of messages  Parts of a message –  The object to which the message is addressed  The name of the method to perform  Any parameters needed by the method\

Slide - 12 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng Working with Objects: Messages [2/2]  Different objects may respond differently to an identical message:  bicycle.changeGears(lowerGear)  car.changeGears(lowerGear)  The same name and the same argument, but a different method = POLYMORPHISM  A method is defined only in the scope of a particular type of object, called class  Polymorphism is also called: function overloading

Slide - 13 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng Class and Object [1/2]  Now that we know what an object is all about, let's look at how we can organize these objects  Class = A blueprint, or prototype, that defines the variables and the methods common to all objects of a certain kind Objects are individual instances of a class

Slide - 14 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng Class and Object [2/2]  House Plans:  the architectural drawings that describe how a house is to be constructed  A House:  The house built from the plans is an instance of the House Class. The process of building the house is called Instantiation

Slide - 15 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng Organizing Objects: Inheritance [1/2] Super class (parent) Sub class (child) Children inherit properties behaviors

Slide - 16 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng Organizing Objects: Inheritance [2/2]  Sub class (Child) A class that is derived from a particular class, perhaps with one or more classes in between  Super class (Parent) A class from which a particular class is derived, perhaps with one or more classes in between  Inheritance promotes  Reuse of code  Better Management of code

Slide - 17 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng Abstraction in OOP [1/2]  Abstractions reveal causes and effects, expose patterns and frameworks and separate what's important from what's not  Abstraction in programming helps you make your ideas concrete in your code without obscuring the architecture with details  In procedural languages:  structures and functions are abstractions

Slide - 18 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng Abstraction in OOP [2/2] OOP takes abstraction one step further through:  encapsulation  data hiding  polymorphism  Inheritance

Slide - 19 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng Object-Oriented Programming [1/2]  A Quick Review:  “OOP is more a way of thinking than just a programming technique” – “conceptual tool that you use in thinking how to solve a problem”  Computer objects form the basis  Objects treated as real life objects  Identities  Properties  Behaviors  Data and functionality encapsulated in an object  Data hidden behind methods

Slide - 20 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng Object-Oriented Programming [2/2]  Objects organized in class hierarchies: inheritance  Objects interact through messages – methods  Polymorphism: the same message has a different meaning for different objects

Slide - 21 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng Benefits of Object Oriented Programming  Analysis and Design made easier  Understanding of code made easier  Code Reuse  Ease of maintenance and enhancement  Simplifies collaboration  Fewer and shorter design iterations

Slide - 22 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng Examples of Programming Languages  Procedural languages  C  FORTRAN  BASIC  Pascal  Object Oriented languages  C++  Smalltalk  Java

Slide - 23 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng Assignment#2a: OOP vs Procedural Programming  Object-Oriented      Procedural     Due date: Friday, February 27 th, 2004

Slide - 24 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng Assignment#2b: Object Oriented Philosophy  “Simulate the functionality of your computer using the object oriented philosophy”  Draw a diagram of the components present in the computer. What is the flow of information between these components? Leverage from previous lectures.  Identify the classes and objects that you would need to simulate these components. How do these classes interact?  Identify the variables and methods that you would assign to each class. Due Date: Friday, March 5 th, 2004

Slide - 25 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng References and Additional Reading  “Object Oriented Programming, ” tml  “Core Java, ” Cay S. Horstmann and Gary Cornell, Sun Microsystems  “ Thinking in C++, ” Bruce Eckel, PP2e.html  “ Introduction to Object Oriented Programming, ” Timothy Budd, ftp://ftp.cs.orst.edu/pub/budd/oopintro/3rdEdition /info.html

Slide - 26 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng Closure  Learning  Object oriented programming is more a philosophy than mere technique to develop programs…  This philosophy provides modularity to programs  Modularity provides openness to change…  Enables developing complex systems  Food for Thought  How will object oriented philosophy help in the future of software development?  How can the object oriented philosophy based on modularity be used in your field of specialization?  What changes are required to adapt this philosophy to your field?

Slide - 27 OOP Lecture 2004 Dr. –Ing. Ir. Kalamullah Ramli, M.Eng The End QUESTIONS & COMMENTS ?