 By the end of this lecture, you should …  Understand the three pillars of Object- Oriented Programming: Inheritance, Encapsulation and Polymorphism.

Slides:



Advertisements
Similar presentations
Understand and appreciate Object Oriented Programming (OOP) Objects are self-contained modules or subroutines that contain data as well as the functions.
Advertisements

When is Orientated Programming NOT? Mike Fitzpatrick.
Computers Are Your Future
Introducing Programming a general discussion. What is a Program? Sets of instructions that get the computer to do something Programs may be a few lines.
Programming Creating programs that run on your PC
1 Programming for Engineers in Python Autumn Lecture 5: Object Oriented Programming.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
CSCI N201: Programming Concepts Copyright ©2005  Department of Computer & Information Science Introducing Object-Oriented Programming (OOP)
1 INTRODUCTION TO OOP Objective: Know the difference between functional programming and OOP Know basic terminology in OOP Know the importance of OOP Know.
Programming Paradigms Imperative programming Functional programming Logic programming Event-driven programming Object-oriented programming A programming.
Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms.
CSCI N341: Client-Side Web Programming Copyright ©2004  Department of Computer & Information Science "Object-Oriented" JavaScript.
1 INTRODUCTION TO OOP Objective: Know the difference between functional programming and OOP Know basic terminology in OOP Know the importance of OOP Know.
Copyright ©2005  Department of Computer & Information Science Introducing Programming.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
Computers Are Your Future Tenth Edition Chapter 11: Programming Languages & Program Development Copyright © 2009 Pearson Education, Inc. Publishing as.
Programming Languages – Coding schemes used to write both systems and application software A programming language is an abstraction mechanism. It enables.
Program development & programming languages Chapter 13.
A First Program Using C#
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
Introduction to Object-oriented programming and software development Lecture 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 8: More About OOP and GUIs.
O BJECT O RIENTATION F UNDAMENTALS Prepared by: Gunjan Chhabra.
COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.
Introducing Computer Science & Algorithms. Goals By the end of this lecture you should … … understand Computer Science as the study of algorithms … understand.
Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.
Programming Paradigms
BIT 1003 – Presentation 7. Contents GENERATIONS OF LANGUAGES COMPILERS AND INTERPRETERS VIRTUAL MACHINES OBJECT-ORIENTED PROGRAMMING SCRIPTING LANGUAGES.
Enhancing JavaScript Using Application Programming Interfaces (APIs)
JavaScript, Fourth Edition
Computer Concepts 2014 Chapter 12 Computer Programming.
Chapter 6 Object-Oriented Java Script JavaScript, Third Edition.
Computer Programs and Programming Languages What are low-level languages and high-level languages? High-level language Low-level language Machine-dependent.
Chapter 18 Object Database Management Systems. McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Outline Motivation for object.
Advanced Object- Oriented Programming Programming Right from the Start with Visual Basic.NET 1/e 14.
Systems Analysis & Design 7 th Edition Chapter 5.
 Programming Language  Object Oriented Programming  JAVA – An Introduction  JAVA Milestones  JAVA Features.
