Fall 2006AE6382 Design Computing1 Object Oriented Programming in Matlab Intro to Object- Oriented Programming (OOP) An example that creates a ASSET class.

Slides:



Advertisements
Similar presentations
General OO Concepts Objectives For Today: Discuss the benefits of OO Programming Inheritance and Aggregation Abstract Classes Encapsulation Introduce Visual.
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.
OOP - Object Oriented Programming Object Oriented Programming is an approach to programming that was developed to make large programs easier to manage.
Systems Analysis and Design 8th Edition
OBJECT ORIENTED PROGRAMMING M Taimoor Khan
Object-Oriented Analysis and Design
Object-Oriented PHP (1)
Object Oriented System Development with VB .NET
Chapter 13: Object-Oriented Programming
Object Oriented Databases - Overview
1 Chapter 8 Objects and Classes. 2 Motivations After learning the preceding chapters, you are capable of solving many programming problems using selections,
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.
1.11 Introduction to OOP academy.zariba.com 1. Lecture Content 1.What is OOP and why use it? 2.Classes and objects 3.Static classes 4.Properties, fields.
CSCI-383 Object-Oriented Programming & Design Lecture 15.
BACS 287 Basics of Object-Oriented Programming 1.
CSCI N341: Client-Side Web Programming Copyright ©2004  Department of Computer & Information Science "Object-Oriented" JavaScript.
Introduction To System Analysis and design
Programming Languages and Paradigms Object-Oriented Programming.
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.
BCS 2143 Introduction to Object Oriented and Software Development.
An Object-Oriented Approach to Programming Logic and Design
Sadegh Aliakbary Sharif University of Technology Fall 2011.
Fall 2006AE6382 Design Computing1 OOP: Creating a Class More OOP concepts An example that creates a ASSET class and shows how it might be used Extend the.
Object-Oriented Programming (OOP) CSC-2071 (3+1=4 Credits) Lecture No. 1 MBY.
Chapter 6 Object-Oriented Java Script JavaScript, Third Edition.
Chapter 7 Objects and Classes 1 Fall 2012 CS2302: Programming Principles.
Object Oriented Programming Principles Lecturer: Kalamullah Ramli Electrical Engineering Dept. University of Indonesia Session-3.
Systems Analysis & Design 7 th Edition Chapter 5.
Object Oriented Database By Ashish Kaul References from Professor Lee’s presentations and the Web.
Programming Paradigms Lecturer Hamza Azeem. What is PP ? Revision of Programming concepts learned in CPLB Learning how to perform “Object-Oriented Programming”
CSCI-383 Object-Oriented Programming & Design Lecture 10.
: Maha Sabri Altememe Lecturer : Maha Sabri Altememe Lecture :1 1.
Data Structures Using C++ 2E
Salman Marvasti Sharif University of Technology Winter 2015.
Chapter 12 Support for Object-Oriented Programming.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 12 Object-Oriented Programming Starting Out with Games & Graphics.
OOP (Object Oriented Programming) Lecture 1. Why a new paradigm is needed? Complexity Five attributes of complex systems –Frequently, complexity takes.
OOP Review CS 124.
Chapter 5 System Modeling. What is System modeling? System modeling is the process of developing abstract models of a system, with each model presenting.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
OO in Context Lecture 13: Dolores Zage. Confused about OO Not alone, there is much confusion about OO many programs are claimed to be OO but are not really.
Computer Programming 2 Lecture 8: Object Oriented Programming Creating Classes & Objects Prepared & Presented by: Mahmoud Rafeek Alfarra MINISTRY OF EDUCATION.
Lecture 2: Review of Object Orientation. © Lethbridge/La ganière 2005 Chapter 2: Review of Object Orientation What is Object Orientation? Procedural.
Basic Concepts of OOP.  Object-Oriented Programming (OOP) is a type of programming added to php5 that makes building complex, modular and reusable web.
Object Oriented Programming. OOP  The fundamental idea behind object-oriented programming is:  The real world consists of objects. Computer programs.
Fall 2006AE6382 Design Computing1 OOP Programming in Matlab Review our ASSET class and study how it might be used as a parent for other classes Extend.
Chapter 2 Principles of Programming and Software Engineering.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
 Description of Inheritance  Base Class Object  Subclass, Subtype, and Substitutability  Forms of Inheritance  Modifiers and Inheritance  The Benefits.
PaintPictureBoxDemo Refers to the PaintPictureBoxDemo Visual Basic Program Included With The Lecture.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
CSCE 240 – Intro to Software Engineering Lecture 3.
ISBN Chapter 12 Support for Object-Oriented Programming.
CSCI 383 Object-Oriented Programming & Design Lecture 15 Martin van Bommel.
Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their.
CPRG 215 Introduction to Object-Oriented Programming with Java Module 3- Introduction to Object Oriented Programming concepts Topic 3.1 Fundamental Concepts.
OOP: Creating a Class Topics More OOP concepts
OOP - Object Oriented Programming
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.
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING
Concepts of Object Oriented Programming
Classes and OOP.
OBJECT ORIENTED PROGRAMMING overview
PRINCIPALES OF OBJECT ORIENTED PROGRAMMING
C++.
Support for Object-Oriented Programming
Object Oriented Programming(OOP)
Presentation transcript:

