9.oo languages

39
Slide 1 Object-Oriented Software Systems Engineering – Chapter 9 OO Languages Chapter 9

Transcript of 9.oo languages

Page 1: 9.oo languages

Slide 1Object-Oriented Software Systems Engineering – Chapter 9

OO Languages

Chapter 9

Page 2: 9.oo languages

Slide 2Object-Oriented Software Systems Engineering – Chapter 9

Objectives

In this chapter we will: Introduce some Object Oriented Programming

Languages Compare some aspects of these languages

Page 3: 9.oo languages

Slide 3Object-Oriented Software Systems Engineering – Chapter 9

Major OOPL

Four of the major Object Oriented Programming languages are:

C++SmalltalkEiffelJava

Page 4: 9.oo languages

Slide 4Object-Oriented Software Systems Engineering – Chapter 9

Smalltalk

Smalltalk was for most purposes the first object-oriented language, although it was based on ideas first developed in a simulation language called Simula in the 1960s

Smalltalk was designed to support a (then) radically new type of user interface - the graphical user interface

Page 5: 9.oo languages

Slide 5Object-Oriented Software Systems Engineering – Chapter 9

Smalltalk environment

Then Smalltalk was synonymous with GUIs - now they are commonplace

Smalltalk’s environment is graphical, based on windows and browsers, and is controlled by a pointing device

Page 6: 9.oo languages

Slide 6Object-Oriented Software Systems Engineering – Chapter 9

Environment...

The development environment is an integral part of Smalltalk, and all aspects of it are available for inspection and change within a running Smalltalk system, conversely a Smalltalk system can be extended by writing new classes which are then available in the environment for immediate use, so it is possible to add your own code-writing or debugging tools, although these are already present in Smalltalk

Page 7: 9.oo languages

Slide 7Object-Oriented Software Systems Engineering – Chapter 9

...Environment

Smalltalk has several classes of interactive code writing and debugging tools. They are:

Class Hierarchy BrowserClass BrowserWorkspaceSystem TranscriptDisk BrowserWalkback; Debugger

Page 8: 9.oo languages

Slide 8Object-Oriented Software Systems Engineering – Chapter 9

Environment Classes

System Transcript:reports events in the system as they occur

Class Hierarchy Browserallows users to browse, edit, and add new classes to the

running system

Workspaceallows users to edit and evaluate expressions and

displays the results

Page 9: 9.oo languages

Slide 9Object-Oriented Software Systems Engineering – Chapter 9

Debugging

Whenever an error occurs Smalltalk displays a window containing a “walkback” (=backtrace) which shows the messages that led to the error

It is possible to resume or to start an interactive debugging tool to trace messages through the objects leading up to the error

Objects can also initiate error recovery whenever a message they send is not understood by the receiver

Page 10: 9.oo languages

Slide 10Object-Oriented Software Systems Engineering – Chapter 9

Smalltalk Summary

Designed for interactive and extensible use, therefore:

environment is available for modification and extensionlanguage is semi-compiled then interpretedhas dynamic binding anddynamic typing

Page 11: 9.oo languages

Slide 11Object-Oriented Software Systems Engineering – Chapter 9

Smalltalk Summary

everything is an object conceptually consistent run-time error recovery well-integrated debugging facilities “clean” design to support quick learning automatic garbage collection for ease of use

Page 12: 9.oo languages

Slide 12Object-Oriented Software Systems Engineering – Chapter 9

C++

C++ is not tightly integrated with its development environment and aspects of the environment are not usually available to the programmer

Unlike Smalltalk it is compiled, and so is much less interactive, all changes and evaluations being made in the traditional edit-compile-execute cycle

Page 13: 9.oo languages

Slide 13Object-Oriented Software Systems Engineering – Chapter 9

C++

C++ was designed as a production software language, so much of it is designed to be fast at the expense of simplicity

Page 14: 9.oo languages

Slide 14Object-Oriented Software Systems Engineering – Chapter 9

C++ Programming

C++ is a hybrid of two languages, C and an object-oriented extension - so it can also accept existing C programs

C++ has been used to “object-orientize” existing C programs, a major factor in its popularity

But this means that it is harder to use than Smalltalk because the language is much more complex

Page 15: 9.oo languages

Slide 15Object-Oriented Software Systems Engineering – Chapter 9

C++ Error Handling

C++ can handle run-time errors by writing exception handlers which trap and deal with the error

They fulfill a role similar to that of the “doesNotUnderstand” message in Smalltalk, although in C++ an object can never fail to understand a message because C++ is statically typed

Page 16: 9.oo languages

Slide 16Object-Oriented Software Systems Engineering – Chapter 9

C++ Environment

A typical C++ environment contains program editing, debugging (tracing and breakpointing) and library facilities

Debugging tools depend on what the vendor can supply - there is no standard - but many good debugging and single-stepping tools are available (e.g. Borland C++)

Page 17: 9.oo languages

Slide 17Object-Oriented Software Systems Engineering – Chapter 9

C++ Environment

Libraries are also non-standard, although many libraries conform closely to a de-facto standard

Page 18: 9.oo languages

Slide 18Object-Oriented Software Systems Engineering – Chapter 9

C++ Summary

C++ was designed for production programming and to be compatible with C:

compiled for speed of executionnot very interactivestrong static typing to catch programming errors before

execution

Page 19: 9.oo languages

Slide 19Object-Oriented Software Systems Engineering – Chapter 9

C++ Summary continued

choice of static / dynamic binding for speed => confusiondebugging less well integrated, though often goodspecial run-time error recovery mechanism = exceptions“dirty” design to support existing C code + OO

extensionsconstructor and destructor functions to speed up object

creation and deletion

Page 20: 9.oo languages

