CISC 110 Day 4 Object-oriented Programming (OOP).

Slides:



Advertisements
Similar presentations
Object-Oriented Programming Python. OO Paradigm - Review Three Characteristics of OO Languages –Inheritance It isn’t necessary to build every class from.
Advertisements

Department of Computer Engineering Faculty of Engineering, Prince of Songkla University 1 5 – Abstract Data Types.
1 l Inheritance Basics l Programming with Inheritance l Dynamic Binding and Polymorphism Inheritance.
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.
Object–Orientated Design. OOP Design Describe the following: a computer a university Usually the most natural way to describe a task is to list the entities.
PACS – 10/19/131 Object-Oriented Programming “Object-oriented programming opens the door to cleaner designs, easier maintenance, and greater code reuseability.”
Stéphane Ducasse2.1 OOP? What is OOP? Why? OOP in a nutshell.
More about classes and objects Classes in Visual Basic.NET.
Object-Oriented PHP (1)
L3-1-S1 OO Concepts © M.E. Fayad SJSU -- CMPE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room.
1 SWE Introduction to Software Engineering Lecture 23 – Architectural Design (Chapter 13)
OBJECT ORIENTED ANALYSIS & DESIGN Vassilka Kirova Department of Computer & Information Science NJIT.
OBJECT ORIENTED ANALYSIS & DESIGN Vassilka Kirova Department of Computer & Information Science NJIT.
C# Programming: From Problem Analysis to Program Design1 Advanced Object-Oriented Programming Features C# Programming: From Problem Analysis to Program.
Vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie Themes and Variations abstraction -- the object metaphor modeling -- understanding.
1 Flash Actionscript Actionscript and Objects. 2 Actionscript and Objects ActionScript is what's known as an object-oriented programming language. Object-oriented.
1 Introduction to C++ Programming Concept Basic C++ C++ Extension from C.
Modelling classes Drawing a Class Diagram. Class diagram First pick the classes –Choose relevant nouns, which have attributes and operations. Find the.
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.
Abstract data types What does ‘ abstract ’ mean? From Latin: to ‘ pull out ’— the essentials –To defer or hide the details –Abstraction emphasizes essentials.
MovieClips & Properties Flash ActionScript Introduction to Thomas Lövgren
BACS 287 Basics of Object-Oriented Programming 1.
CPT 140 Programming Constructs1 OBJECT ORIENTED TECHNOLOGY Terminology and Basic Concepts.
OOP (Object Oriented Programming with AS3) Flash ActionScript 3.0 Introduction to Thomas Lövgren, Flash developer Introduction.
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.
MT311 Java Application Development and Programming Languages Li Tak Sing( 李德成 )
OBJECT ORIENTED PROGRAMMING CONCEPTS ISC 560. Object-oriented Concepts  Objects – things names with nouns  Classes – classifications (groups) of similar.
The Software Development Life Cycle: An Overview Presented by Maxwell Drew and Dan Kaiser Southwest State University Computer Science Program.
Chapter 2: Objects and Primitive Data Classes and Objects String, Random, Math, NumberFormat, DecimalFormat and Wrapper Classes.
Chapter 11 Introduction to Classes Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg.
 Computer Science 1MD3 Introduction to Programming Michael Liut Ming Quan Fu Brandon.
School of Computer Science & Information Technology G6DICP - Lecture 22 The Theory of Object Oriented Programming.
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
CSCI-383 Object-Oriented Programming & Design Lecture 13.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Chapter 8 Objects and Classes.
OBJECT-ORIENTED PROGRAMMING (OOP) WITH C++ Instructor: Dr. Hany H. Ammar Dept. of Electrical and Computer Engineering, WVU.
ITEC 3220A Using and Designing Database Systems Instructor: Prof Z. Yang Course Website: 3220a.htm
Programming Paradigms Lecturer Hamza Azeem. What is PP ? Revision of Programming concepts learned in CPLB Learning how to perform “Object-Oriented Programming”
 Computer Science 1MD3 Introduction to Programming Michael Liut Ming Quan Fu Brandon.
