Polygon. Entries : Area. Square. Entries : Area

Size: px
Start display at page:

Download "Polygon. Entries : Area. Square. Entries : Area"

Transcription

1 Global Optimization in YAFL Laurent Ferier March 1996 Abstract This paper describes the means to optimize code generated by a compiler and will focus on optimizations requiring the analysis of an entire program in order to be performed. The optimizations on which this paper will focus are mostly applicable in an object-oriented environment. An optimizer has been implemented to perform some of these optimizations on YAFL programs. 1 Introduction The purpose of a compiler is to translate code written in a language into another whereas the purpose of an optimizer is to detect sub-optimal constructs generated by the compiler and replace them by optimal ones. An optimal construction requires less storage or improves the performances of a system compared to the sub-optimal one. These two kinds of optimization are not always incompatible, but sometimes, a choice has to be done between these two issues. In this case, space will often be sacriced to the benet of time since it is easier to add random access memory in a computer than make it compute faster. Modular languages support the module 1 concept. The specication le of modules provides links between modules of a system. This le holds a partial description of the module. Because of the partition of a system in modules, when the compiler compiles a module, it cannot access the informations of the entire system. Thereby, some sub-optimal constructs might be missed by the compiler. It would need informations about the entire system in order to detect them. For instance, considering the YAFL language [Bla94], let M be a private method dened in a module and never called in the module. Since M is private, M cannot be called outside 1 A module is a compilation unit. It can be compiled independently from the other modules modulo their external specication. 81

2 the module. Thereby, M cannot be called at all and no code has to be generated for M. If M was public instead of being private, M could be called from anywhere in the system. The compiler can only suppress M from the code generated only if no calls to M can be found in the entire system. Global informations are necessary in order to detect it. Meanwhile, such compiler requires much space and time in order to compile the system. A solution could be to use two compilers: A fast one which is used to compile the system during the development phase. The code generated is not the fastest nor the smallest one. A slow compiler which detects most of sub-optimal constructs and generate the most ecient code possible. This compiler needs access to informations about the entire system, and compile time performances is not considered critical. 2 Global optimization in YAFL YAFL is a modular language: the compiler compiles one module at a time. Hence, no global optimization can be performed. The YSTORM optimizer reuses most of the standard YAFL compiler and performs its optimizations using system-wide informations. The global optimization process can be lengthy. However, all eorts have been done to make this process as fast as possible. The implementation part describes these eort (see section 3). The YSTORM optimizer performs most of the optimizations described in this chapter. Those which are not performed are either not the concern of the global optimizer, or would not change signicantly the performances of the code generated. 2.1 Peep-hole Optimizations Peep-hole optimizations are optimizations which only need local and often low-level informations in order to be performed. For instance, these optimizations include dead code suppression, sub-expressions evaluation, etc. Since these optimizations are local, they do not need global informations in order to be performed. Thereby, the global optimizer shall not deal with them. As a matter of fact, the standard YAFL compiler doesn't deal with those optimizations either as long as it is meant to produce intermediate C code, and most C compilers provide such kind of optimizations. 82

3 2.2 Late binding In object oriented languages, the late binding mechanism is used to invoke the right version of a method depending on the object on which the method is being applied to. For instance, consider the example listed extensively in appendix A. Let APolygon be a reference to a Polygon as described in this appendix and consider the call APolygon.; Displayable Move Move Dot Polygon ChangeColor ChangeColor APolygon. Square Figure 1: APolygon. The object referenced by APolygon can be either a Polygon or a Square. Thereby, the call APolygon. can either be applied to the method from Polygon or on the one from Square. The compiler doesn't know at compile-time if the object referenced by APolygon is a Polygon or a Square. It must defer the selection of the right method to run-time. This call is said to require late binding. On the other hand let ADot be a reference to a Dot and consider the call ADot.; 83

4 Displayable Move Move APolygon.ChangeColor Dot Polygon ChangeColor ChangeColor ADot. Square Figure 2: ADot. In this case, the compiler knows that only a Dot can be referenced through ADot because there is no class that inherits from Dot. Thereby, the only method applicable on that call is the method dened in the class Dot. No late binding is needed to perform this call. When the optimizer tries to optimize calls, he will try to nd such calls, and generate code which skips the dynamic selection of the right method to be called. We can also remove late binding for APolygon.ChangeColor(Red); if APolygon a reference to a Polygon, since ChangeColor is not redened. Consider ADisplayable be a reference to a Displayable and the call ADisplayable.; 84

5 Displayable Move Move? ADisplayable. Dot Polygon ChangeColor ChangeColor Square Figure 3: ADisplayable. In a YAFL system, ADisplayable can reference a Square, a Polygon, a Dot or even a Displayable since abstract classes can be CREATEd. Thereby, the compiler cannot determine statically which method is to be applied on the call. It doesn't even know if there is an applicable method ( is DEFERRED in the class Displayable). In this case, the compiler generates a late binding call and if, during run-time, no method is applicable on the call, an error message is displayed and the program stops. The following paragraphs formalize the concepts of late binding and related optimizations Denitions Late binding: When a method is invoked, the late binding mechanism selects the right version of the method to be called, depending on the class of the object it is applied to. Since the selection is performed on objects, not on references, it can only be done during run-time. In order to generate a faster code, the compiler has to remove late binding handling from the generated code as often as possible. This can only be performed when the compiler can make sure there's only one method applicable for the call. 85

6 Class: A class c i is dened by c i =< methods i ; E i ; c j > where M i is the set of the methods dened for c i E i c j is the set of the entry points of c i is c i 's base class The inheritance relationship will be noted (c j! c i ), meaning that c i inherits from c j. S is the set of all classes dened in the system. For instance, in the example given in appendix A, we have S = fc (Displayable) ; c (Dot) ; c (Polygon) ; c (Square) g and (c (Displayable)! c (Dot) ) (c (Displayable)! c (Polygon) ) (c (Polygon)! c (Square) ) Object: An instance of the class c i is called object and is noted o i. The set of all objects of a system is noted O. The set O is dynamic. Derived Classes: Let Dci 1 the set of all classes derived from the class c i. Dci 1 is dened by D 1 ci = fc j 2 Sj(c i! c j )g D l ci is recursively dened by D l ci = Dl?1 ci [ fc j 2 Cj9 c k 2 D l?1 ci and (c k! c j )g For instance, D +c (Displayable) D +c (Dot) D +c (Polygon) D +c (Square) fc (Dot) ; c (Polygon) ; c (Square) g fg fc (Square) g fg 86

7 Entry Point: An entry point e j is the denition of an operation applicable on instances of one or more classes from S. The entries dened in the system from appendix A are e (), e (), e (Move), e (ChangeColor) and e (). Method: A method m ij of a class c i is an operation applicable on an instance of the class c i. It is dened by where m ij =< e j ; Iij > e j is the entry attached to m ij Iij are the statements of m ij The set of all methods of a system is noted M. The following table displays methods according to the example listed in appendix A and their corresponding class. Class c (Displayable) c (Dot) Method m (Displayable, Move) m (Dot, ) m (Dot, ) m (Dot, ChangeColor) c (Polygon) m (Polygon, ) m (Polygon, ) m (Polygon, ) c (Square) m (Square, ) Call: A Call a ij is the invocation of an entry point e j on an object from the class c i or one of its derived class. Only methods which corresponding entry is e j may be called through a a ij. The set of all calls of a system is noted A. 2.3 Late binding problem in C++ In order to reduce the loss of performances due to late binding, C++ allows the programmer to specify which functions are to be invoked through late binding. Those functions are called virtual functions. 87