Slide 20Object-Oriented Software Systems Engineering – Chapter 9

Comparison

C++:edit-compile-executecompiled (interpreters exist)language separate from environmentmany variations of environment from different vendorswidely ported to different platforms

Page 21: 9.oo languages

Slide 21Object-Oriented Software Systems Engineering – Chapter 9

...Comparison

Smalltalk:interactiveinterpreted (compilers exist)language integrated with environmentonly one vendorlimited number of hardware platforms

Page 22: 9.oo languages

Slide 22Object-Oriented Software Systems Engineering – Chapter 9

...Comparison

C++:statically typedstatic or dynamic binding (user chooses)environment is not part of programsstandardised syntax and semanticsconstructor / destructor functions - no garbage collection

Page 23: 9.oo languages

Slide 23Object-Oriented Software Systems Engineering – Chapter 9

...Comparison

Smalltalk:dynamically typed (“doesNotUnderstand” message)dynamic binding alwaysenvironment can confuse - part of all programsstandardisation not really a major problem yet (ParcPlace

and Digitalk have produced different versions)automatic garbage collection

Page 24: 9.oo languages

Slide 24Object-Oriented Software Systems Engineering – Chapter 9

Strengths

C++: Systems Engineeringportablequicklarge librariesC compatible

Page 25: 9.oo languages

Slide 25Object-Oriented Software Systems Engineering – Chapter 9

...Strengths

Smalltalk - Rapid Prototyping & Developmentinteractiveinterpretedeasy to understandeasy to learnhighly integrated

Page 26: 9.oo languages

Slide 26Object-Oriented Software Systems Engineering – Chapter 9

Eiffel

Eiffel was designed by Bertrand Meyer as a systems engineering language

It has a clean, efficient design with many features to ensure the correctness of code:

pre-conditionspost-conditionsassertionsinvariants

Page 27: 9.oo languages

Slide 27Object-Oriented Software Systems Engineering – Chapter 9

...Eiffel

Eiffel has automatic garbage collection which can be programmer-controlled

It was designed to be compatible with C library code, but this feature is never emphasized

Eiffel is a proprietary language and has never had a good programming environment

Like C++ there is provision for exception handlers

Page 28: 9.oo languages

Slide 28Object-Oriented Software Systems Engineering – Chapter 9

...Eiffel

Eiffel has failed to make a major impact because:compatibility with C syntax is lowit’s proprietarythere were to few good environments

Page 29: 9.oo languages

Slide 29Object-Oriented Software Systems Engineering – Chapter 9

Eiffel Summary

Eiffel was designed as a clean systems engineering language, so:

automatic garbage collectionstatic typingdynamic binding (but compiler can optimize to static)

Page 30: 9.oo languages

Slide 30Object-Oriented Software Systems Engineering – Chapter 9

...Eiffel Summary

checkable assertionsdocumentation tools“new” design with no old compatibility featurespoor backward compatibility with C

Page 31: 9.oo languages

Slide 31Object-Oriented Software Systems Engineering – Chapter 9

Java

Java is the most trendy computer programming language ever

Also the only programming language ever to make the front cover of Time magazine

Likely to become the major WWW programming language

Could achieve a critical mass for OOP in the as yet non converted industry

Page 32: 9.oo languages

Slide 32Object-Oriented Software Systems Engineering – Chapter 9

Background

Java comes form the Oak project at Sun Microsystems to develop embedded applications and set top boxes for telecommunications services

Java is a clean OO language designed for wide scale distribution

Java compiles to ByteCodes which then interpreted by a Virtual Machine on a host computer (like Smalltalk 20 years ago)

Page 33: 9.oo languages

Slide 33Object-Oriented Software Systems Engineering – Chapter 9

Language features

Syntax is based on C and C++“C++ without the guns, knives and clubs”: James Gosling

However it has single inheritance, dynamic linking and is fully OO, more like Smalltalk than C++

Strongly typed like C++ and Eiffel No (visible) pointers unlike C++ and like Smalltalk

Page 34: 9.oo languages

Slide 34Object-Oriented Software Systems Engineering – Chapter 9

Immediate Future

Long range predictions are futile Java will have significant impact It is still fairly new Its popularity could cause problems if

expectations can’t be met Object thinking is more important than language Look out for C# and .NET

Page 35: 9.oo languages

Slide 35Object-Oriented Software Systems Engineering – Chapter 9

Web

universally employed

first use of Web was relatively static, lacking component-based infrastructure

could be standards-based infrastructure

diverse object application models that conform to a core set of standards

ActiveX components, Java and CORBA objects, Agents

Page 36: 9.oo languages

Slide 36Object-Oriented Software Systems Engineering – Chapter 9

Web object-based developments

IIOP (Internet Inter-ORB Protocol) - a CORBA standard that defines network interfaces for OO applications over the Internet

will serve as basis for Netscape ONE (Open Network Environment)

will provide developers with an open standards-based framework for building interoperable Internet applications

Page 37: 9.oo languages

Slide 37Object-Oriented Software Systems Engineering – Chapter 9

Interoperability among diverse platforms

Microsoft is member of OMG in name only so far never supported their standards Microsoft now shifting more towards Internet DCOM (distributed common object model) of

Microsoft .NET coming

Page 38: 9.oo languages

Slide 38Object-Oriented Software Systems Engineering – Chapter 9

Benefits through Web

support modularity, reusability and integration together objects plus infrastructure =

improvements people are becoming object developers object marketplace has started up quickly financial services, telecommunications industries

need: rapid deployment, reliability, modularity and flexibility of OT

Page 39: 9.oo languages

Slide 39Object-Oriented Software Systems Engineering – Chapter 9

Summary

In this chapter we have: Introduced some Object Oriented Programming

Languages Compared some aspects of these languages