OO Languages

                                   Chapter 9




Object-Oriented Software Systems Engineering – Chapter 9   Slide 1
Objectives

 In this chapter we will:
  Introduce some Object Oriented Programming
   Languages
  Compare some aspects of these languages




Object-Oriented Software Systems Engineering – Chapter 9   Slide 2
Major OOPL

  Four of the major Object Oriented Programming
    languages are:
 C++
 Smalltalk
 Eiffel
 Java




Object-Oriented Software Systems Engineering – Chapter 9   Slide 3
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




Object-Oriented Software Systems Engineering – Chapter 9   Slide 4
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




Object-Oriented Software Systems Engineering – Chapter 9   Slide 5
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




Object-Oriented Software Systems Engineering – Chapter 9   Slide 6
...Environment

  Smalltalk has several classes of interactive code
    writing and debugging tools. They are:
       Class Hierarchy Browser
       Class Browser
       Workspace
       System Transcript
       Disk Browser
       Walkback; Debugger




Object-Oriented Software Systems Engineering – Chapter 9   Slide 7
Environment Classes

  System Transcript:
     reports events in the system as they occur
  Class Hierarchy Browser
     allows users to browse, edit, and add new classes to the
      running system
  Workspace
     allows users to edit and evaluate expressions and
      displays the results




Object-Oriented Software Systems Engineering – Chapter 9   Slide 8
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




Object-Oriented Software Systems Engineering – Chapter 9   Slide 9
Smalltalk Summary

  Designed for interactive and extensible use,
    therefore:
       environment is available for modification and extension
       language is semi-compiled then interpreted
       has dynamic binding and
       dynamic typing




Object-Oriented Software Systems Engineering – Chapter 9    Slide 10
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




Object-Oriented Software Systems Engineering – Chapter 9   Slide 11
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




Object-Oriented Software Systems Engineering – Chapter 9   Slide 12
C++


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




Object-Oriented Software Systems Engineering – Chapter 9   Slide 13
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




Object-Oriented Software Systems Engineering – Chapter 9   Slide 14
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




Object-Oriented Software Systems Engineering – Chapter 9   Slide 15
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++)




Object-Oriented Software Systems Engineering – Chapter 9   Slide 16
C++ Environment


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




Object-Oriented Software Systems Engineering – Chapter 9   Slide 17
C++ Summary


  C++ was designed for production programming
    and to be compatible with C:
       compiled for speed of execution
       not very interactive
       strong static typing to catch programming errors before
        execution




Object-Oriented Software Systems Engineering – Chapter 9   Slide 18
C++ Summary continued


       choice of static / dynamic binding for speed => confusion
       debugging less well integrated, though often good
       special run-time error recovery mechanism = exceptions
       “dirty” design to support existing C code + OO
        extensions
       constructor and destructor functions to speed up object
        creation and deletion




Object-Oriented Software Systems Engineering – Chapter 9    Slide 19
Comparison


  C++:
     edit-compile-execute
     compiled (interpreters exist)
     language separate from environment
     many variations of environment from different vendors
     widely ported to different platforms




Object-Oriented Software Systems Engineering – Chapter 9   Slide 20
...Comparison


  Smalltalk:
     interactive
     interpreted (compilers exist)
     language integrated with environment
     only one vendor
     limited number of hardware platforms




Object-Oriented Software Systems Engineering – Chapter 9   Slide 21
...Comparison


  C++:
     statically typed
     static or dynamic binding (user chooses)
     environment is not part of programs
     standardised syntax and semantics
     constructor / destructor functions - no garbage collection




Object-Oriented Software Systems Engineering – Chapter 9   Slide 22
...Comparison


  Smalltalk:
     dynamically typed (“doesNotUnderstand” message)
     dynamic binding always
     environment can confuse - part of all programs
     standardisation not really a major problem yet (ParcPlace
      and Digitalk have produced different versions)
     automatic garbage collection




Object-Oriented Software Systems Engineering – Chapter 9   Slide 23
Strengths


  C++: Systems Engineering
     portable
     quick
     large libraries
     C compatible




Object-Oriented Software Systems Engineering – Chapter 9   Slide 24
...Strengths


  Smalltalk - Rapid Prototyping & Development
     interactive
     interpreted
     easy to understand
     easy to learn
     highly integrated