8 This approach simplies compiler design since no analysis is required to determine if a method invocation has to be done through late binding. No other functions than those explicitly marked as virtual are to be called through late binding. However, this approach does have drawbacks. First, the programmer has to determine himself (herself) which methods are virtual, which is not always a simple choice. Furthermore, since a non virtual method cannot be redened, the programmer has to know how the classes are to be used before committing. One can see that code reusability in a C++ environment is rather painful, unless all functions are marked as virtual, hence a signicant performance penalty. Even if only potentially redened methods are marked as virtual, some optimizable calls may still be forgotten. Consider for instance the following C++ code: class AClassf... virtual void Func1(); g; class BClass:public AClassf... void Func1(); g;... BClass *TheBClass; TheBClass->Func1();... Since Func1() is redened, it must be declared as virtual. Thereby, each time a call is done to Func1, the C++ compiler has to generate a late binding call. In a system where no class inherits from BClass, the function Func1 cannot be further redened. Thereby, there's only one applicable function on the call TheBClass->Func1(). The compiler should be able to determine statically which method has to be called and no late binding is necessary. By this example, one can see late binding is more linked to the function call than to the function itself. The C++ model is sub-optimal since a large property of monomorphic function calls still require late binding in order to be performed. 2.4 Some more denitions Applicable methods on a method call: Since methods can be redened, several methods may be invoked on the same method call, depending on the actual class of the object 88

