Presentation is loading. Please wait.

Presentation is loading. Please wait.

Object-Oriented Programming Languages (OOPLs) An Introduction.

Similar presentations


Presentation on theme: "Object-Oriented Programming Languages (OOPLs) An Introduction."— Presentation transcript:

1 Object-Oriented Programming Languages (OOPLs) An Introduction

2 What is an OOPL No clear definition of what an OOPL is as there is no formal theory of OO (unlike logical or functional programming, or relational model) Most people agree on OOPL = class based + inheritance

3 Background Time efficiency bottlenecks associated with implementation of encapsulation and information hiding inheritance and polymorphism Related Programming Language Concepts Garbage collection Static versus Dynamic Typing

4 Garbage collection A is a mechanism allowing a language implementation to free memory of unused objects on behalf of the programmer, thus relieving the burden on the programmer to do so. The alternative is for the programmer to explicitly free any memory that is no longer needed. Occurs whenever memory becomes full – timing is unpredictable Can take fairly substantial time

5 Static versus Dynamic typing: robustness versus flexibility Static Statically-typed languages require that all variables are declared with a specific class, and then the variable can contain objects of that class or any of its subclasses. Under static-typing errors associated with misuse of services ("message not understood" error) are caught at compilation-time and can never occur at run-time. Dynamic Under dynamic typing a variable to refer to an object of any class. Dynamic typing gives the programmer more flexibility. However, a user of a dynamically-typed language must rely on extensive testing to ensure that all improper uses of the object are tracked down.

6 Overview Simula 67 – 1967 Smalltalk – 1970’s C++ - 1986 Eiffel -1990 Java –1990’s

7 Simula 67 Introduced classes and hierarchical inheritance for the first time Motivated by a simulation application Still has active users Authors: Dahl and Nygaard

8 Simula 67 - Features TypingHybrid (static/dynamic) PolymorphismYes Information HidingYes ConcurrencyYes InheritanceYes Multiple InheritanceNo Garbage CollectionYes Object PersistenceNo GenericityNo

9 Smalltalk Widely considered to be the purest representation of the OO paradigm: Everything is an object (even numbers) Single Superclass Authors: Kay, Goldberg, Ingalls et al. from Xerox PARC

10 Smalltalk - summary of features TypingDynamic PolymorphismYes Information HidingYes ConcurrencyPoor InheritanceYes Multiple InheritanceNo Garbage CollectionYes Object PersistenceNo GenericityNo

11 Smalltalk: pros and cons Pros Conceptually uniform Great pedagogical tool: Impossible to write anything in a non-object- oriented style Superb run-time environment: debugging, class browsing Cons Memory and time inefficiency Message-errors can be only detected at run- time Hard to integrate with other languages (prior to CORBA) Unusual syntax awkward for many developers

12 C++ Upward compatible extension of C. Classes are added as a new primitive data type but can as well ignore all OO features Designed with portability and efficiency in mind Compromise between the pragmatism and the object-oriented ideal gives low level control over hardware when required benefits of object-orientation when required and enforced Author: B. Stroustrup (AT&T)

13 C++ features Static typing by default No garbage collection Supports multiple inheritance Supports template classes

14 C++ It is one of the most successful OO languages in commercial applications Is likely to remain very popular because achieves high performance characteristics - probably the fastest of all oo languages possible to do anything at any level of the operating system provides easy integration with other languages, especially C good quality component libraries are available

15 C++ “for applications that have a systems programming component, systems with demanding time or space requirements, and those that span several technical cultures or application areas. In such systems, more simple, less efficient and more specialized languages become liabilities” B. Stroustrup

16 C++- summary of features Yes - templatesGenericity NoObject Persistence NoGarbage Collection YesMultiple Inheritance YesInheritance PoorConcurrency YesInformation Hiding YesPolymorphism Static(default)/DynamicTyping

17 Eiffel Many specialists regard as the best available oo language attempts to address issues of correctness, robustness, portability and efficiency Has several advantages over Java Eiffel introduced the concept of assertions Design and programming language Novel “melting ice” technology Not widely adopted due to problems with the original compiler, but Chicago Board of Trade recently adopted it for its core trading system Author: B. Meyer

18 Eiffel - summary of features YesGenericity Some supportObject Persistence Optional and IncrementalGarbage Collection YesMultiple Inheritance YesInheritance YesConcurrency YesInformation Hiding YesPolymorphism StaticTyping

19 Java “ Took the industry by storm” supports development of full fledged applications and browser-run applets support for concurrency and security C++-like syntax, but no pointers, thus safer code supported by powerful vendor: SUN Authors:J. Gosling, W. Joy, G. Steele(SUN)

20 Java features Portability - Java code compiles into platform independent byte-code which is interpreted on each platform by a java-virtual -machine. code is completely portable, but at the cost of poor performance Automatic garbage collection Multiple inheritance supported only for interfaces. Rigorous support for exception (error) handling Supports method execution across a network via Remote Method Invocation

21 Java - feature summary NoGenericity Via JDBCObject Persistence YesGarbage Collection Only for interfacesMultiple Inheritance Single for classesInheritance ThreadsConcurrency YesInformation Hiding YesPolymorphism StaticTyping

22 Concluding remarks C++ appeared until recently to be the most practical, successful, general purpose OOPL Increasingly interest is turning to Java OO Languages are powerful but still slightly immature New languages are still emerging Need more class libraries


Download ppt "Object-Oriented Programming Languages (OOPLs) An Introduction."

Similar presentations


Ads by Google