Object-Oriented Software Systems Engineering – Chapter 9   Slide 25
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-conditions
       post-conditions
       assertions
       invariants




Object-Oriented Software Systems Engineering – Chapter 9   Slide 26
...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




Object-Oriented Software Systems Engineering – Chapter 9   Slide 27
...Eiffel


  Eiffel has failed to make a major impact because:
     compatibility with C syntax is low
     it’s proprietary
     there were to few good environments




Object-Oriented Software Systems Engineering – Chapter 9   Slide 28
Eiffel Summary


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

       automatic garbage collection
       static typing
       dynamic binding (but compiler can optimize to static)




Object-Oriented Software Systems Engineering – Chapter 9    Slide 29
...Eiffel Summary


       checkable assertions
       documentation tools
       “new” design with no old compatibility features
       poor backward compatibility with C




Object-Oriented Software Systems Engineering – Chapter 9   Slide 30
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




Object-Oriented Software Systems Engineering – Chapter 9   Slide 31
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)



Object-Oriented Software Systems Engineering – Chapter 9   Slide 32
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




Object-Oriented Software Systems Engineering – Chapter 9   Slide 33
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




Object-Oriented Software Systems Engineering – Chapter 9   Slide 34
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



Object-Oriented Software Systems Engineering – Chapter 9   Slide 35
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




Object-Oriented Software Systems Engineering – Chapter 9   Slide 36
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




Object-Oriented Software Systems Engineering – Chapter 9   Slide 37
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




Object-Oriented Software Systems Engineering – Chapter 9   Slide 38
Summary

 In this chapter we have:
  Introduced some Object Oriented Programming
   Languages
  Compared some aspects of these languages




Object-Oriented Software Systems Engineering – Chapter 9   Slide 39

