History OOP languages Year Language 1967 Simula-67 1983 Smalltalk



Similar documents
AP Computer Science Java Subset

Java (12 Weeks) Introduction to Java Programming Language

CSCI 253. Object Oriented Programming (OOP) Overview. George Blankenship 1. Object Oriented Design: Java Review OOP George Blankenship.

Glossary of Object Oriented Terms

Java Interview Questions and Answers

SE 360 Advances in Software Development Object Oriented Development in Java. Polymorphism. Dr. Senem Kumova Metin

ATM Case Study OBJECTIVES Pearson Education, Inc. All rights reserved Pearson Education, Inc. All rights reserved.

The Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1

CompuScholar, Inc. Alignment to Utah's Computer Programming II Standards

Part I. Multiple Choice Questions (2 points each):

Functional Programming

Yosemite National Park, California. CSE 114 Computer Science I Inheritance

Lecture 1: Introduction

Fundamentals of Java Programming

Inheritance in Programming Languages

High-Level Programming Languages. Nell Dale & John Lewis (adaptation by Michael Goldwasser)

Java Application Developer Certificate Program Competencies

An Introduction To UML Class Diagrams Classes

Preet raj Core Java and Databases CS4PR. Time Allotted: 3 Hours. Final Exam: Total Possible Points 75

Chapter 13 - Inheritance

On the (un)suitability of Java to be the first programming language

CS 111 Classes I 1. Software Organization View to this point:

TECHNOLOGY Computer Programming II Grade: 9-12 Standard 2: Technology and Society Interaction

Parameter Passing Methods

Chapter 1 Fundamentals of Java Programming

Introduction to Object-Oriented Programming

CSE 307: Principles of Programming Languages

Specialized Programme on Web Application Development using Open Source Tools

C++ INTERVIEW QUESTIONS

D06 PROGRAMMING with JAVA

Description of Class Mutation Mutation Operators for Java

Object Oriented Design

Génie Logiciel et Gestion de Projets. Object-Oriented Programming An introduction to Java

Concepts and terminology in the Simula Programming Language

Chapter 13 Computer Programs and Programming Languages. Discovering Computers Your Interactive Guide to the Digital World

UML Class Diagrams. Lesson Objectives

11 November

Java SE 7 Programming

The Interface Concept

Konzepte objektorientierter Programmierung

CS193j, Stanford Handout #10 OOP 3

Lecture 7 Notes: Object-Oriented Programming (OOP) and Inheritance

Génie Logiciel et Gestion de Projets. Object-Oriented Programming An introduction to Java

Introducing Variance into the Java Programming Language DRAFT

Java Software Structures

Announcements FORTRAN ALGOL COBOL. Simula & Smalltalk. Programming Languages

core. Volume I - Fundamentals Seventh Edition Sun Microsystems Press A Prentice Hall Title ULB Darmstadt

Software Testing. Definition: Testing is a process of executing a program with data, with the sole intention of finding errors in the program.

UML: Classes -- Association

CSCI 3136 Principles of Programming Languages

Multiple Dispatching. Alex Tritthart WS 12/13

PHP Object Oriented Classes and objects

Compiling Object Oriented Languages. What is an Object-Oriented Programming Language? Implementation: Dynamic Binding

Advanced Data Structures

Object-Oriented Programming

The Sun Certified Associate for the Java Platform, Standard Edition, Exam Version 1.0

Tutorial on Writing Modular Programs in Scala

RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE. CISY 105 Foundations of Computer Science

Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program

Computing Concepts with Java Essentials

Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program

El Dorado Union High School District Educational Services

Polymorphism. Why use polymorphism Upcast revisited (and downcast) Static and dynamic type Dynamic binding. Polymorphism.

Agenda. What is and Why Polymorphism? Examples of Polymorphism in Java programs 3 forms of Polymorphism

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

DIPLOMADO DE JAVA - OCA

INTRODUCTION TO COMPUTER PROGRAMMING. Richard Pierse. Class 7: Object-Oriented Programming. Introduction

Server-Side Scripting and Web Development. By Susan L. Miertschin

