Presentation is loading. Please wait.

Presentation is loading. Please wait.

Principles of Object-Oriented Software Development Object-oriented programming languages.

Similar presentations


Presentation on theme: "Principles of Object-Oriented Software Development Object-oriented programming languages."— Presentation transcript:

1 Principles of Object-Oriented Software Development Object-oriented programming languages

2 Introduction The object paradigm Comparing Smalltalk, Eiffel, C++ and Java Design dimensions of object-oriented languages Prototypes -- delegation versus inheritance Meta-level architectures Summary Q/A Literature

3 Object-oriented programming languages the object paradigm language design dimensions classless prototypes meta-level architectures Additional keywords and phrases: programming languages, orthogonality, reliability, complexity, types, delegation, multiple paradigms, prototypes, reflection

4 The object paradigm Subsections: A classification of object-oriented languages Alternative object models Object extensions of Lisp, C and Prolog Script languages -- integration with Java

5 The notion of object abstract data types -- software engineering frames -- artificial intelligence semantic data models -- database system development capability-based computing -- distributed systems Simula

6 object-oriented structurally capability of representing arbitrarily structured complex objects operationally the ability to operate on complex objects through generic operators behaviorally the specification of types and operations (data abstraction) Perspectives of object orientation

7 A classification of object-oriented languages

8 Objects object creation facility message passing capability class capability inheritance features language characteristics

9 Classification hybrid -- C, Lisp, Pascal, Prolog frame-based -- knowledge-based reasoning distributed, concurrent, actor -- parallel computing alternative object models -- prototypes, delegation

10 Alternative object models

11 Object extensions of Lisp, C and Prolog Object extensions Lisp -- LOOPS, FLAVORS, CLOS, FOOPS C -- Objective C, C++ Prolog -- SPOOL, VULCAN, DLP Commercial products -- languages Smalltalk, Eiffel, C++, Objective C, Object Pascal, Java

12 Object structure -- efficient mapping C++ struct A {... } == class A { public:... } class A {... } == struct A { private: … } The equivalence between class and struct

13 Script languages Java embedding Javascript -- Dynamic HTML Perl -- CGI/Web library JPL Tcl/Tk -- tclets Jacl, Tcl Blend Python -- Grail JPython

14 Objects in Javascript

15 javascript function object_display(msg) { object method return msg + ' (' + this.variable++ + ')'; } function object() { object constructor this.variable=0; this.display = object_display; return this; } var a = new object(); create object document.write(a.display("a message")); document.write(a.display("another message"));

16 Comparing Smalltalk, Eiffel, C++ and Java Subsections: Criteria for comparison Language characteristics

17 Criteria for comparison class libraries programming environment language characteristics

18 Language characteristics uniformity of data structures documentation value reliability inheritance mechanisms efficiency memory management language complexity

19 Smalltalk Eiffel C++ Java uniformity high medium low medium documentation value medium high medium high reliability medium medium low* high* protected operations no no yes yes multiple inheritance no yes yes no* efficiency low medium high low garbage collection yes yes no* yes language complexity low* medium high medium

20 Design dimensions of object-oriented languages Subsections: Object-based versus object-oriented Towards and orthogonal approach -- type extensions Multi-paradigms languages -- logic Active objects -- synchronous Java/C++

21 Object Oriented Language Design object: state + operations class: template for object creation inheritance: super/base and subclasses object-oriented = objects + classes + inheritance data abstraction -- state accessible by operations strong typing -- compile time checking

22 Orthogonal approach objects -- modular computing agents types -- expression classification delegation -- resource sharing abstraction -- interface specification

23 Multi-paradigm languages logic

24 Open systems reactive -- flexible (dynamic) choice of actions modular -- (static) scalability Dimensions of modularity encapsulation boundary -- interface to client distribution boundary -- visibility from within objects concurrency boundary -- threads per object, synchronization

25 Active objects synchronous Java/C++

26 Object-based concurrency add processes -- synchronization multiple active objects -- rendezvous asynchronous communication -- message buffers

27 Synchronous C++/Java

28 active class S { sC++ public: m () {... } private: @S () { pseudo-constructor select { 01 -> m(); external call instructions... || accept m; accept internal method instructions... || waituntil (date); time-out instructions... || default default instructions... } } }

29 Prototypes delegation versus inheritance Subsections: Alternative forms of sharing Implementation techniques -- Self

30 Prototypes cloning -- creation time sharing delegation -- lifetime sharing exemplars

31 State slots -- parents, variables and methods Creation shallow cloning deep cloning Delegation implicit delegation explicit delegation

32 Improving performance special purpose hardware hybrid languages static typing dynamic compilation Implementation techniques -- Self

33 Self -- prototypes objects, cloning, delegation Dynamic compilation -- type information customized compilation message inlining lazy compilation message splitting Implementation techniques -- Self

34 Meta-level architectures

35 The class concept abstract data type -- interface description object generator -- template for creation repository -- for sharing resources object -- instance of a metaclass

36

37 Postulates everything is an object every object belongs to a class every class inherits from the class Object class variables of an object are instance variables of its class class-based languages

38 Reflective definition of Class name Class supers (Object) iv (name supers iv methods) methods (new...)

39 Summary

40 The object paradigm notion of object -- viewpoints classification -- object extensions 1

41 Comparing Smalltalk, Eiffel, C++ and Java criteria -- libraries, environments, language characteristics comparison -- language characteristics 2

42 Design dimensions of object-oriented languages object-oriented -- object-based + inheritance orthogonal dimensions -- objects, types, delegation, abstraction open systems -- dimensions of modularity 3

43 Prototypes -- delegation versus inheritance prototypes -- cloning and delegation performance -- dynamic compilation 4

44 Meta-level architectures class -- the concept of class meta architecture -- subclass and instance hierarchy reflection -- postulates 5

45 Questions 1. What are the basic characteristics of object-oriented languages? 2. How would you classify object-oriented languages? Name a few representatives of each category. 3. What do you consider to be the major characteristic of the object model supported by C++? Explain. 4. Why would you need friends? 5. How would you characterize the difference between object-based and object-oriented? 6. Along what orthogonal dimensions would you design an object- oriented language? Explain. 7. Give a characterisation of active objects. In what situations may active objects be advantageous? 8. How would you characterize prototype-based languages?

46 9. What are the differences between inheritance and delegation? Does C++ support delegation? Explain. And Java? 10. How would you characterize the concept of a class? 11. Can you sketch the meta architecture of Smalltalk? 12. How would you phrase the postulates underlying class-based languages? Can you give a reflective version of these postulates?

47 Further reading A concise treatment of programming languages is given in [BG94]. Further, you may want to consult [Wegner87], which contains the original presentation of the discussion concerning the distinction between object-based and object-oriented. For Java, read the original white paper, [Java]. An interesting extension of C++ is described in [Petitpierre98]. At the corresponding web site, http://ltiwww.epfl.ch/sCxx, there is much additional material. Finally, for an account of the design and evolution of C++, read [Stroustrup97]. For more information on C++, visit http://www.accu.org, and for Java, http://www.javasoft.com.


Download ppt "Principles of Object-Oriented Software Development Object-oriented programming languages."

Similar presentations


Ads by Google