Object-Oriented Programming. Objectives Distinguish between object-oriented and procedure-oriented design. Define the terms class and object. Distinguish.
© 2007 Lawrenceville Press Slide 1 Chapter 8 Objects  A variable of a data type that is a class. Also called an instance of a class.  Stores data  Can.
OOP Review CS 124.
Object-Oriented Programming (OOP) What we did was: (Procedural Programming) a logical procedure that takes input data, processes it, and produces output.
Session 06: C# OOP-3 Inheritance and Polymorphism. Static and dynamic type of an object. FEN AK - IT: Softwarekonstruktion.
1 CSE Programming in C++. 2 Overview Sign roster list Syllabus and Course Policies Introduction to C++ About Lab 1 Fill Questionnaire.
Basic Concepts of OOP.  Object-Oriented Programming (OOP) is a type of programming added to php5 that makes building complex, modular and reusable web.
Introduction to Objects and Encapsulation Computer Science 4 Mr. Gerb Reference: Objective: Understand Encapsulation and abstract data types.
An Introduction to Programming with C++ Fifth Edition Chapter 14 Classes and Objects.
OOP in C# - part 1 OOP in C#: –Object Interaction. –Inheritance and Polymorphism (next module). FEN 20121UCN Technology: Computer Science.
Chapter 12: Support for Object- Oriented Programming Lecture # 18.
Geoff Holmes and Bernhard Pfahringer COMP206-08S General Programming 2.
Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their.
Inheritance Chapter 7 Inheritance Basics Programming with Inheritance
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING
Microsoft Visual Basic 2005: Reloaded Second Edition
Introduction to Object-oriented Program Design
Inheritance Chapter 7 Inheritance Basics Programming with Inheritance
Inheritance Often, software encapsulates multiple concepts for which some attributes/behaviors overlap E.g. A computer (role-playing) game has: Monsters:
Object-oriented programming
Inheritance Basics Programming with Inheritance
Teach A-Level Computer Science: Object-Oriented Programming in Python
Computer Programming with JAVA
Inheritance Chapter 7 Inheritance Basics Programming with Inheritance
Review of Previous Lesson
Ch. 1 Vocabulary Alice.
Chapter 20 Object-Oriented Concepts and Principles
Presentation transcript:

CISC 110 Day 4 Object-oriented Programming (OOP)

Outline Typecasting (continued from last day) Introduction to OOP Classes Setting properties Using methods Applying methods to Objects Parameters to provide options 2

Typecasting Typecasting is the process of converting a value of one data type into a value of another data type. Example: var i:int = 100; var s:String = String(i); trace(s); Output: 100 3

Object-oriented Programming Object-oriented Programming (OOP) is a programming paradigm that uses variables called objects to manipulate other objects. Related Terms: -Information hiding -Data abstraction -Encapsulation -Modularity -Polymorphism -Inheritance 4

Library System Example Tasks: Borrow a book Return a book Search book lists by title, author or subject Issue new library card Check library card for books borrowed Obtain address of library card owner Add a new book to library Remove an old book Add a new employee to library staff Remove an employee (they’ve left for a job in computing science) 5

Library System Example Main Objects: Book Borrow Return Add new book Remove old book Search book list Employee Add a new employee to library staff Remove an employee Card Holder Issue new card Check for books borrowed Obtain address 6

OO Terminology Objects: Data items manipulated by a computer program e.g. an MP3 Player Methods: Operations performed by (or on) an object e.g. pause Attributes: Characteristics that describe the state of an object (properties) e.g. the song now playing 7

OO Terminology Class –A template that describes the methods and attributes of a group of objects e.g. description of iPod nanos –The group of all objects that fit that description, each of which is an instance of the class e.g. the group of all the 321,520,001 iPod nanos in the world 8

Hierarchy of Classes Generic MP3 Player Class Microsoft Zune Class iPod nano Class SanDisk Sansa Fuze Class ……… Sansa Fuze object instancesiPod nano object instancesZune object instances is a An iPod “is a” MP3 Player 9

OO Terminology Inheritance: A subclass can “inherit” the characteristics and capabilities of a class above it in the hierarchy without redefining them, so that their common properties only need to be defined once. e.g. Generic CD class common methods: ‘play’,‘pause’, etc. e.g. Sansa Fuze extra method: ‘shuffle’ 10

Creating Object Instances with a Constructor Method Example: var myCircle: MovieClip;// Creates a variable of type MovieClip myCircle = new MovieClip( );// Creates an instance of MovieClip General Syntax: var : ; = new ( ); 11

Constructor Methods Every class for creating objects has a constructor method. The constructor method sets the initial values of the attributes of the new object. 12

Some MovieClip Properties width height x y Width of a MovieClip Height of a MovieClip x-coordinate position of a MovieClip y-coordinate position of a MovieClip 13

Some MovieClip Methods play() stop() nextFrame() goToAndPlay(x) goToAndStop(x) Tells playhead to play a MovieClip’s timeline from its current frame location Tells playhead to stop at a frame in a MovieClip’s timeline Tells playhead to advance to the next frame and stop in a MovieClip’s timeline Tells MovieClip to move the playhead and play from a specific frame on its timeline Tells MovieClip to move the playhead and stop at a specific frame on its timeline 14

Syntax for Setting a Property myCircle.height = 20; semi-colon object’s property assignment property variable name operator (=) value name period 15

Syntax for Calling a Method myCircle.play( ); semi-colon object’s method parentheses variable name (may be parameters) name period 16

Setting Attributes and Using Methods Examples: myCircle.x = 40; parameter myCircle.height = 30; myCircle.goToAndPlay( 10 ); Parameters provide options, so a method can do variations of an operation, not always the same thing. 17