Comparison of OO Programming Languages © Jason Voegele, 2003.

Slides:



Advertisements
Similar presentations
Objects and Classes David Walker CS 320. Advanced Languages advanced programming features –ML data types, exceptions, modules, objects, concurrency,...
Advertisements

Object-Oriented programming in C++ Classes as units of encapsulation Information Hiding Inheritance polymorphism and dynamic dispatching Storage management.
Portability and Safety Mahdi Milani Fard Dec, 2006 Java.
Various languages….  Could affect performance  Could affect reliability  Could affect language choice.
Chapter 1 OO using C++. Abstract Data Types Before we begin we should know how to accomplish the goal of the program We should know all the input and.
Objects and Classes David Walker CS 320. Advanced Languages advanced programming features –ML data types, exceptions, modules, objects, concurrency,...
Programming Language Paradigms: summary. Object-oriented programming Objects are the fundamental building blocks of a program. Interaction is structured.
Object Oriented System Development with VB .NET
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Principles of Object-Oriented Software Development The language Eiffel.
Abstract Data Types and Encapsulation Concepts
8.1 Classes & Inheritance Inheritance Objects are created to model ‘things’ Sometimes, ‘things’ may be different, but still have many attributes.
Subclasses and Subtypes CMPS Subclasses and Subtypes A class is a subclass if it has been built using inheritance. ▫ It says nothing about the meaning.
OOP Languages: Java vs C++
Object Based Programming. Summary Slide  Instantiating An Object  Encapsulation  Inheritance  Polymorphism –Overriding Methods –Overloading vs. Overriding.
Chair of Software Engineering Beyond Eiffel these slides contain advanced material and are optional.
Programming Languages and Paradigms Object-Oriented Programming.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
C++ Object Oriented 1. Class and Object The main purpose of C++ programming is to add object orientation to the C programming language and classes are.
C++ Programming. Table of Contents History What is C++? Development of C++ Standardized C++ What are the features of C++? What is Object Orientation?
“is a”  Define a new class DerivedClass which extends BaseClass class BaseClass { // class contents } class DerivedClass : BaseClass { // class.
OOPs Object oriented programming. Based on ADT principles  Representation of type and operations in a single unit  Available for other units to create.
CISC6795: Spring Object-Oriented Programming: Polymorphism.
CSM-Java Programming-I Spring,2005 Objects and Classes Overview Lesson - 1.
CONCEPTS OF OBJECT ORIENTED PROGRAMMING. Topics To Be Discussed………………………. Objects Classes Data Abstraction and Encapsulation Inheritance Polymorphism.
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
Programming Languages
1 Chapter 10: Data Abstraction and Object Orientation Aaron Bloomfield CS 415 Fall 2005.
Algorithm Programming Bar-Ilan University תשס"ח by Moshe Fresko.
CSSE501 Object-Oriented Development. Chapter 12: Implications of Substitution  In this chapter we will investigate some of the implications of the principle.
Programming Languages and Paradigms Object-Oriented Programming.
CSE 425: Object-Oriented Programming I Object-Oriented Programming A design method as well as a programming paradigm –For example, CRC cards, noun-verb.
 OOPLs  Help companies reduce complexity  Increase competition in open markets  Speeds up development  Improves maintenance, resusability, modifiability.
Overloading Binary Operators Two ways to overload –As a member function of a class –As a friend function As member functions –General syntax Data Structures.
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.
Introduction to Object Oriented Programming CMSC 331.
OOP Class Lawrence D’Antonio Lecture 3 An Overview of C++
More on Hierarchies 1. When an object of a subclass is instantiated, is memory allocated for only the data members of the subclass or also for the members.
OOPLs /FEN March 2004 Object-Oriented Languages1 Object-Oriented Languages - Design and Implementation Java: Behind the Scenes Finn E. Nordbjerg,
Data Structures Using C++ 2E Chapter 3 Pointers. Data Structures Using C++ 2E2 Objectives Learn about the pointer data type and pointer variables Explore.
Computer Programming 2 Why do we study Java….. Java is Simple It has none of the following: operator overloading, header files, pre- processor, pointer.
COMP3190: Principle of Programming Languages
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Real Time Programming Language. Intro A programming language represents the nexus of design and structure. But misuse of the programming language can.
Object-Oriented Programming Chapter Chapter
 Objects versus Class  Three main concepts of OOP ◦ Encapsulation ◦ Inheritance ◦ Polymorphism  Method ◦ Parameterized ◦ Value-Returning.
OOPs Object oriented programming. Abstract data types  Representationof type and operations in a single unit  Available for other units to create variables.
3C-1 Purity Typing Language semantics Inheritance model  Single vs. Multiple inheritance  Common root Modular mechanisms Generics Object Oriented Languages.
ISBN Object-Oriented Programming Chapter Chapter
Copyright © 2005 Elsevier Object-Oriented Programming Control or PROCESS abstraction is a very old idea (subroutines!), though few languages provide it.
1 CS Programming Languages Class 22 November 14, 2000.
1 Copyright © 1998 by Addison Wesley Longman, Inc. Chapter 10 Abstraction - The concept of abstraction is fundamental in programming - Nearly all programming.
1 Lecture 23: Dynamic Binding (Section ) CSCI 431 Programming Languages Fall 2002 A compilation of material developed by Felix Hernandez-Campos.
A Survey of Object-Oriented Concept Oscar Nierstrasz.
Testing in OO Environment The reasons for testing is not any different for any of the design and implementation methodologies, including OO methodology.
Internet Computing Module II. Syllabus Creating & Using classes in Java – Methods and Classes – Inheritance – Super Class – Method Overriding – Packages.
C++ General Characteristics: - Mixed typing system - Constructors and destructors - Elaborate access controls to class entities.
ISBN Chapter 12 Support for Object-Oriented Programming.
Object Oriented Programming in Java Habib Rostami Lecture 2.
The Object-Oriented Thought Process Chapter 03
Object Oriented Programming in Java
Object-Orientated Programming
Types of Programming Languages
Java Programming Language
The Procedure Abstraction Part V: Run-time Structures for OOLs
More Object-Oriented Programming
Parameter Passing Actual vs formal parameters
Object-Oriented PHP (1)
C++ Object Oriented 1.
Presentation transcript:

Comparison of OO Programming Languages © Jason Voegele, 2003

C-S 5462 Characteristics of an OO Programming Language Encapsulation / Information Hiding Inheritance Polymorphism / Dynamic Binding All pre-defined types are objects All operations performed by sending messages to objects All user-defined types are objects

C-S 5463 OO Languages - Comparison PropertiesEiffelSmallta lk RubyJavaC#C++Visual Basic 1Yes Yes? 2Yes No 3Yes Yes? 4Yes No 5Yes No 6Yes No

C-S 5464 Observations Eiffel, Smalltalk and Ruby are the pure OO languages Java and C# fail to meet properties 4 and 5; many OO designers still accept that it is not a serious issue. C++ does not satisfy properties 4, 5 and 6. Lack of property 6 leads to inconsistencies in the set of objects created in the program. VB is simply a procedural language with some OO features – should not be considered to implement an OO design

C-S 5465 Static Vs Dynamic Binding Static binding –Every variable has a fixed, permanent type attached to the variable at compile time Dynamic binding –A variable has no fixed type; its type changes dynamically as the program executes Hybrid binding –A variable has a fixed type assigned at compile time, but it may assume other types during run-time through polymorphic substitutions

C-S 5466 Static and Dynamic Binding (continued) Smalltalk and Ruby are the only languages that support dynamic binding Eiffel, Java, C# and C++ support hybrid binding Visual Basic supports only static binding When a language uses generic classes (templates), it supports hybrid binding –Eiffel, C# and C++ Future version of Java is expected to support generic classes

C-S 5467 Inheritance Almost all OO languages, except VB, support inheritance Multiple inheritance is supported by Eiffel and C++ –Jason Voegele argues that Eiffel’s mechanisms to handle conflicts in multiple inheritance is neat and clear than those in C++ Java does not support multiple inheritance directly, but can be realized through interfaces

C-S 5468 Class based inheritance Vs Object based inheritance Most OO languages support class base inheritance –A class designated as the subclass of a superclass –Objects of subclasses can be substituted for objects of superclass (polymorphism) –Subtype inheritance Some languages support object based inheritance –Objects can inherit features from other objects during run-time SELF and Javascript support this feature Ruby supports both class based and object based inheritance

C-S 5469 Method overloading and operator overloading Method overloading –Same name for more than one method –Differentiated by the number and/or type of parameters –Supported by Java and C++ only Operator overloading –Overloading the meaning of one or more of the language symbols such as “+” and “*” –Supported by Eiffel, Ruby, C++

C-S Operator overloading - expectations All operations in the system must be messages to objects –Executions with operators are considered to be equivalent to message calls Operators must have equivalent functional forms –1 + 2 is the same as 1. + (2) Smalltalk, Ruby and Eiffel support both of these features C++ supports neither, even though it supports operator overloading

C-S Higher order functions Functions whose arguments are functions themselves –Example: calculate_tax (find year(), tax_rate) The scope of the functions that are passed as parameters must also be visible or computable Smalltalk and Ruby support higher order functions; recent version of Eiffel supports too. Java, C# and C++ do not support this feature; neither does VB. Another function

C-S Garbage Collection Mechanism to free memory of unused objects Mark and sweep method –One phase marks the unused objects and another phase cleans them up –Both phases are done at unspecified time (programmer does not know) –Smalltalk, Eiffel, Ruby and Java support this mechanism Reference count mechanism –Used by Visual Basic; has its own problems C++ does not support garbage collection

C-S Class variables Variables that are declared as static in a class and are accessible to all instances of that class –Only one copy of each class variable exists and is shared by all instances Smalltalk, Ruby, Java, C# and C++ support this feature though the implementation mechanisms are slightly different Smalltalk also supports additional classifications such as “pool variables” that are shared by only a group of classes –An extended mechanism of class variables

C-S Access Control Access to various features of a class are generally declared as “public” or “private” in most OO languages Java, C# and C++ support “protected” by which private features of a class can be accessed by its subclasses –In these languages, a private feature can be accessed by any member of the same object or objects of the same class as well –C++ supports “friend” mechanism by which another class B can access the private features of a class A as long as B is declared as a friend of A  this violates the encapsulation property Eiffel supports selective export, much similar to “protected” In Smalltalk, methods can be “public” or “private” but attributes are strictly “private” only.

C-S Design by Contract A notion introduced by Bertrand Meyer Each method is designed with a contract described by “pre” and “post-conditions”, and “invariants” Eiffel is the only language that supports this feature Java and Ruby has libraries that tend to support the design by contract feature, but it is not at the same level as in Eiffel

C-S Concurrency Concurrency is generally supported in OO languages by threads of execution control Almost all languages support multi-threading It is explicit in Java, C# and C++ but somewhat indirect(?) in Smalltalk VB supports it through timers Ruby supports threading not only in its syntax but a separate built-in interpreter, and hence does not rely on OS support for its implementation.

C-S Pointer Arithmetic Allows a program to directly manipulate memory addressed through “pointers”. –Goal is to improve run-time efficiency C++ is the only language that supports pointers Other OO languages tend not to support pointer arithmetic because –Pointers are not OO concepts/principles –Misuse of (or improper use of) pointers will lead to a lot of programming problems that are not part of the application domain