9 the method is being applied for. When a call is performed, the method applied is the rst method the compiler nds going up in the inheritance tree from the class of the object on which the call is applied. Let F irst ij () be the rst method in the inheritance tree restricted to the set of classes of and matching the call a ij. F irst ij () is dened by where F irst ij () = m kj c i 2 (D ck \ ) 6 9 m lj jc l 2 (D + ck n D ci ) Let V ij () be the set of all methods which could be executed on a call a ij classes from the set. V ij () is dened by considering all V ij () can also be dened by V ij () = fm kj j m kj = F irst kj () and c k 2 g V ij () = fm kj j c k 2 D + ci \ g [ ff irst ij()g (1) Taking the example in appendix A, we have and F irst (Displayable, ) (S) = V (Displayable,) (S) = fm (Dot, ) ; m (Polygon, ) ; m (Square, ) g Figure 4 illustrates this example. F irst (Square, Move) (S) = m (Displayable, Move) V (Square, Move) (S) = fm (Displayable, Move) g 89

10 Displayable First (Displayable, ) Move Move? Dot Polygon ChangeColor ChangeColor Square First (Square, Move) Figure 4: Example of computation of F irst() Monomorphic call: Polymorphic call: Wrong call: A call a ij is monomorphic, only one method is applicable, jv ij (S)j = 1 A call a ij is polymorphic, more than one methods is applicable, jv ij (S)j > 1 A call a ij is wrong, no method is applicable, jv ij (S)j = 0 90

11 Selection function: The general case for the selection function is dened by where Sel : A O! M : a ij o k 7! m lj m lj 2 V ij () Sel is the function which selects which method has to be applied on an object at run-time. denes the classes to be accounted for. In a strong typing environment, we have c k 2 D ci The method is selected as follows: Sel(a ij ; o k ) = ( F irst ik (S) if V ij (S) 6= otherwise When Sel() is applied on objects during run-time, F irst ij () is used during compilation to compute V ij (). Trivial cases: The selection function Sel(a ij ; o k ) is trivial in two cases: V ij (S) =. The compiler should raise an error since it knows no method is applicable on the call a ij. Nevertheless, we choose to emit a warning instead of refusing such a call since the call may not be performed. This can happen even if the statement where the wrong call stands is executed. Consider the following example: IF TRUE OR ABadCall THEN Since the rst part of the condition is always true and thanks to lazy evaluation, the compiler just skips the call a (ABadCall). V ij (S) = fm kj g. Since the selection function takes its values in V ij (), we have 8l Sel(a ij ; o l ) = fm kj g The compiler knows at compile-time which method is to be invoked for that specic call. Thereby, late binding is not required. If V ij (S) is not known, the call has to be done through late binding because the compiler doesn't know the value of Sel(a ij ; o k ) or even if a value exists. 91

12 2.5 Computing V ij (S) in YAFL In order to avoid the problems described in 2.3 for C++, all YAFL non local methods can be redened. Thereby, if the code generated by the standard YAFL compiler was not optimized, all method invocations would have been done through late binding. Fortunately, the compiler can detect some static calls 2 and optimize them. The purpose of the global optimizer is to nd more static calls than those found by the compiler, but basically, the underlying principles are the same Calls to local methods Local methods are methods dened within another method. Since these methods cannot be redened, jv ij (S)j = 1 for any call a ij to such method. The compiler does not have to generate any late binding call applied onto local methods. Since no global information is required to compute V ij (S), the standard YAFL compiler already optimizes method calls applying to these methods Calls to methods applied to ONCE classes ONCE classes are classes for which only one instance exists, which is created by the system at initialization time. No class may inherit from ONCE classes. Consider a ONCE class c i, and a method m ij dened or redened in c i. We know (see (1)) V ij (S) = fm kj j c k 2 D + \ Sg [ ci ff irst ij(s)g Since no class inherits from c i, D + ci =. m ij is (re)dened in c i, hence F irst ij (S) = m ij. The compiler knows which method is invoked by a ij. A straight call to m ij may be performed. No global information is necessary in order to detect ONCE classes. Hence the standard YAFL compiler already optimizes such calls Calls to private methods Private methods are methods only usable in the module in which they have been dened. Since those methods can only be redened in the same module, the set on which V ij () can be limited to classes dened in the current module. Thereby, the standard YAFL compiler can determine V ij (). It can then determine whether late binding is necessary. Once again, since only informations about the current module are necessary to compute V ij (), the standard YAFL compiler already optimize such calls. 2 Opposing to late binding calls. Static calls are also called monomorphic calls. 92

13 2.5.4 Calls to public methods Public methods are methods which are visible from outside their enclosing module. Since these methods can be redened in other modules if their enclosing class is not ONCE, we can have where V ij (S) n V ij () 6= = fc i jc i is dened in the current module g Thereby, system-wide informations are necessary to nd out optimizable calls to public methods. Thereby, the standard YAFLcompiler cannot optimize such calls. A global optimization is the only mean to optimize them. 2.6 Extensions of the selection function The selection function may be extended for several parameters, others than the object on which the method is applied. For instance, SmallTalk[GR83] is a language where no information about static type of an object is provided. An object is supposed to accept any message 3 and the validity of the message is tested at run-time. If the message is not a valid one, an error message is sent. The SmallTalk compiler cannot determine V ij (S) for a message since the class c i on which the message is sent is not known. Nevertheless, in order to perform optimizations, the compiler does some duplicate code. Code duplication: Code duplication is the generation of the same piece of code, each one optimized for a given context of execution. In order to replace polymorphic messages passing by monomorphic ones, some SmallTalk and SmallTalk-like systems[cha92] duplicate methods, each one optimized for the actual classes of its parameters. The denition of a method is slightly modied: m [i1 ;:::;in];j =< e j ; Ifi 1 ; : : : ; i n g > The method m [i i;:::;in];j is applicable only on objects from dynamic class c i1 and which parameters are respectively from the classes c i2 ; : : : ; c i n. The selection function is dened by: Sel : A (O) n! M : a i o i1 o i n 7! m [i1 ;:::;in];j 3 A message is the SmallTalk's word for YAFL's method call 93

14 where o i1 o i2 : : : o i n is the object on which the method is applied are the objects given as parameters In such a context, the compiler knows the dynamic type of the parameters. The selection function is then no more useful for message passing on parameters since the dynamic type is known during compilation 4. Thereby, messages on parameters in optimized method can be performed straight. Thanks to code duplication, the selection is done only once, during message passing. The selection is performed only once and as early as possible. A compiler cannot generate all versions of the method, each one optimized for a dierent set of parameters. Thereby, this optimization is mainly used in systems providing run-time compilation features. If a message is passed to a class where the method has not yet been compiled, the compiler generates, stores it and executes it on the y. 2.7 Inlining Inlining replaces calls to functions by the actual body of the function. This is mainly used to minimize time lost during function call. One must weight carefully what should be inlined in order to keep the code reasonably small Inlining in C++ C++ allows the programmer to dene functions as requiring inline extension. Such functions cannot be redened. Thereby, when the programmer has dened a non virtual function, he has to nd out if the method is worth to be inlined or not. One of the advantages of the C++ technique, beyond the fact that it simplies code generation, is that there is no restricting pattern for inline function. Therefore, any function may be extended inline if the programmer choose so. C++ consider inline only as a compilation directives which can be forgotten if the compiler whishes Inlining in YAFL YAFLdoes not dene any syntaxical constuct to dene inlinable methods. Since YAFLprovides encapsulation, the only mean to access attribute is methods. Thereby, most classes denes methods to either read or modify the value of its attributes. We will 4 That's the reason why the compiler duplicated the methods 94

15 call such methods attribute accessing methods. These are used a lot in YAFLsystems and rather trivial to inline. So, we decided to inline them. Inlining a method invocation requires the invocation to be monomorphic. Since the standard YAFL compiler cannot determine much monomorphic calls, it could not inline much method calls. On the other hand, the global optimizer detects all monomorphic calls of a system. Thereby, inlining is possible and interresting. It uses a simple pattern matching to detect attribute accessing methods. The simple preceding scheme, presented above can actually be extended to handle cases when a chain of method invocation can be replaced by a chain of attribute consultation. 2.8 Removing unreachable code When one writes and tests a program, he (she) normally inserts debugging statements, which are removed when the system goes to production. YAFL denes DEBUG and ASSERT statements which serve this purpose. Any optimizer can walk through the code and remove such statements. No global optimization is necessary. On the other hand, when using class libraries within a system, some methods are never invoked at all. No code generation is necessary for such methods. A class is useless if no instance of that class is ever CREATEd explicitly. Reachable call: Let A M be the set of all reachable calls from the set M. a ij 2 A M, 9 m kl 2 M and a ij 2 I kl Reachable method: Let M M be the set of all reachable methods from the set M. m ij 2 M M, 9 a kj 2 A M and m ij 2 V kj (S) Reachable class: Let C M be the set of all reachable methods from the set M. c i 2 C M, 9 m ij 2 M M The detection of unreachable classes and methods is performed as follows: S While all classes S is not of the stabilized systemdo M fm (i, CREATE) j c i 2 S is ONCE or the entry classg While M i s not stabilized do M End while S C M End while M [ M M 95

16 At the end of the algorithm, S is purged from all unused classes and M is the set of all methods which can possibly be used. Since V ij (S) is needed for this optimization, this optimization requires global informations in order to be performed. 3 Implementation and Performances 3.1 First Optimizer Since the global optimizer needs informations about the entire system, it seemed reasonable to load and analyze the entire system in one time. This approach led us in rather awful problems of memory management and performances. Since large amounts of memory were allocated, most pages of the process were swapped out. When launched, the garbage collector, which is not a local process, used most of its time to swap pages in and out. 3.2 An usable optimizer Since only a few of global informations are required for our optimizations (the inheritance tree, classes, methods, entry points, calls performed by a method, : : : ), only a subset of the system must be kept accessible during the entire process. We introduced dictionaries which purpose is to keep such information and to infer on them. The optimization process is divided in three phases: Analyzing the entire system and storing information in dictionaries. Inferring on these informations, as computing V ij (S), determining which calls are monomorphic, : : : Reloading each module one after the other and generating code using possible optimizations as described in preceding chapter and global informations gathered in the preceding steps. This approach allows us to spare much space and to have compile-times about two or three times longer than a normal compilation. It has been merged with the standard YAFL compiler and can be activated when needed. In the meantime, dictionaries are used in other projects to gather information about YAFL systems. 96

17 4 Conclusions Some results: Time consumption Superuous late binding to public methods 30% Unavoidable late binding 3% Monomorphic access to attributes 10% Garbage collection 15% Application 42% Total 100% Only 90% of the method invocations were monomorphic. Thereby, real polymorphic calls take about 3% of the run-time for a YAFL system. which is rather cheap for the facilities object oriented languages provide. Even if superuous late binding was not removed, the cost of object orientation would not be as heavy as people often expect. References [Bla94] Darius Blasband. The YAFL Programming Language, 2nd edition. PhiDaNi Software, [Cha92] Craig Chambers. The Design and Implementation of the SELF Compiler, an Optimizing Compiler for Object-Oriented Programming Languages. PhD thesis, Stanford University, March Available via anonymous ftp from self.stanford.edu. [GR83] A. Goldberg and D. Robson. Smalltalk-80: The Language and Its Implementation. Addison-Wesley, Reading, Mass., A An example In order to be more understandable, here follows a YAFL example, which will be used throughout this paper. DEFINITION MODULE Polygons; FROM List IMPORT List; 97

18 CLASS Displayable; REDEFINE METHOD CREATE (PosX, PosY : INTEGER); DEFERRED METHOD ; DEFERRED METHOD ; METHOD Move (dx, dy : INTEGER); END Displayable; CLASS Dot; INHERITS Displayable; REDEFINE METHOD CREATE(PosX, PosY, Color : INTEGER); METHOD ChangeColor (NewColor :INTEGER); END Dot; CLASS Polygon; INHERITS Displayable; REDEFINE METHOD CREATE (PosX, PosY : INTEGER; Vertexes : List(Dot); Color : INTEGER); METHOD ChangeColor (NewColor :INTEGER); METHOD : REAL; END Polygon; CLASS Square; INHERITS Polygon; REDEFINE METHOD CREATE (PosX, PosY : INTEGER; Vertexes : List(Dot); Color : INTEGER); END Square; END Polygons; IMPLEMENTATION MODULE Polygons; CLASS Displayable; VAR X, Y : INTEGER; REDEFINE METHOD CREATE (PosX, PosY : INTEGER); X := PosX; Y := PosY; END CREATE; METHOD Move (dx, dy : INTEGER); ; X := X + dx; Y := Y + dy; 98

19 ; END Move; END Displayable; CLASS Dot; INHERITS Displayable; VAR Color, Back : INTEGER; REDEFINE METHOD CREATE(PosX, PosY, Color : INTEGER); BASE (PosX, PosY); THIS.Color := Color; END CREATE; REDEFINE METHOD ; Back := Back of the dot -- the dot... END ; REDEFINE METHOD ; -- the back of the dot... END ; METHOD ChangeColor (NewColor ; Color := NewColor; ; END ChangeColor :INTEGER); END Dot; CLASS Polygon; INHERITS Displayable; VAR Vertexes : List(Dot); Color : INTEGER; 99

20 Back :... ; : REAL; REDEFINE METHOD CREATE (PosX, PosY : INTEGER; Vertexes : List(Dot); Color : INTEGER); BASE (PosX, PosY); THIS.Vertexes := Vertexes.CLONE; THIS.Color := Color; THIS. :=... ; END CREATE; REDEFINE METHOD ; -- the polygon END ; REDEFINE METHOD ; -- the polygon END ; METHOD ChangeColor (NewColor ; Color := NewColor; ; END ChangeColor; :INTEGER); METHOD : REAL; RESULT := THIS.; END ; END Polygon; CLASS Square; INHERITS Polygon; REDEFINE METHOD CREATE (PosX, PosY Vertexes Color : INTEGER; : List(Dot); : INTEGER); 100

21 ASSERT Vertexes.Size = 3; BASE (PosX, PosY, Vertexes, Color); END CREATE; REDEFINE METHOD ; -- Optimized method show for squares END ; REDEFINE METHOD ; -- Optimized method show for squares END ; REDEFINE METHOD ; -- Optimized method show for squares END ; END Square; END Polygons; This module could be used to display several geometric gures. Each gure given here can be CREATEd, Hidden, n, Moved and one can change their color. 101

Acknowledgments 2

Acknowledgments 2 Program Slicing: An Application of Object-oriented Program Dependency Graphs Anand Krishnaswamy Dept. of Computer Science Clemson University Clemson, SC 29634-1906 anandk@cs.clemson.edu Abstract A considerable

More information

Risk Management. I.T. Mock Interview Correction

Risk Management. I.T. Mock Interview Correction Risk Management I.T. Mock Interview Correction General I.T. Questions 1) A computer can only run binary code, whose human-readable version is assembly language. Any higher-level language is only an abstraction

More information

Compaq Interview Questions And Answers

Compaq Interview Questions And Answers Part A: Q1. What are the difference between java and C++? Java adopts byte code whereas C++ does not C++ supports destructor whereas java does not support. Multiple inheritance possible in C++ but not

More information

Object Oriented Programming in Java. Jaanus Pöial, PhD Tallinn, Estonia

Object Oriented Programming in Java. Jaanus Pöial, PhD Tallinn, Estonia Object Oriented Programming in Java Jaanus Pöial, PhD Tallinn, Estonia Motivation for Object Oriented Programming Decrease complexity (use layers of abstraction, interfaces, modularity,...) Reuse existing

More information

Optimizing Closures in O(0) time

Optimizing Closures in O(0) time Optimizing Closures in O(0 time Andrew W. Keep Cisco Systems, Inc. Indiana Univeristy akeep@cisco.com Alex Hearn Indiana University adhearn@cs.indiana.edu R. Kent Dybvig Cisco Systems, Inc. Indiana University

More information

Forth Meets Smalltalk. A Presentation to SVFIG October 23, 2010 by Douglas B. Hoffman

Forth Meets Smalltalk. A Presentation to SVFIG October 23, 2010 by Douglas B. Hoffman Forth Meets Smalltalk A Presentation to SVFIG October 23, 2010 by Douglas B. Hoffman 1 CONTENTS WHY FMS? NEON HERITAGE SMALLTALK HERITAGE TERMINOLOGY EXAMPLE FMS SYNTAX ACCESSING OVERRIDDEN METHODS THE

More information

Module 10 Inheritance, Virtual Functions, and Polymorphism

Module 10 Inheritance, Virtual Functions, and Polymorphism Module 10 Inheritance, Virtual Functions, and Polymorphism Table of Contents CRITICAL SKILL 10.1: Inheritance Fundamentals... 2 CRITICAL SKILL 10.2: Base Class Access Control... 7 CRITICAL SKILL 10.3:

More information

C++ & Object Oriented Programming Concepts The procedural programming is the standard approach used in many traditional computer languages such as BASIC, C, FORTRAN and PASCAL. The procedural programming

More information

D Programming Language

D Programming Language Group 14 Muazam Ali Anil Ozdemir D Programming Language Introduction and Why D? It doesn t come with a religion this is written somewhere along the overview of D programming language. If you actually take

More information

Server 1 Server 2 CPU. mem I/O. allocate rec n read elem. n*47.0. n*20.0. select. n*1.0. write elem. n*26.5 send. n*

Server 1 Server 2 CPU. mem I/O. allocate rec n read elem. n*47.0. n*20.0. select. n*1.0. write elem. n*26.5 send. n* Information Needs in Performance Analysis of Telecommunication Software a Case Study Vesa Hirvisalo Esko Nuutila Helsinki University of Technology Laboratory of Information Processing Science Otakaari

More information

What are the characteristics of Object Oriented programming language?

What are the characteristics of Object Oriented programming language? What are the various elements of OOP? Following are the various elements of OOP:- Class:- A class is a collection of data and the various operations that can be performed on that data. Object- This is

More information

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe OBJECT ORIENTED PROGRAMMING USING C++ CSCI 5448- Object Oriented Analysis and Design By Manali Torpe Fundamentals of OOP Class Object Encapsulation Abstraction Inheritance Polymorphism Reusability C++

More information

CPSC 320 Sample Solution, Playing with Graphs!

CPSC 320 Sample Solution, Playing with Graphs! CPSC 320 Sample Solution, Playing with Graphs! September 23, 2017 Today we practice reasoning about graphs by playing with two new terms. These terms/concepts are useful in themselves but not tremendously

More information

Chapter 6 Introduction to Defining Classes

Chapter 6 Introduction to Defining Classes Introduction to Defining Classes Fundamentals of Java: AP Computer Science Essentials, 4th Edition 1 Objectives Design and implement a simple class from user requirements. Organize a program in terms of

More information

Oops known as object-oriented programming language system is the main feature of C# which further support the major features of oops including:

Oops known as object-oriented programming language system is the main feature of C# which further support the major features of oops including: Oops known as object-oriented programming language system is the main feature of C# which further support the major features of oops including: Abstraction Encapsulation Inheritance and Polymorphism Object-Oriented

More information

CPSC W2 Midterm #2 Sample Solutions

CPSC W2 Midterm #2 Sample Solutions CPSC 320 2014W2 Midterm #2 Sample Solutions March 13, 2015 1 Canopticon [8 marks] Classify each of the following recurrences (assumed to have base cases of T (1) = T (0) = 1) into one of the three cases

More information

COP 3330 Final Exam Review

COP 3330 Final Exam Review COP 3330 Final Exam Review I. The Basics (Chapters 2, 5, 6) a. comments b. identifiers, reserved words c. white space d. compilers vs. interpreters e. syntax, semantics f. errors i. syntax ii. run-time

More information

M301: Software Systems & their Development. Unit 4: Inheritance, Composition and Polymorphism

M301: Software Systems & their Development. Unit 4: Inheritance, Composition and Polymorphism Block 1: Introduction to Java Unit 4: Inheritance, Composition and Polymorphism Aims of the unit: Study and use the Java mechanisms that support reuse, in particular, inheritance and composition; Analyze

More information

Week 2: The Clojure Language. Background Basic structure A few of the most useful facilities. A modernized Lisp. An insider's opinion

Week 2: The Clojure Language. Background Basic structure A few of the most useful facilities. A modernized Lisp. An insider's opinion Week 2: The Clojure Language Background Basic structure A few of the most useful facilities A modernized Lisp Review of Lisp's origins and development Why did Lisp need to be modernized? Relationship to

More information

DOWNLOAD PDF CORE JAVA APTITUDE QUESTIONS AND ANSWERS

DOWNLOAD PDF CORE JAVA APTITUDE QUESTIONS AND ANSWERS Chapter 1 : Chapter-wise Java Multiple Choice Questions and Answers Interview MCQs Java Programming questions and answers with explanation for interview, competitive examination and entrance test. Fully

More information

Inter-Project Dependencies in Java Software Ecosystems

Inter-Project Dependencies in Java Software Ecosystems Inter-Project Dependencies Inter-Project Dependencies in Java Software Ecosystems in Java Software Ecosystems Antonín Procházka 1, Mircea Lungu 2, Karel Richta 3 Antonín Procházka 1, Mircea Lungu 2, Karel

More information

The architecture of Eiffel software 3.1 OVERVIEW classes clusters systems

The architecture of Eiffel software 3.1 OVERVIEW classes clusters systems 3 Draft 5.02.00-0, 15 August 2005 (Santa Barbara). Extracted from ongoing work on future third edition of Eiffel: The Language. Copyright Bertrand Meyer 1986-2005. Access restricted to purchasers of the

More information

CMSC 132: Object-Oriented Programming II

CMSC 132: Object-Oriented Programming II CMSC 132: Object-Oriented Programming II Java Support for OOP Department of Computer Science University of Maryland, College Park Object Oriented Programming (OOP) OO Principles Abstraction Encapsulation

More information

Programming Languages Third Edition. Chapter 10 Control II Procedures and Environments

Programming Languages Third Edition. Chapter 10 Control II Procedures and Environments Programming Languages Third Edition Chapter 10 Control II Procedures and Environments Objectives Understand the nature of procedure definition and activation Understand procedure semantics Learn parameter-passing

More information

G Programming Languages - Fall 2012

G Programming Languages - Fall 2012 G22.2110-003 Programming Languages - Fall 2012 Lecture 2 Thomas Wies New York University Review Last week Programming Languages Overview Syntax and Semantics Grammars and Regular Expressions High-level

More information

CMa simple C Abstract Machine

CMa simple C Abstract Machine CMa simple C Abstract Machine CMa architecture An abstract machine has set of instructions which can be executed in an abstract hardware. The abstract hardware may be seen as a collection of certain data

More information

Scope. CSC 4181 Compiler Construction. Static Scope. Static Scope Rules. Closest Nested Scope Rule

Scope. CSC 4181 Compiler Construction. Static Scope. Static Scope Rules. Closest Nested Scope Rule Scope CSC 4181 Compiler Construction Scope and Symbol Table A scope is a textual region of the program in which a (name-to-object) binding is active. There are two types of scope: Static scope Dynamic

More information

The Procedure Abstraction Part I: Basics

The Procedure Abstraction Part I: Basics The Procedure Abstraction Part I: Basics Procedure Abstraction Begins Chapter 6 in EAC The compiler must deal with interface between compile time and run time Most of the tricky issues arise in implementing

More information

Object Oriented Methods : Deeper Look Lecture Three

Object Oriented Methods : Deeper Look Lecture Three University of Babylon Collage of Computer Assistant Lecturer : Wadhah R. Baiee Experience has shown that the best way to develop and maintain a large program is to construct it from small, simple pieces,

More information

The status of Babel Johannes L. Braams 1 Introduction In this article I will give an overview of what has happened to babel

The status of Babel Johannes L. Braams 1 Introduction In this article I will give an overview of what has happened to babel The status of Babel Johannes L. Braams j.l.braams@research.ptt.nl 1 Introduction In this article I will give an overview of what has happened to babel lately. First I will briey describe the history of

More information

A Run-time Assertion Checker for Java using JML

A Run-time Assertion Checker for Java using JML Computer Science Technical Reports Computer Science 5-1-2000 A Run-time Assertion Checker for Java using JML Abhay Bhorkar Follow this and additional works at: http://lib.dr.iastate.edu/cs_techreports

More information

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1 CME 305: Discrete Mathematics and Algorithms Instructor: Professor Aaron Sidford (sidford@stanford.edu) January 11, 2018 Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1 In this lecture

More information

Smallworld Core Spatial Technology 4 Smallworld MAGIK : The object oriented language for an object oriented world

Smallworld Core Spatial Technology 4 Smallworld MAGIK : The object oriented language for an object oriented world Smallworld Core Spatial Technology 4 Smallworld MAGIK : The object oriented language for an object oriented world 2004 General Electric Company. All Rights Reserved GER-4235 (09/04) Abstract In the late

More information

Why Pointers. Pointers. Pointer Declaration. Two Pointer Operators. What Are Pointers? Memory address POINTERVariable Contents ...

Why Pointers. Pointers. Pointer Declaration. Two Pointer Operators. What Are Pointers? Memory address POINTERVariable Contents ... Why Pointers Pointers They provide the means by which functions can modify arguments in the calling function. They support dynamic memory allocation. They provide support for dynamic data structures, such

More information

Institut fur Informatik, Universitat Klagenfurt. Institut fur Informatik, Universitat Linz. Institut fur Witschaftsinformatik, Universitat Linz

Institut fur Informatik, Universitat Klagenfurt. Institut fur Informatik, Universitat Linz. Institut fur Witschaftsinformatik, Universitat Linz Coupling and Cohesion in Object-Oriented Systems Johann Eder (1) Gerti Kappel (2) Michael Schre (3) (1) Institut fur Informatik, Universitat Klagenfurt Universitatsstr. 65, A-9020 Klagenfurt, Austria,

More information

The SUMO Speaker Series for Undergraduates. The Art Gallery Problem

The SUMO Speaker Series for Undergraduates. The Art Gallery Problem The SUMO Speaker Series for Undergraduates (food from Pizza Chicago) Wednesday, April 21 4:40-5:30, room 380C The Art Gallery Problem Amy Pang Abstract: Imagine you are the curator of an art gallery with

More information

Principle of Complier Design Prof. Y. N. Srikant Department of Computer Science and Automation Indian Institute of Science, Bangalore

Principle of Complier Design Prof. Y. N. Srikant Department of Computer Science and Automation Indian Institute of Science, Bangalore Principle of Complier Design Prof. Y. N. Srikant Department of Computer Science and Automation Indian Institute of Science, Bangalore Lecture - 20 Intermediate code generation Part-4 Run-time environments

More information

PROGRAMMING LANGUAGE PARADIGMS & THE MAIN PRINCIPLES OF OBJECT-ORIENTED PROGRAMMING

PROGRAMMING LANGUAGE PARADIGMS & THE MAIN PRINCIPLES OF OBJECT-ORIENTED PROGRAMMING 10.2478/cris-2013-0011 PROGRAMMING LANGUAGE PARADIGMS & THE MAIN PRINCIPLES OF OBJECT-ORIENTED PROGRAMMING NIKOLETTA MINAROVA 77 INTRODUCTION Since the first design concept of computers came into the world,

More information

Collision detection. Piotr Fulma«ski. 1 grudnia

Collision detection. Piotr Fulma«ski. 1 grudnia Collision detection Piotr Fulma«ski piotr@fulmanski.pl 1 grudnia 2016 Table of contents Collision in games Algorithms to detect collision in games depend on the type of shapes that can collide (e.g. rectangle

More information

The Procedure Abstraction

The Procedure Abstraction The Procedure Abstraction Procedure Abstraction Begins Chapter 6 in EAC The compiler must deal with interface between compile time and run time Most of the tricky issues arise in implementing procedures

More information

such internal data dependencies can be formally specied. A possible approach to specify

such internal data dependencies can be formally specied. A possible approach to specify Chapter 6 Specication and generation of valid data unit instantiations In this chapter, we discuss the problem of generating valid data unit instantiations. As valid data unit instantiations must adhere

More information

Absolute C++ Walter Savitch

Absolute C++ Walter Savitch Absolute C++ sixth edition Walter Savitch Global edition This page intentionally left blank Absolute C++, Global Edition Cover Title Page Copyright Page Preface Acknowledgments Brief Contents Contents

More information

On Meaning Preservation of a Calculus of Records

On Meaning Preservation of a Calculus of Records On Meaning Preservation of a Calculus of Records Emily Christiansen and Elena Machkasova Computer Science Discipline University of Minnesota, Morris Morris, MN 56267 chri1101, elenam@morris.umn.edu Abstract

More information

Lecturer: William W.Y. Hsu. Programming Languages

Lecturer: William W.Y. Hsu. Programming Languages Lecturer: William W.Y. Hsu Programming Languages Chapter 9 Data Abstraction and Object Orientation 3 Object-Oriented Programming Control or PROCESS abstraction is a very old idea (subroutines!), though

More information

Run-Time Environments/Garbage Collection

Run-Time Environments/Garbage Collection Run-Time Environments/Garbage Collection Department of Computer Science, Faculty of ICT January 5, 2014 Introduction Compilers need to be aware of the run-time environment in which their compiled programs

More information

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 43 Dynamic Binding (Polymorphism): Part III Welcome to Module

More information

CSC1322 Object-Oriented Programming Concepts

CSC1322 Object-Oriented Programming Concepts CSC1322 Object-Oriented Programming Concepts Instructor: Yukong Zhang February 18, 2016 Fundamental Concepts: The following is a summary of the fundamental concepts of object-oriented programming in C++.

More information

Chapter 1: Key Concepts of Programming and Software Engineering

Chapter 1: Key Concepts of Programming and Software Engineering Chapter 1: Key Concepts of Programming and Software Engineering Software Engineering Coding without a solution design increases debugging time - known fact! A team of programmers for a large software development

More information

CS 330 Lecture 18. Symbol table. C scope rules. Declarations. Chapter 5 Louden Outline

CS 330 Lecture 18. Symbol table. C scope rules. Declarations. Chapter 5 Louden Outline CS 0 Lecture 8 Chapter 5 Louden Outline The symbol table Static scoping vs dynamic scoping Symbol table Dictionary associates names to attributes In general: hash tables, tree and lists (assignment ) can

More information

The Java Programming Language

The Java Programming Language The Java Programming Language Slide by John Mitchell (http://www.stanford.edu/class/cs242/slides/) Outline Language Overview History and design goals Classes and Inheritance Object features Encapsulation

More information

CSC 148 Lecture 3. Dynamic Typing, Scoping, and Namespaces. Recursion

CSC 148 Lecture 3. Dynamic Typing, Scoping, and Namespaces. Recursion CSC 148 Lecture 3 Dynamic Typing, Scoping, and Namespaces Recursion Announcements Python Ramp Up Session Monday June 1st, 1 5pm. BA3195 This will be a more detailed introduction to the Python language

More information

Topics in Object-Oriented Design Patterns

Topics in Object-Oriented Design Patterns Software design Topics in Object-Oriented Design Patterns Material mainly from the book Design Patterns by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides; slides originally by Spiros Mancoridis;

More information

2.4 Structuring programs

2.4 Structuring programs 2.4 Structuring programs While theoretically a program could be written as one big expression, in reality we want some structure so that l The programmer has it easier to read the program l A compiler

More information

Anatomy of a Class Encapsulation Anatomy of a Method

Anatomy of a Class Encapsulation Anatomy of a Method Writing Classes Writing Classes We've been using predefined classes. Now we will learn to write our own classes to define objects Chapter 4 focuses on: class definitions instance data encapsulation and

More information

The goal of the Pangaea project, as we stated it in the introduction, was to show that

The goal of the Pangaea project, as we stated it in the introduction, was to show that Chapter 5 Conclusions This chapter serves two purposes. We will summarize and critically evaluate the achievements of the Pangaea project in section 5.1. Based on this, we will then open up our perspective

More information

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology exam Compiler Construction in4020 July 5, 2007 14.00-15.30 This exam (8 pages) consists of 60 True/False

More information

Department of Computer science and Engineering Sub. Name: Object oriented programming and data structures Sub. Code: EC6301 Sem/Class: III/II-ECE Staff name: M.Kavipriya Two Mark Questions UNIT-1 1. List

More information

PL/SQL Block structure

PL/SQL Block structure PL/SQL Introduction Disadvantage of SQL: 1. SQL does t have any procedural capabilities. SQL does t provide the programming technique of conditional checking, looping and branching that is vital for data

More information

CHAPTER 5 GENERAL OOP CONCEPTS

CHAPTER 5 GENERAL OOP CONCEPTS CHAPTER 5 GENERAL OOP CONCEPTS EVOLUTION OF SOFTWARE A PROGRAMMING LANGUAGE SHOULD SERVE 2 RELATED PURPOSES : 1. It should provide a vehicle for programmer to specify actions to be executed. 2. It should

More information

Programming Languages

Programming Languages Programming Languages Tevfik Koşar Lecture - VIII February 9 th, 2006 1 Roadmap Allocation techniques Static Allocation Stack-based Allocation Heap-based Allocation Scope Rules Static Scopes Dynamic Scopes

More information

Chapter 9 :: Data Abstraction and Object Orientation

Chapter 9 :: Data Abstraction and Object Orientation Chapter 9 :: Data Abstraction and Object Orientation Programming Language Pragmatics Michael L. Scott Control or PROCESS abstraction is a very old idea (subroutines!), though few languages provide it in

More information

Generating Continuation Passing Style Code for the Co-op Language

Generating Continuation Passing Style Code for the Co-op Language Generating Continuation Passing Style Code for the Co-op Language Mark Laarakkers University of Twente Faculty: Computer Science Chair: Software engineering Graduation committee: dr.ing. C.M. Bockisch

More information

CMPUT Language Paradigms. Programming Paradigms. Dr. B. Price & Dr. R. Greiner. 7th September Real languages draw upon multiple paradigms

CMPUT Language Paradigms. Programming Paradigms. Dr. B. Price & Dr. R. Greiner. 7th September Real languages draw upon multiple paradigms CMPUT 325 - Language Paradigms Dr. B. Price & Dr. R. Greiner 7th September 2004 Dr. B. Price & Dr. R. Greiner CMPUT 325 - Language Paradigms 1 Programming Paradigms Real languages draw upon multiple paradigms

More information

Dieter Gollmann, Yongfei Han, and Chris J. Mitchell. August 25, Abstract

Dieter Gollmann, Yongfei Han, and Chris J. Mitchell. August 25, Abstract Redundant integer representations and fast exponentiation Dieter Gollmann, Yongfei Han, and Chris J. Mitchell August 25, 1995 Abstract In this paper two modications to the standard square and multiply

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Winter 2017 Lecture 7b Andrew Tolmach Portland State University 1994-2017 Values and Types We divide the universe of values according to types A type is a set of values and

More information

Mozart System Limitations for Version (draft)

Mozart System Limitations for Version (draft) Mozart System Limitations for Version 1.3.0 (draft) Peter Van Roy and Seif Haridi April 28, 2004 In der Beschränkung zeigt sich erst der Meister. Within limitations the Master is first revealed. Johann

More information

Unit 7. Functions. Need of User Defined Functions

Unit 7. Functions. Need of User Defined Functions Unit 7 Functions Functions are the building blocks where every program activity occurs. They are self contained program segments that carry out some specific, well defined task. Every C program must have

More information

BASIC CONCEPT OF OOP

BASIC CONCEPT OF OOP Chapter-6 BASIC CONCEPT OF OOP Introduction: Object oriented programmingg is the principle of design and development of programs using modular approach. Object oriented programmingg approach provides advantages

More information

CS304 Object Oriented Programming Final Term

CS304 Object Oriented Programming Final Term 1. Which of the following is the way to extract common behaviour and attributes from the given classes and make a separate class of those common behaviours and attributes? Generalization (pg 29) Sub-typing

More information

Object-Oriented Languages and Object-Oriented Design. Ghezzi&Jazayeri: OO Languages 1

Object-Oriented Languages and Object-Oriented Design. Ghezzi&Jazayeri: OO Languages 1 Object-Oriented Languages and Object-Oriented Design Ghezzi&Jazayeri: OO Languages 1 What is an OO language? In Ada and Modula 2 one can define objects encapsulate a data structure and relevant operations

More information

This exam is worth 30 points, or 18.75% of your total course grade. The exam contains

This exam is worth 30 points, or 18.75% of your total course grade. The exam contains CS 60A Final May 16, 1992 Your name Discussion section number TA's name This exam is worth 30 points, or 18.75% of your total course grade. The exam contains six questions. This booklet contains eleven

More information

Object-Oriented Design (OOD) and C++

Object-Oriented Design (OOD) and C++ Chapter 2 Object-Oriented Design (OOD) and C++ At a Glance Instructor s Manual Table of Contents Chapter Overview Chapter Objectives Instructor Notes Quick Quizzes Discussion Questions Projects to Assign

More information

Assignment 4. Overview. Prof. Stewart Weiss. CSci 335 Software Design and Analysis III Assignment 4

Assignment 4. Overview. Prof. Stewart Weiss. CSci 335 Software Design and Analysis III Assignment 4 Overview This assignment combines several dierent data abstractions and algorithms that we have covered in class, including priority queues, on-line disjoint set operations, hashing, and sorting. The project

More information

NOTE: Answer ANY FOUR of the following 6 sections:

NOTE: Answer ANY FOUR of the following 6 sections: A-PDF MERGER DEMO Philadelphia University Lecturer: Dr. Nadia Y. Yousif Coordinator: Dr. Nadia Y. Yousif Internal Examiner: Dr. Raad Fadhel Examination Paper... Programming Languages Paradigms (750321)

More information

Implementations of Dijkstra's Algorithm. Based on Multi-Level Buckets. November Abstract

Implementations of Dijkstra's Algorithm. Based on Multi-Level Buckets. November Abstract Implementations of Dijkstra's Algorithm Based on Multi-Level Buckets Andrew V. Goldberg NEC Research Institute 4 Independence Way Princeton, NJ 08540 avg@research.nj.nec.com Craig Silverstein Computer

More information

2 The Service Provision Problem The formulation given here can also be found in Tomasgard et al. [6]. That paper also details the background of the mo

2 The Service Provision Problem The formulation given here can also be found in Tomasgard et al. [6]. That paper also details the background of the mo Two-Stage Service Provision by Branch and Bound Shane Dye Department ofmanagement University of Canterbury Christchurch, New Zealand s.dye@mang.canterbury.ac.nz Asgeir Tomasgard SINTEF, Trondheim, Norway

More information

References and pointers

References and pointers References and pointers Pointers are variables whose value is a reference, i.e. an address of a store location. Early languages (Fortran, COBOL, Algol 60) had no pointers; added to Fortran 90. In Pascal,

More information

What is Polymorphism? Quotes from Deitel & Deitel s. Why polymorphism? How? How? Polymorphism Part 1

What is Polymorphism? Quotes from Deitel & Deitel s. Why polymorphism? How? How? Polymorphism Part 1 Polymorphism Part 1 What is Polymorphism? Polymorphism refers to a programming language s ability to process objects differently depending on their data type or class. Number person real complex kid adult

More information

Comp 249 Programming Methodology Chapter 8 - Polymorphism

Comp 249 Programming Methodology Chapter 8 - Polymorphism Comp 249 Programming Methodology Chapter 8 - Polymorphism Dr. Aiman Hanna Department of Computer Science & Software Engineering Concordia University, Montreal, Canada These slides has been extracted, modified

More information

The Compositional C++ Language. Denition. Abstract. This document gives a concise denition of the syntax and semantics

The Compositional C++ Language. Denition. Abstract. This document gives a concise denition of the syntax and semantics The Compositional C++ Language Denition Peter Carlin Mani Chandy Carl Kesselman March 12, 1993 Revision 0.95 3/12/93, Comments welcome. Abstract This document gives a concise denition of the syntax and

More information

Object-Oriented Principles and Practice / C++

Object-Oriented Principles and Practice / C++ Object-Oriented Principles and Practice / C++ Alice E. Fischer September 26, 2016 OOPP / C++ Lecture 4... 1/33 Global vs. Class Static Parameters Move Semantics OOPP / C++ Lecture 4... 2/33 Global Functions

More information

See the CS 2704 notes on C++ Class Basics for more details and examples. Data Structures & OO Development I

See the CS 2704 notes on C++ Class Basics for more details and examples. Data Structures & OO Development I Polynomial Class Polynomial(); Polynomial(const string& N, const vector& C); Polynomial operator+(const Polynomial& RHS) const; Polynomial operator-(const Polynomial& RHS) const; Polynomial operator*(const

More information

Transparent Access to Legacy Data in Java. Olivier Gruber. IBM Almaden Research Center. San Jose, CA Abstract

Transparent Access to Legacy Data in Java. Olivier Gruber. IBM Almaden Research Center. San Jose, CA Abstract Transparent Access to Legacy Data in Java Olivier Gruber IBM Almaden Research Center San Jose, CA 95120 Abstract We propose in this paper an extension to PJava in order to provide a transparent access

More information

CLASSES AND OBJECTS IN JAVA

CLASSES AND OBJECTS IN JAVA Lesson 8 CLASSES AND OBJECTS IN JAVA (1) Which of the following defines attributes and methods? (a) Class (b) Object (c) Function (d) Variable (2) Which of the following keyword is used to declare Class

More information

Object-Oriented Programming Paradigm

Object-Oriented Programming Paradigm Object-Oriented Programming Paradigm Sample Courseware Object-Oriented Programming Paradigm Object-oriented programming approach allows programmers to write computer programs by representing elements of

More information

OOPS Viva Questions. Object is termed as an instance of a class, and it has its own state, behavior and identity.

OOPS Viva Questions. Object is termed as an instance of a class, and it has its own state, behavior and identity. OOPS Viva Questions 1. What is OOPS? OOPS is abbreviated as Object Oriented Programming system in which programs are considered as a collection of objects. Each object is nothing but an instance of a class.

More information

6.001 Notes: Section 6.1

6.001 Notes: Section 6.1 6.001 Notes: Section 6.1 Slide 6.1.1 When we first starting talking about Scheme expressions, you may recall we said that (almost) every Scheme expression had three components, a syntax (legal ways of

More information

CS1004: Intro to CS in Java, Spring 2005

CS1004: Intro to CS in Java, Spring 2005 CS1004: Intro to CS in Java, Spring 2005 Lecture #13: Java OO cont d. Janak J Parekh janak@cs.columbia.edu Administrivia Homework due next week Problem #2 revisited Constructors, revisited Remember: a

More information

CMSC 132: Object-Oriented Programming II

CMSC 132: Object-Oriented Programming II CMSC 132: Object-Oriented Programming II Java Support for OOP Department of Computer Science University of Maryland, College Park Object Oriented Programming (OOP) OO Principles Abstraction Encapsulation

More information

Compiler Theory. (Semantic Analysis and Run-Time Environments)

Compiler Theory. (Semantic Analysis and Run-Time Environments) Compiler Theory (Semantic Analysis and Run-Time Environments) 005 Semantic Actions A compiler must do more than recognise whether a sentence belongs to the language of a grammar it must do something useful

More information

Runtime Environments I. Basilio B. Fraguela

Runtime Environments I. Basilio B. Fraguela Runtime Environments I Basilio B. Fraguela Runtime System Responsibilities Allocation of storage for program data Sometimes also deallocation Garbage collection Management of data structures the compiled

More information

C. E. McDowell August 25, Baskin Center for. University of California, Santa Cruz. Santa Cruz, CA USA. abstract

C. E. McDowell August 25, Baskin Center for. University of California, Santa Cruz. Santa Cruz, CA USA. abstract Unloading Java Classes That Contain Static Fields C. E. McDowell E. A. Baldwin 97-18 August 25, 1997 Baskin Center for Computer Engineering & Information Sciences University of California, Santa Cruz Santa

More information

Path Consistency Revisited. Moninder Singh. University of Pennsylvania. Philadelphia, PA

Path Consistency Revisited. Moninder Singh. University of Pennsylvania. Philadelphia, PA Proceedings of the 7th IEEE International Conference on Tools with Articial Intelligence, 318-325, 1995. c Institute of Electrical and Electronics Engineers, Inc. (IEEE). Path Consistency Revisited Moninder

More information

A Meta-Model for Composition Techniques in Object-Oriented Software Development

A Meta-Model for Composition Techniques in Object-Oriented Software Development A Meta-Model for Composition Techniques in Object-Oriented Software Development Bedir Tekinerdogan Department of Computer Science University of Twente P.O. Box 217, 7500 AE Enschede, The Netherlands E-Mail:

More information

Homework 6. Reading. Problems. Handout 7 CS242: Autumn November

Homework 6. Reading. Problems. Handout 7 CS242: Autumn November Homework 6 Due 14 November, 5PM Handout 7 CS242: Autumn 2012 7 November Reading 1. Chapter 10, section 10.2.3 2. Chapter 11, sections 11.3.2, and 11.7 3. Chapter 12, section 12.4 4. Chapter 13, section

More information

Polymorphism Part 1 1

Polymorphism Part 1 1 Polymorphism Part 1 1 What is Polymorphism? Polymorphism refers to a programming language s ability to process objects differently depending on their data type or class. Number person real complex kid

More information

Object Model. Object Orientated Analysis and Design. Benjamin Kenwright

Object Model. Object Orientated Analysis and Design. Benjamin Kenwright Object Model Object Orientated Analysis and Design Benjamin Kenwright Outline Submissions/Quizzes Review Object Orientated Programming Concepts (e.g., encapsulation, data abstraction,..) What do we mean

More information

Two Key JDK 10 Features

Two Key JDK 10 Features Supplement to Java: The Complete Reference, Tenth Edition Two Key JDK 10 Features This supplement to Java: The Complete Reference, Tenth Edition discusses two key features added by JDK 10. It is provided

More information

EMBEDDED SYSTEMS PROGRAMMING OO Basics

EMBEDDED SYSTEMS PROGRAMMING OO Basics EMBEDDED SYSTEMS PROGRAMMING 2014-15 OO Basics CLASS, METHOD, OBJECT... Class: abstract description of a concept Object: concrete realization of a concept. An object is an instance of a class Members Method:

More information

Chapter 10 :: Data Abstraction and Object Orientation

Chapter 10 :: Data Abstraction and Object Orientation Chapter 10 :: Data Abstraction and Object Orientation Programming Language Pragmatics, Fourth Edition Michael L. Scott Copyright 2016 Elsevier Chapter10_Data_Abstraction_and_Object_Orientation_4e 1 Object-Oriented

More information