UML Class Diagrams (1.8.7) 9/2/2009

UML for C# Modeling Basics

Java 6 'th. Concepts INTERNATIONAL STUDENT VERSION. edition

Exception Handling. Overloaded methods Interfaces Inheritance hierarchies Constructors. OOP: Exception Handling 1

Specialized Programme on Web Application Development using Open Source Tools

University of Twente. A simulation of the Java Virtual Machine using graph grammars

Object-Oriented Programming in Java

6.088 Intro to C/C++ Day 4: Object-oriented programming in C++ Eunsuk Kang and Jean Yang

Comp 411 Principles of Programming Languages Lecture 34 Semantics of OO Languages. Corky Cartwright Swarat Chaudhuri November 30, 20111

LAB4 Making Classes and Objects

Web Development and Core Java Lab Manual V th Semester

How To Design Software

Formal Engineering for Industrial Software Development

a. Inheritance b. Abstraction 1. Explain the following OOPS concepts with an example

How To Teach Object Oriented Programming At An Introductory Level Course

Cohort: BCA/07B/PT - BCA/06/PT - BCNS/06/FT - BCNS/05/FT - BIS/06/FT - BIS/05/FT - BSE/05/FT - BSE/04/PT-BSE/06/FT

CS1002: COMPUTER SCIENCE OO MODELLING & DESIGN: WEEK 5

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

Java SE 7 Programming

Short Introduction to the Concepts of Programming in Java Overview over the most important constructs

Java SE 7 Programming

INTRODUCTION TO OBJECTIVE-C CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 12 09/29/2011

On Understanding Types, Data Abstraction, and Polymorphism

On Understanding Types, Data Abstraction, and Polymorphism

16 Collection Classes

3D Animation of Java Program Execution for Teaching Object Oriented Concepts

Install Java Development Kit (JDK) 1.8

Moving from CS 61A Scheme to CS 61B Java

Programming Languages

Chapter 6: Programming Languages

Transcription:

History OOP languages Intro 1 Year Language reported dates vary for some languages... design Vs delievered 1957 Fortran High level programming language 1958 Lisp 1959 Cobol 1960 Algol Structured Programming 1965 Basic 1967 Simula-67 OOP - simulation: class, inheritance, override 1971 Pascal 1973 C, Prolog 1979 ADA object based 1980 Modula 2 1983 Smalltalk OOP - GUI: untyped, class variables 1986 C++ Mulitiple Inheritance, Popularized OOP 1986 Effiel Generic classes, design-by-contract / assertion 1991 Python Multiple Inheritance, scripting, dynamic types 1995 Java interfaces, VM portable, nested classes 2002 C# properties, delegates

OO Definitions && UML Objects are "things" in an OO program Intro 2 Classes are the definitions of objects. Members represent attributes and behaviors instance variables (data members) class variables (shared by all instances) methods (behavior, member functions) constructors -- no type, same name as class, instantiate objects Encapsulation (visibility, accessibility) private accessible within object protected accessible within object and its subclasses public accessible by all Composition has-a relationship (aggregation, UML "lite") Class attributes can be objects. An object "A" has-a object "B". Shape has a Size. Shape Size

Object instantiate new Class Intro 3 Square # side1 : int + Square + draw : void + public # protected - private Name # variable : type + constructor + method : type Square asquare = new Square(); // java instantiation asquare references an object of type Square. asquare.side1 = 10; Note: UML diagrams are not exactly correct due to limitation of powerpoint drawing capabilities

Messages Intro 4 OOP works by objects sending messages and receiving the results of the messages. sendingobject requests a method in the receiving object to act and maybe reply (return something) Messages sends are method (function) calls. In typed languages methods have a return type, name, and argument list The sending object and the receiving object must have the same type. In untyped languages (smalltalk) methods can return objects.

Abstraction Inheritance classes can be dervived, subclassed from super classes classes inherit ("reuse of type") definition Inheritance graph is rooted in the parent Class Intro 5 General (shared) attributes and behaviors are defined near root common factors are placed in ancestral classes abstract classes are never leafs Specific (unique) attributes and behaviors are defined near leafs Is-a relationship objects of a subclass have an "is-a" relationship to the superclass Square is a shape. Multiple inheritance languages have possible name collisions Shape Square