9. oo languages

  • 1.
    OO Languages Chapter 9 Object-Oriented Software Systems Engineering – Chapter 9 Slide 1
  • 2.
    Objectives In thischapter we will:  Introduce some Object Oriented Programming Languages  Compare some aspects of these languages Object-Oriented Software Systems Engineering – Chapter 9 Slide 2
  • 3.
    Major OOPL Four of the major Object Oriented Programming languages are: C++ Smalltalk Eiffel Java Object-Oriented Software Systems Engineering – Chapter 9 Slide 3
  • 4.
    Smalltalk  Smalltalkwas 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 Object-Oriented Software Systems Engineering – Chapter 9 Slide 4
  • 5.
    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 Object-Oriented Software Systems Engineering – Chapter 9 Slide 5
  • 6.
    Environment...  Thedevelopment 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 Object-Oriented Software Systems Engineering – Chapter 9 Slide 6
  • 7.
    ...Environment  Smalltalkhas several classes of interactive code writing and debugging tools. They are:  Class Hierarchy Browser  Class Browser  Workspace  System Transcript  Disk Browser  Walkback; Debugger Object-Oriented Software Systems Engineering – Chapter 9 Slide 7
  • 8.
    Environment Classes System Transcript:  reports events in the system as they occur  Class Hierarchy Browser  allows users to browse, edit, and add new classes to the running system  Workspace  allows users to edit and evaluate expressions and displays the results Object-Oriented Software Systems Engineering – Chapter 9 Slide 8
  • 9.
    Debugging  Wheneveran 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 Object-Oriented Software Systems Engineering – Chapter 9 Slide 9
  • 10.
    Smalltalk Summary Designed for interactive and extensible use, therefore:  environment is available for modification and extension  language is semi-compiled then interpreted  has dynamic binding and  dynamic typing Object-Oriented Software Systems Engineering – Chapter 9 Slide 10
  • 11.
    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 Object-Oriented Software Systems Engineering – Chapter 9 Slide 11
  • 12.
    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 Object-Oriented Software Systems Engineering – Chapter 9 Slide 12
  • 13.
    C++  C++was designed as a production software language, so much of it is designed to be fast at the expense of simplicity Object-Oriented Software Systems Engineering – Chapter 9 Slide 13
  • 14.
    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 Object-Oriented Software Systems Engineering – Chapter 9 Slide 14
  • 15.
    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 Object-Oriented Software Systems Engineering – Chapter 9 Slide 15
  • 16.
    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++) Object-Oriented Software Systems Engineering – Chapter 9 Slide 16
  • 17.
    C++ Environment Libraries are also non-standard, although many libraries conform closely to a de-facto standard Object-Oriented Software Systems Engineering – Chapter 9 Slide 17
  • 18.
    C++ Summary C++ was designed for production programming and to be compatible with C:  compiled for speed of execution  not very interactive  strong static typing to catch programming errors before execution Object-Oriented Software Systems Engineering – Chapter 9 Slide 18
  • 19.
    C++ Summary continued  choice of static / dynamic binding for speed => confusion  debugging less well integrated, though often good  special run-time error recovery mechanism = exceptions  “dirty” design to support existing C code + OO extensions  constructor and destructor functions to speed up object creation and deletion Object-Oriented Software Systems Engineering – Chapter 9 Slide 19
  • 20.
    Comparison  C++:  edit-compile-execute  compiled (interpreters exist)  language separate from environment  many variations of environment from different vendors  widely ported to different platforms Object-Oriented Software Systems Engineering – Chapter 9 Slide 20
  • 21.
    ...Comparison  Smalltalk:  interactive  interpreted (compilers exist)  language integrated with environment  only one vendor  limited number of hardware platforms Object-Oriented Software Systems Engineering – Chapter 9 Slide 21
  • 22.
    ...Comparison  C++:  statically typed  static or dynamic binding (user chooses)  environment is not part of programs  standardised syntax and semantics  constructor / destructor functions - no garbage collection Object-Oriented Software Systems Engineering – Chapter 9 Slide 22
  • 23.
    ...Comparison  Smalltalk:  dynamically typed (“doesNotUnderstand” message)  dynamic binding always  environment can confuse - part of all programs  standardisation not really a major problem yet (ParcPlace and Digitalk have produced different versions)  automatic garbage collection Object-Oriented Software Systems Engineering – Chapter 9 Slide 23
  • 24.
    Strengths  C++:Systems Engineering  portable  quick  large libraries  C compatible Object-Oriented Software Systems Engineering – Chapter 9 Slide 24
  • 25.
    ...Strengths  Smalltalk- Rapid Prototyping & Development  interactive  interpreted  easy to understand  easy to learn  highly integrated Object-Oriented Software Systems Engineering – Chapter 9 Slide 25
  • 26.
    Eiffel Eiffel wasdesigned by Bertrand Meyer as a systems engineering language  It has a clean, efficient design with many features to ensure the correctness of code:  pre-conditions  post-conditions  assertions  invariants Object-Oriented Software Systems Engineering – Chapter 9 Slide 26
  • 27.
    ...Eiffel  Eiffelhas 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 Object-Oriented Software Systems Engineering – Chapter 9 Slide 27
  • 28.
    ...Eiffel  Eiffelhas failed to make a major impact because:  compatibility with C syntax is low  it’s proprietary  there were to few good environments Object-Oriented Software Systems Engineering – Chapter 9 Slide 28
  • 29.
    Eiffel Summary Eiffel was designed as a clean systems engineering language, so:  automatic garbage collection  static typing  dynamic binding (but compiler can optimize to static) Object-Oriented Software Systems Engineering – Chapter 9 Slide 29
  • 30.
    ...Eiffel Summary  checkable assertions  documentation tools  “new” design with no old compatibility features  poor backward compatibility with C Object-Oriented Software Systems Engineering – Chapter 9 Slide 30
  • 31.
    Java  Javais 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 Object-Oriented Software Systems Engineering – Chapter 9 Slide 31
  • 32.
    Background  Javacomes 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) Object-Oriented Software Systems Engineering – Chapter 9 Slide 32
  • 33.
    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 Object-Oriented Software Systems Engineering – Chapter 9 Slide 33
  • 34.
    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 Object-Oriented Software Systems Engineering – Chapter 9 Slide 34
  • 35.
    Web  universallyemployed  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 Object-Oriented Software Systems Engineering – Chapter 9 Slide 35
  • 36.
    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 Object-Oriented Software Systems Engineering – Chapter 9 Slide 36
  • 37.
    Interoperability among diverseplatforms  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 Object-Oriented Software Systems Engineering – Chapter 9 Slide 37
  • 38.
    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 Object-Oriented Software Systems Engineering – Chapter 9 Slide 38
  • 39.
    Summary In thischapter we have:  Introduced some Object Oriented Programming Languages  Compared some aspects of these languages Object-Oriented Software Systems Engineering – Chapter 9 Slide 39

Editor's Notes