Principles of Software Development 1 Principles Of Software Design and Development Types of language / Choosing a language.
Module 4 Part 2 Introduction To Software Development : Programming & Languages Introduction To Software Development : Programming & Languages.
Definition of Object - Oriented Language.. Object-oriented programming (OOP) is a programming language model organized around "objects" rather than "actions"
1 Programming Paradigms Object Orientated Programming Paradigm (OOP)
Learners Support Publications Object Oriented Programming.
Programming Paradigms Lecturer Hamza Azeem. What is PP ? Revision of Programming concepts learned in CPLB Learning how to perform “Object-Oriented Programming”
1.
Chapter 4 Software. Chapter 4: Software Generations of Languages Each computer is wired to perform certain operations in response to an instruction. An.
ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Spring 2013 Lecture 1: Introduction.
Programming and Languages Dept. of Computer and Information Science IUPUI.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 27 I Love this Class.
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.
Chapter 18 Object Database Management Systems. Outline Motivation for object database management Object-oriented principles Architectures for object database.
Copyright ©2005  Department of Computer & Information Science Object Based JavaScript.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Software Design and Development Languages and Environments Computing Science.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
Object Oriented Programming in Java Habib Rostami Lecture 2.
Chapter 11: Abstract Data Types Lecture # 17. Chapter 11 Topics The Concept of Abstraction Advantages of Abstract Data Types Design Issues for Abstract.
Copyright ©2005  Department of Computer & Information Science Object Oriented Concepts.
Object Oriented Programming
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING
Basic 1960s It was designed to emphasize ease of use. Became widespread on microcomputers It is relatively simple. Will make it easier for people with.
The Movement To Objects
Chapter 8: More About OOP and GUIs
Sections Basic Concepts of Programming
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
INTRODUCTION TO OOP Objective:
PRINCIPALES OF OBJECT ORIENTED PROGRAMMING
Computer Programming.
Programming Language Basics
Presentation transcript:

 By the end of this lecture, you should …  Understand the three pillars of Object- Oriented Programming: Inheritance, Encapsulation and Polymorphism.  Understand what an object is.  Understand object attributes, methods and events.  Understand how programmers use APIs.

 Programming languages allow programmers to code software.  The three major families of languages are:  Machine languages  Assembly languages  High-Level languages

 Comprised of 1s and 0s  The “native” language of a computer  Difficult to program – one misplaced 1 or 0 will cause the program to fail.  Example of code:

 Assembly languages are a step towards easier programming.  Assembly languages are comprised of a set of elemental commands which are tied to a specific processor.  Assembly language code needs to be translated to machine language before the computer processes it.  Example: ADD ,

 High-level languages represent a giant leap towards easier programming.  The syntax of HL languages is similar to English.  Historically, we divide HL languages into two groups:  Procedural languages  Object-Oriented languages (OOP)

 Early high-level languages are typically called procedural languages.  Procedural languages are characterized by sequential sets of linear commands. The focus of such languages is on structure.  Examples include C, COBOL, Fortran, LISP, Perl, HTML, VBScript

 Most object-oriented languages are high- level languages.  The focus of OOP languages is not on structure, but on modeling data.  Programmers code using “blueprints” of data models called classes.  Examples of OOP languages include C++, Visual Basic.NET and Java.

 Object – Unique programming entity that has methods, has attributes and can react to events.  Method – Things which an object can do; the “verbs” of objects. In code, usually can be identified by an “action” word -- Hide, Show

 Attribute – Things which describe an object; the “adjectives” of objects. In code, usually can be identified by a “descriptive” word – Enabled, BackColor  Events – Forces external to an object to which that object can react. In code, usually attached to an event procedure

 Class – Provides a way to create new objects based on a “meta-definition” of an object (Example: The automobile class)  Constructors – Special methods used to create new instances of a class (Example: A Honda Civic is an instance of the automobile class.)

 Incorporation into a class of data & operations in one package  Data can only be accessed through that package  “Information Hiding”

 Allows programmers to create new classes based on an existing class  Methods and attributes from the parent class are inherited by the newly-created class  New methods and attributes can be created in the new class, but don’t affect the parent class’s definition

 Creating methods which describe the way to do some general function (Example: The “drive” method in the automobile class)  Polymorphic methods can adapt to specific types of objects.

 A class is a data type that allows programmers to create objects. A class provides a definition for an object, describing an object’s attributes (data) and methods (operations).  An object is an instance of a class. With one class, you can have as many objects as required.  This is analogous to a variable and a data type, the class is the data type and the object is the variable.

Class Cube Side As Real Volume As Real Subprogram SetSide(NewSide) Set Side = NewSide End Subprogram Subprogram ComputeVolume() Set Volume = Side ^ 3 End Subprogram Function GetVolume() As Real Set GetVolume = Volume End Function Function GetSide() As Real Set GetSide = Side End Function End Class The class Cube is similar to the definition of a record, but also has functions added that are part of the objects created. So we can think of it as an object ‘has’ data attributes and function attributes

Main Program Declare Cube1 As Cube Write “Enter a positive number:” Input Side1 Call Cube1.SetSide(Side1) Call Cube1.ComputeVolume Write “The volume of a cube of side ”, Cube1.GetSide Write “is ”, Cube1.GetVolume End Program

 Well, not really …  We call JavaScript an "object-inspired" language  It uses objects by way of supporting inheritance and encapsulation, but it doesn't really provide support for polymorphism.

 More like “Object-Inspired” JavaScript  We can create new, custom, re-usable objects in JavaScript that include their own methods, properties and events.  Consider the following problem: “I want to record the color, brand, horsepower and price of several cars.”

 Uses parallel arrays  Can be confusing  Difficult to keep track of which car has which color, brand, etc.  Example:

 API stands for Application Programming Interface  Allows programmers to extend the current language to included customized components  Most modern languages incorporate APIs

 Calls to an API that contains the custom car object  Much cleaner code  Re-usable object