Overloading Intro 6 Method Overloading (ad hoc polymorphism) occurs when a several methods share the same name. Method executed resolved at compile time. Non OOP langs (ie C) also overload functions. Overloading based on Scope. Methods w/ same name defined in different classes. Overloading based on Type Signature. Class has several definitions of a method with same type and name but different arguments. Polyadicity method can take variable number of arguments. C# params Optional arguments args w/ default values provided. Function Count (A, B : integer; C : Integer = 0) { }

Overriding Intro 7 Method Overriding occurs when a subclass redefines the behavior (and scope) of an inherited method (inclusion polymorphism). Method executed resolved at run time. Notation C++ uses keyword virtual to note method in ancestor class C# uses keyword virtual like C++ but also requires keyword override in descendant class. class Parent { public virtual int meth(int a) { } } class Child : Parent { public override int meth(int a) { } } Often used in conjunction with Polymorphism. A method (often abstract) defined in an ancestor class is overriden in some of the descendant classes. (example later)

Polymorphism Intro 8 Abstract class, method (pure polymorphism). An ancestral class that can't be instantiated but can be subclassed. Abstract method is declared and must be defined in the subclass. Polymorphism enables subclasses of a class to all respond to the same method (inherit the method name) but redefine (override) the method's behavior. Java Swing Example if Shape is an abstract class with an abstract draw method Square can define draw to render square shapes (in Shape's scope) Rectangle can define draw to render rectangle shapes Instances of Squares and Rectangles can be keep in a container of Shapes (since they are all shapes)

Interfaces, Properties Intro 9 Single inheritance languages often provide "contractual multiple inheritance" with interfaces ( mixins ). Interfaces define the capability of behaviorial inheritance method signatures. The implementor of an interface "is-a" instance of the interface class OO Properties (C#) are "classes lite" that provide more transparent encapsulation (replace set*(...) and get*() methods useful as indexers (enumerators) over collections. OOPLs have large collection, graphics/gui, I/O, math class libraries. also database, multi-media, network, security...

UML Intro 10 Inheritance is shown using a solid line with an arrow head directed from the subclass to the superclass. Interfaces are shown using a dashed line with an arrow head directed from the implementor to the interface Aggregations (Composition) is shown using a solid line with a diamond head directed from the owner class to the contained class. Aggregation part can exist separately from whole Composition part can't exist separately from whole Associations represents services provided (dependencies) between 2 classes (eg. client - server) are shown using a solid line drawn between the classes. Cardinality quantifies the aggregation and association relationship beween classes. Strict UML uses open arrow heads for inheritance and interfaces and open diamond heads to indicate coposition where the contained object could exist without the owner (powerpoint doesn't have these shape to my knowledge).

Java Swing Example Intro 11 ViewPoly 1 n Shape 1 ViewPoly can have n (many) Shapes Shape is an abstract class Square inherits Shape Rectangle inherits Square Square Rectangle 1 large blue square 1 large red square 4 small green squares 2 white rectangles

Shape # x : int # y : int # color : Color + Shape(int, int, Color) + draw(graphic) : void Square # side1 : int + Square(int, int, Color, int) + draw(graphic) : void Intro 12 UML diagrams + public # protected - private abstract Rectangle - side2 : int + Rectange(int, int, Color, int, int) + draw(graphic) : void

Intro 13 JFrame ViewPoly - scene : Shape[] - count : int - MAX : int - adderror : boolean + ViewPoly(String, int) + paint(graphic) : void - add(shape) : void + main(string[]) : static void composition

Intro 14 // In ViewPoly.java public void paint(graphics g) { for(int i = 0; i < count; i++) scene[i].draw(g); Shape Shape Shape Shape Shape Shape } Square draw(g) : void Square draw(g) : void Rectangle draw(g) : void Square Rectangle draw(g) : void draw(g) : void