Fall 2006AE6382 Design Computing1 Object Oriented Programming in Matlab Intro to Object- Oriented Programming (OOP) An example that creates a ASSET class and shows how it might be used Extend the ASSET class to subclasses of STOCKS, BONDS and SAVINGS. Learning Objectives We’re now going to introduce you to some advanced computing concepts, and we’ll illustrate a simple application that creates a new data type called an ASSET with subtypes. Topics

Fall 2006AE6382 Design Computing2 Object-Oriented Programming Object-oriented programming has become a focus of computer science in recent years… –Simula67, SmallTalk, Objective C, C++ and Java are OOP languages –OOP is a key part of the first CS courses OOP keeps you from getting into certain kinds of treacherous problems and tends to foster more reliable coding practices –stimulates a modular coding approach –allows you to hide details from inadvertent alterations –lets you create a hierarchical code structure –But often leads to complex and confusing class libraries

Fall 2006AE6382 Design Computing3 What is OOP OOP is part of an on-going effort to add more discipline and organization to programming –it is incorporated to varying degrees in a number of languages –Matlab incorporates OOP While the basic OOP concept is simple, the practical execution can often seem lost in many details! The 4 fundamental OOP characteristics –Abstraction: refine away unimportant details and describe an object by only the data that is important to the task at hand. –Encapsulation: operations must be tightly associated with the data on which they can operate –Inheritance: a hierarchical structure can be effectively employed to describe data and the operations on it –Polymorphism: using the same name to refer to similar methods to handle different kinds of data

Fall 2006AE6382 Design Computing4 Matlab and OOP Matlab makes extensive use of OOP at all levels of its design and construction… –much of the basic user programming touches on parts of this but most is well-hidden (to retain the original power of the language) –but it is accessible to programmers when needed –see Chapter 33 in MM7 and Matlab>Programming>Classes & Objects in online help docs We’re going to go over only the very basics of OOP in Matlab –you can pursue more details on your own (in Matlab or Java…) –we’ll illustrate OOP concepts by examining how Matlab’s Handle Graphics can be used to extend its plotting and visualization capabilities.

Fall 2006AE6382 Design Computing5 What is an Object? Objects (physical or not) have properties and behaviors –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… –Employee:Properties = SSN, age, gender, … Behaviors = setName, getLastname, calcPay… Properties: information about the object Behaviors: methods to set, get and process properties

Fall 2006AE6382 Design Computing6 What is an Object - cont’d OOP lets us create: –a data type –along with the set of operations that can be performed on this data type –this helps us avoid using wrong operations on given data and getting meaningless results A Class: –description of the structure of the new data type (called fields) –the set of operations (called methods or functions) defined for this data type An Object: –a variable having a specific class –Matlab has certain built-in classes –but you can easily define your own

Fall 2006AE6382 Design Computing7 Examples Sometimes the differences between classes and objects gets confusing… Example 1: –House plans: the architectural drawings that describe how a house is to be constructed are a House Class –A house: the house built from the plans is an Object or an Instance of the House Class; the process of building the house is called Instantiation of the class. Note that by changing some of the dimensions (fields or properties), one can create a new house object from the same class (plans). Example 2: –Flowchart: provides the plans for a program (the Class) –Program: written from the flowchart is an instance of the class (an object)

Fall 2006AE6382 Design Computing8 Matlab’s Built-in Classes Matlab’s built-in classes: –others in additional Toolboxes You can define your own Matlab classes: –data structure (the fields) is a Matlab struct –methods (functions) are stored in special directory that is a subdirectory of a directory in the Matlab path –a constructor is a method that is used to create an object (an instance of a class) charNUMERICjava class cellfunction handle int8, uint8, int16, uint16, int32, uint32 singledouble sparse user class structure ARRAY

Fall 2006AE6382 Design Computing9 Summary… OOP will let us create an entirely new data types in Matlab –this is done by creating a class to define this data type –we must also create all the methods (functions) that can be used with this special data type –the internal details are hidden inside the class What could we do with this new class? –some engineering functions require use of special data sets and associated methods: this is a good application and you will find this in some of the toolboxes –we can define subclasses to create a data hierarchy –we’ll look further into this in the next lecture We’ll also look closely at operator overloading, especially for Matlab’s basic classes

Fall 2006AE6382 Design Computing10 Summary Action Items Review the lecture Consult the reference material Consider how this might be extended to other applications Learning Objectives OOP concepts Summary