GOO: a Generative Object-Oriented Language

Size: px
Start display at page:

Download "GOO: a Generative Object-Oriented Language"

Transcription

1 Position paper for the ECOOP 02 workshop on generative programming GOO: a Generative Object-Oriented Language Ulrik P. Schultz Center for Pervasive Computing University of Aarhus, Denmark Wednesday 10th of April Abstract This position paper describes GOO, a generative object-oriented language. GOO is based on automatic program specialization principles intimately integrated with the object-oriented paradigm. The result is an object-oriented language well-suited for generative programming, where inheritance and virtual dispatches are used to drive the program generation process. In more detail, I give a few basic examples of using GOO for specialization and generative programming, describe the semantics of GOO, and outline the most important issues in designing a type system for GOO. 1 Introduction Template metaprogramming is a powerful mechanism that allows tailored programs to be generated from program parts parameterized using C++ templates [5, 19]. This technique has the advantage of being usable with any ANSI-compliant C++ compiler, and it guarantees that all configuration is performed by the compiler before the program is executed. However, the syntax used for template metaprogramming is far removed from standard programming languages, and the semantics more closely resemble that of a rewriting system than object-oriented programming. As an alternative to template metaprogramming, automatic program specialization can be used [14, 16, 17, 18]. Rather than expressing the generator program using templates, the generator program is implemented using standard object-oriented abstractions, and then specialized to obtain a tailored program. Specifically, the generator program is implemented as a generic object-oriented program, and specialization configures the program by optimizing away computations that depend on configuration information. Nonetheless, automatic program specialization suffers from poor predictability compared to template metaprogramming, and is not a perfect match for object-oriented languages since it relies on aspect-oriented programming to express configuration information as well as the resulting program [15]. In this position paper I describe a work-in-progress on an object-oriented language, named GOO, that integrates automatic program specialization. Unlike most other approaches to generative programming, GOO is driven by inheritance and lets the generator program be expressed using object-oriented abstractions. The rest of this paper is organized as follows: I first introduce GOO using a small example from automatic program specialization, then I discuss the semantics and type system of GOO, and last I investigate a more standard generative programming example using GOO. 1

2 class Power { op: BinOp; exp: int; int result = this.op.neutral(); int n = this.exp; while(n>0) { n = n-1; result = this.op.apply(result,base); return result; class BinOp { abstract int apply(i,j: int); abstract int neutral(); class Mul extends BinOp { int apply(x,y: int) { return x*y; int neutral() { return 1; class Add extends BinOp { int apply(x,y: int) { return x+y; int neutral() { return 0; Figure 1: The basic power program in GOO 2 GOO example: the power class Figure 1 shows the implementation of a power function in GOO. The Power class has fields exp and op which contain the exponent and the operator to apply, respectively. The operator is declared to be at least a BinOp, meaning that it can contain an instance of BinOp or any subclass. GOO allows covariant specialization of fields in subclasses similarly to the Beta language [10], so a subclass MulPower of Power could be declared as follows: class MulPower extends Power { op: Mul; Here, the operator has to be at an instance of Mul or a subclass. (Note that, unlike in Java, here it is the same field that is made more specific, not a new field which shadows the original one.) It is also possibly to specify a final binding, as follows: class MulPowerFinal extends Power { op:: Mul; Here, the operator can only be an instance of Mul, subclasses are not allowed. In standard object-oriented languages, such type declarations are used for typechecking purposes only. The core idea of GOO is to use the covariant type declarations to specialize the methods of the class when making a subclass, similarly to customization [3]. But unlike customization methods are specialized both for the type of the self and for the declarations on the types of the object fields. Thus, both the MulPower class and the MulPowerFinal class of the previous paragraph would cause the methods in 2

3 User code: class MulPower extends Power { op: Mul; Compiler-generated code: class MulPower extends Power { op: Mul; int result = 1; int n = this.exp; while(n>0) { n = n-1; result = this.op.mul::apply(result,base); return result; Optimized, compiler-generated code: class MulPower extends Power { op: Mul; int result = 1; int n = this.exp; while(n>0) { n = n-1; result = result*base; return result; Figure 2: Specializing the Power class, step 1 the Power class to be specialized for the information that the field exp is of type Mul (this information can be deduced for MulPower since Mul has no subclasses). This specialization is illustrated in Figure 2. User code is what the programmer writes, and Compiler-generated code is the code automatically generated by GOO. Optimized compiler-generated code is what a compiler trivially can generate based on the compiler-generated code. In the compiler generated code, the specialization process has resolved all virtual calls to this.op, which allows the neutral value to be propagated into the body of the method, and allows the apply method to be called using a direct method call (the syntax x.c::f(...) means call the method f of the class C with the object x as the self). A compiler can trivially inline the definition of the apply method into the raise method. A second important concept in GOO is to specialize not just for object types, but for any kind of value. To this end, GOO uses a generalized subtyping relation similar to Cardelli s power type [1], where concrete values are subtypes of the type they belong to. 1 For example, the constant 3 is a subtype of the type int, sowe can further specialize the MulPower class for a specific operator, as illustrated in Figure 3. Here, we specify that the exponent is the value 3, which allows the loop 1 Note that the term power type is unrelated to the arithmetic power computation used in the example. 3

4 User code: class MulPower3 extends MulPower { exp:: 3; Compiler-generated code: class MulPower3 extends MulPower { exp:: 3; result = this.op.mul::apply(1,base); result = this.op.mul::apply(result,base); result = this.op.mul::apply(result,base); return result; Optimized, compiler-generated code: class MulPower3 extends Power3 { exp:: 3; return base*base*base; Figure 3: Specializing the power program, step 2 inside the raise method to be unrolled. The result after optimization is an efficient implementation where multiplications are done directly three times on the base value. Since GOO is an object-oriented language, the generalized subtyping relation is also used for objects. Intuitively, an instance of a given class is a subtype of this class, and an instance of a given class is a subtype of any instance of any superclass of the class. In effect, the less is known about an object, the higher it is in the subtyping relation. As an example, we could also have specialized the power class by specifying that the op fields holds a reference to a concret object, as illustrated in Figure 4. The program can be simplified as before, with the exception that the unique object specified in the declaration of op has to be used when invoking the apply method. In the current implementation of GOO, code is generated at run time, and the address of the object is simply residualized in the program code. There are many other ways of dealing with object values during specialization; see next section for details. By providing a concrete object instance, specialization of the method can manipulate the object and therefore perform further optimizations; for example, the object can be compared to other objects. I have implemented a minimal version of GOO that has been used to automatically perform the program generation illustrated in this section (whereas the example of Section 4 is not yet supported by my implementation). The implementation has been done as an interpreter written in SML/NJ [13]; currently all code generation is done at runtime as the program is being interpreted. GOO is strongly inspired by ongoing research in extensions to the Beta language, and the syntax that I currently use is perhaps most precisely described as Beta syntax with Haskell-style function declarations; for this reason, in this paper I use a manually pretty-printed syntax that more closely resembles Java. 4

5 User code: class MulPowerAlt extends Power { op:: new Mul(); Compiler-generated code: class MulPowerAlt extends Power { op:: new Mul(); int result = 1; int n = this.exp; while(n>0) { n = n-1; // assuming address stored in op is 0x02 result = 0x02.Mul::apply(result,base); return result; Optimized, compiler-generated code: see Figure 3. Figure 4: Specializing the power program using an object instance 3 GOO semantics, types and challenges Giving a complete description of the GOO semantics is of course out of the scope of this position paper, but I summarize the specialization process and the execution semantics. As for a type system, GOO currently does not have one, but I will discuss some of the issues in creating a type system. Last, I have a few comments on making GOO a more realistic language. 3.1 GOO semantics A GOO program consists of a set of classes and a main statement. When the program is interpreted, each class is processed in sequence, and any methods that are not inherited from the superclass (e.g., not overridden) are specialized according to the type information for the fields. A method is specialized using a mix of standard on-line specialization techniques for imperative languages [12] and techinques from existing work on off-line automatic program specialization for object-oriented languages adapted to work in an on-line fashion. Standard on-line techniques allow specialization for values stored in local variables. In addition, known type information (including concrete values) for fields is propagated throughout the method using the same mechanism. The immutability of the type declarations simplifies the process since no side-effects on objects occur during specialization. (Specializing for the values provided in the constructor, similarly to instantiation-time specialization [14], is not done, since it would leave the user with no place to specify values for which specialization should not take place, and would furthermore not have the same immutability properties.) Briefly, the transformations performed by specialization are as follows: known values from object fields are constant-propagated throughout the program, virtual dispatches are eliminated when the type of the receiver object is known, and any imperative computations that depend only on known values are reduced (conditionals with known tests are eliminated, loops with known tests are unrolled, etc.). 5

6 New specialized methods are generated for a virtual dispatch when the self or any of the arguments are known. Speculative evaluation of virtual dispatches can also be supported by allowing virtual prefixes [7, 11], as described in the appendix. During program execution, operations on objects are completely standard: field references and method invocations are performed as expected. The type declarations can impose strong restrictions on what values can be stored in a field and passed as arguments to methods. A field that has been specified equal to a given object can only be assigned this object. Similarly, a method parameter that has an object instance as its type can only be called with this object as an argument (see the appendix for details). 3.2 GOO type system Type checking a GOO program is (at least to some extent) done by the specialization process, which also means that type checking is not guaranteed to terminate, since arbitrary computations can be performed during the specialization process. From a typechecking point of view, GOO needs both virtual prefixes and covariant types for fields and method parameters, which is known to be difficult [11]. It remains unclear whether a type checking process driven by a specializer can statically type check such programs, or whether a more traditional type checker is needed as a second pass to ensure static typing. An interesting extension would to be let the GOO type system include a special kind of type modifier to represent something in between a traditional type and a traditional value, e.g. the type known int is a subtype of int, and any concrete number is a subtype of known int. We can then enforce that for a class to be instantiable, any known type inherited from the superclass must be specified as a concrete value. Thus, fields with a known type behave similarly to abstract methods. Such a known type could be used to specify e.g. that a field of type integer has to be assigned a concrete value in a subclass for the class to be instantiable. Propagating the known type throughout the class definition corresponds to bindingtime analysis in off-line specialization, and supplying a concrete value then results in the class being specialized. Based on a class annotated with known types, an optimizing implementation of GOO could predetermine all specialization actions, to make run-time code-generation highly efficient [4]. Specialization remains less predictable than template metaprogramming, even if the simplified specialization mechanism in GOO gives fairly predictable results (e.g., access to a field for type which information was specified always returns a known value, since type information is immutable) [15]. To improve predictability, type assertions could be added, so that at key points in the program it can be verified that a variable contains at least a known value. 3.3 Realistic GOO The GOO language as presented in this paper (1) generates possibly redundant specialized methods for every subclass, (2) residualizes object pointers inside compiled code, and (3) relies heavily on compiler optimizations such as inlining for an efficient result. Let me address these problems in turn. Code explosion: A key observation to reduce the number of methods generated is that a program which terminates in standard GOO also terminates if no methods are generated at run-time. Thus, methods could be generated dynamically based on profile information to optimize program hotspots, or method generation could be statically controlled by programmer annotations. 6

7 class Counter { CounterType:< integral; counter, increment: CounterType; filter: Filter; CounterType get_counter() { return this.counter; void inc() { this.counter = this.counter+this.increment; this.counter = this.filter.apply(this.counter); class Filter { abstract int apply(i: int); class Id extends Filter { int apply(i: int) { return i; class Wrap extends Filter { CounterType:< integral; bound: CounterType; CounterType apply(x: CounterType) { if(x>this.bound) return 0 else return x; Figure 5: The basic counter example in GOO Residualized pointers: The standard solution to avoid residualizing object pointers is use-sensitivity [9], which instead residualizes the program parts needed to pass the value to its destination. However, I am currently considering a alternative solution based on residualization of the run-time object structure of the program as code that can recreate the structure, but block structure is a complicating factor. Compiler optimization dependency: In a dynamic compilation system, the optimizations needed by GOO are best left to the compiler. I am strongly considering an execution model where Java code is generated by the GOO system, which would allow existing dynamic compilers for Java to be used. In a static system, a dedicated inliner and optimizer would probably need to be integrated into the GOO specialization mechanism. Naturally, there are many other problems as well, but these are the most significant issues that I ve run into so far, apart from speculative specialization of virtual dispatches which is discussed in the appendix. 4 Real generative programming: a counter At last year s ECOOP WGP, the counter example was used frequently to illustrate generative programming; in this example, a counter of integral type that can reset at a given limit is encapsulated inside an object. The counter example can be written in GOO as well, as illustrated in Figure 5. The class Counter contains a type variable for the counter type CounterType which is declared to be the same type as or a subtype of the type integral (I assume a common supertype integral for int, short etc.). In addition, Counter contains fields for the counter value, an increment, and an object that filters the counter value at each increment. Filters 7

8 User code: class Simple100Counter extends Counter { CounterType:< int; increment:: 1; filter:: Wrap_100; class Wrap_100 extends Wrap { CounterType:< integral; bound:: 100; Optimized, compiler-generated code: class Simple100Counter extends Counter {... void inc() { this.counter = this.counter+1; if( this.counter>100 ) this.counter = 0; Figure 6: Generating a counter implementation [manually generated] can either be the identity (i.e., no filtering) or a filter that wraps at a given bound (i.e., resets the counter). To generate a specific implementation of the counter, we use the class Simple- 100Counter shown at the top of Figure 6. This class specifies the counter type to be int, the increment to be 1, and the filter to be one that resets at a fixed bound. In the generated Simple100Counter class, the inc operation has been specialized to increment the counter by one and wrap at 100, as is shown in the optimized version. The versatile nature of GOO is illustrated by the fact that we can freely choose any subset of configuration parameters as fixed, and leave the rest as standard fields that can be modified dynamically. As a next step in the development of GOO, I am experimenting with more complex generative programming examples, such as lists and matrices [5], and in addition more examples from automatic program specialization for object-oriented languages. An obvious improvement to the specialization techniques presented here includes object inlining, where non-escaping, partially known objects are eliminated in compiled classes [14]. A Some technical details In this appendix I discuss some technical details related to the use of placeholder classes, specialization for the value of a method parameter, and speculative evaluation of virtual dispatches. A placeholder class is needed when subclassing introduces specialized methods in another class. As an example, consider the two classes X and Add: class X { a: Add; i: int; int f() { return a.add(this.i); class Add { j: int; int add(i: int) { return i+this.j; Specializing the X class with a specific value of i implies specializing the add method of Add. This method has to be placed somewhere, which has to be indicated by the programmer, with a place-holder class, as follows: class X extends X { a: Add_spec; i:: 1; 8

9 class Add_spec extends Add; Here, Add spec is a placeholder class, which can be filled in by the compiler as needed. The result is the following program: class X extends X { a: Add_spec; i:: 1; int f() { return a.add(1); class Add_spec extends Add { int add(i:: 1) { return 1+this.j; The compiler has added a specialized add method in the placeholder class. Without the use of placeholder classes, either specialized methods could not be added to other classes (which would be unacceptable), or there would be no programmer control of what new classes were created when specializing. In the latter case, if anewadd spec was automatically created, then the programmer could not ensure that only instances of this specific class was assigned to the field a. When specializing a method for a known argument value, not only is the method body specialized according to this value, but the signature of the method changes as well: the method can only be invoked if it is passed the exact value for which it was specialized. For this reason, one would typically create wrapper methods that invoke the specialized method with the correct argument. An interesting alternative would be to use a mechanism similar to predicate dispatching [2], but such an extension would perhaps be too complex. A virtual dispatch where the receiver object is unknown but some arguments are known can be specialized speculatively by generating new specialized methods for each of the potential receiver classes. With GOO, these specialized methods need to be placed in subclasses of the existing class hierarchy; in effect, a whole hierarchy of classes needs to be specialized together. Virtual prefixes allows a hierarchy of of classes nested inside a class to be specialized together in a subclass (for a recent example, see Ernst s family polymorphism [8]). I am currently working on extending GOO to use this mechanism to implement speculative evaluation of virtual dispatches. References [1] Luca Cardelli. Structural subtyping and the notion of power type. In Conference Record of the Fifteenth Annual ACM Symposium on Principles of Programming Languages, San Diego, pages 70 79, San Diego, California, [2] C. Chambers. Predicate classes. In Proceedings of the European Conference on Object-oriented Programming (ECOOP 93), volume 707 of Lecture Notes in Computer Science, pages , Kaiserstautern, Germany, July Springer-Verlag. [3] C. Chambers and D. Ungar. Customization: Optimizing compiler technology for SELF, A dynamically-typed object-oriented programming language. In Bruce Knobe, editor, Proceedings of the SIGPLAN 89 Conference on Programming Language Design and Implementation (PLDI 89), pages , Portland, OR, USA, June ACM Press. [4] C. Consel and F. Noël. A general approach for run-time specialization and its application to C. In Conference Record of the 23 rd Annual ACM SIGPLAN- SIGACT Symposium on Principles Of Programming Languages (POPL 96), pages , St. Petersburg Beach, FL, USA, January ACM Press. [5] Krzysztof Czarnecki and Ulrich W. Eisenecker. Generative Programming: Methods, Tools, and Applications. Addison-Wesley,

10 [6] Proceedings of the European Conference on Object-oriented Programming (ECOOP 99), volume 1628 of Lecture Notes in Computer Science, Lisbon, Portugal, June Springer-Verlag. [7] Erik Ernst. Propagating class and method combination. In ECOOP 99 [6], pages [8] Erik Ernst. Family polymorphism. In Jørgen Lindskov Knudsen, editor, Proceedings of the 15th European Conference on Object-oriented Programming (ECOOP 2001), volume 2072 of Lecture Notes in Computer Science, pages Springer-Verlag, June [9] L. Hornof, J. Noyé, and C. Consel. Effective specialization of realistic programs via use sensitivity. In P. Van Hentenryck, editor, Proceedings of the Fourth International Symposium on Static Analysis (SAS 97), volume 1302 of Lecture Notes in Computer Science, pages , Paris, France, September Springer-Verlag. [10] O.L. Madsen, B. Møller-Pedersen, and K. Nygaard. Object-oriented programming in the Beta programming language. Addison-Wesley, Reading, MA, USA, [11] Ole Lehrmann Madsen and Birger Møller-Pedersen. Virtual classes: a powerful mechanism in object-oriented programming. In Conference proceedings on Object-oriented programming systems, languages and applications, pages , New Orleans, Louisiana, United States, [12] U. Meyer. Techniques for partial evaluation of imperative languages. In Partial Evaluation and Semantics-Based Program Manipulation (PEPM 91), pages , New Haven, CT, USA, September ACM SIGPLAN Notices, 26(9). [13] R. Milner, M. Tofte, R. Harper, and D. MacQueen. The Definition of Standard ML (Revised). The MIT Press, [14] U.P. Schultz. Object-Oriented Software Engineering Using Partial Evaluation. PhD thesis, University of Rennes I, Rennes, France, December [15] U.P. Schultz. Object-oriented program specialization: Aspects into aspects or maybe not?, June Position paper at Workshop for Generative Programming, ECOOP [16] U.P. Schultz. Partial evaluation for class-based object-oriented languages. In O. Danvy and A. Filinski, editors, Symposium on Programs as Data Objects II, volume 2053 of Lecture Notes in Computer Science, pages , Aarhus, Denmark, May [17] U.P. Schultz and C. Consel. Automatic program specialization for Java. DAIMI Technical Report PB-551, DAIMI, University of Aarhus, December [18] U.P. Schultz, J. Lawall, C. Consel, and G. Muller. Towards automatic specialization of Java programs. In ECOOP 99 [6], pages [19] T.L. Veldhuizen. C++ templates as partial evaluation. In ACM SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipulation (PEPM 98), pages 13 18, San Antonio, TX, USA, January ACM Press. 10

Black-Box Program Specialization

Black-Box Program Specialization Published in Technical Report 17/99, Department of Software Engineering and Computer Science, University of Karlskrona/Ronneby: Proceedings of WCOP 99 Black-Box Program Specialization Ulrik Pagh Schultz

More information

Call by Declaration. Erik Ernst 1. Dept. of Computer Science, University of Aarhus, Denmark

Call by Declaration. Erik Ernst 1. Dept. of Computer Science, University of Aarhus, Denmark Call by Declaration Erik Ernst 1 Dept. of Computer Science, University of Aarhus, Denmark eernst@daimi.au.dk Abstract. With traditional inheritance mechanisms, a subclass is able to use inherited features

More information

Towards Automatic Partial Evaluation for the C++ Language. Robert Anisko

Towards Automatic Partial Evaluation for the C++ Language. Robert Anisko Towards Automatic Partial Evaluation for the C++ Language Robert Anisko May 27, 2002 Partial evaluation is a high-level optimization technique that, given a program text and some of its input, generates

More information

Advances in Programming Languages

Advances in Programming Languages T O Y H Advances in Programming Languages APL8: Multiparameter Type Classes, Constructor Classes Ian Stark School of Informatics The University of Edinburgh Thursday 4 February Semester 2 Week 4 E H U

More information

What is Type-Safe Code Reuse?

What is Type-Safe Code Reuse? What is Type-Safe Code Reuse? Jens Palsberg palsberg@daimi.au.dk Michael I Schwartzback mis@daimi.au.dk Department of Computer Science, Aarhus University Ny Munkegade, DK-8000 Århus C, Denmark December

More information

Outlook on Composite Type Labels in User-Defined Type Systems

Outlook on Composite Type Labels in User-Defined Type Systems 34 (2017 ) Outlook on Composite Type Labels in User-Defined Type Systems Antoine Tu Shigeru Chiba This paper describes an envisioned implementation of user-defined type systems that relies on a feature

More information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss Chapter 1 terminology (parenthesized numbers are page numbers) Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement

More information

Typed Racket: Racket with Static Types

Typed Racket: Racket with Static Types Typed Racket: Racket with Static Types Version 5.0.2 Sam Tobin-Hochstadt November 6, 2010 Typed Racket is a family of languages, each of which enforce that programs written in the language obey a type

More information

Implementing Reusable Collaborations with Delegation Layers

Implementing Reusable Collaborations with Delegation Layers Implementing Reusable Collaborations with Delegation Layers Klaus Ostermann Siemens AG, Corporate Technology SE 2 D-81730 Munich, Germany Klaus.Ostermann@mchp.siemens.de ABSTRACT It has been recognized

More information

Efficient Separate Compilation of Object-Oriented Languages

Efficient Separate Compilation of Object-Oriented Languages Efficient Separate Compilation of Object-Oriented Languages Jean Privat, Floréal Morandat, and Roland Ducournau LIRMM Université Montpellier II CNRS 161 rue Ada 34392 Montpellier cedex 5, France {privat,morandat,ducour}@lirmm.fr

More information

Partial Evaluation for Class-Based Object-Oriented Languages

Partial Evaluation for Class-Based Object-Oriented Languages c 2000 Springer-Verlag, published in LNCS 2053: Proceedings of PADO-II Partial Evaluation for Class-Based Object-Oriented Languages Ulrik Schultz DAIMI, University of Aarhus, ups@daimi.au.dk Abstract.

More information

A static and complete object-oriented model in C++

A static and complete object-oriented model in C++ A static and complete object-oriented model in C++ mixing benefits of traditional OOP and static programming Nicolas Burrus, Thierry Géraud, David Lesage, Raphaël Poss EPITA Research and Development Laboratory

More information

Late-bound Pragmatical Class Methods

Late-bound Pragmatical Class Methods Late-bound Pragmatical Class Methods AXEL SCHMOLITZKY, MARK EVERED, J. LESLIE KEEDY, GISELA MENGER Department of Computer Structures University of Ulm 89069 Ulm, Germany {axel, markev, keedy, gisela@informatik.uni-ulm.de

More information

A Short Summary of Javali

A Short Summary of Javali A Short Summary of Javali October 15, 2015 1 Introduction Javali is a simple language based on ideas found in languages like C++ or Java. Its purpose is to serve as the source language for a simple compiler

More information

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix PGJC4_JSE8_OCA.book Page ix Monday, June 20, 2016 2:31 PM Contents Figures Tables Examples Foreword Preface xix xxi xxiii xxvii xxix 1 Basics of Java Programming 1 1.1 Introduction 2 1.2 Classes 2 Declaring

More information

The Typed Racket Guide

The Typed Racket Guide The Typed Racket Guide Version 5.3.6 Sam Tobin-Hochstadt and Vincent St-Amour August 9, 2013 Typed Racket is a family of languages, each of which enforce

More information

Object-Oriented Concepts and Principles (Adapted from Dr. Osman Balci)

Object-Oriented Concepts and Principles (Adapted from Dr. Osman Balci) Object-Oriented Concepts and Principles (Adapted from Dr. Osman Balci) Sung Hee Park Department of Mathematics and Computer Science Virginia State University September 18, 2012 The Object-Oriented Paradigm

More information

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 17: Types and Type-Checking 25 Feb 08

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 17: Types and Type-Checking 25 Feb 08 CS412/CS413 Introduction to Compilers Tim Teitelbaum Lecture 17: Types and Type-Checking 25 Feb 08 CS 412/413 Spring 2008 Introduction to Compilers 1 What Are Types? Types describe the values possibly

More information

State Pattern supporting both composite States and extension/specialization of State Machines

State Pattern supporting both composite States and extension/specialization of State Machines Pattern supporting both composite s and extension/specialization of Machines BIRGER MØLLER-PEDERSEN, RAGNHILD KOBRO RUNDE, University of Oslo, Norway Most modelling languages support full state machine

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

On the Role of Language Constructs for Framework Design COT/ Centre for Object Technology

On the Role of Language Constructs for Framework Design COT/ Centre for Object Technology On the Role of Language Constructs for Framework Design COT/4-10-1.0 C * O T Centre for Object Technology Centre for Object Technology Revision history: 07-07-97 v1.0 Submitted version Author(s): Status:

More information

CS 565: Programming Languages. Spring 2008 Tu, Th: 16:30-17:45 Room LWSN 1106

CS 565: Programming Languages. Spring 2008 Tu, Th: 16:30-17:45 Room LWSN 1106 CS 565: Programming Languages Spring 2008 Tu, Th: 16:30-17:45 Room LWSN 1106 Administrivia Who am I? Course web page http://www.cs.purdue.edu/homes/peugster/cs565spring08/ Office hours By appointment Main

More information

On the Interaction of Method Lookup and Scope with Inheritance and Nesting

On the Interaction of Method Lookup and Scope with Inheritance and Nesting On the Interaction of Method Lookup and Scope with Inheritance and Nesting Gilad Bracha Cadence Design Systems gilad@cadence.com Abstract. Languages that support both inheritance and nesting of declarations

More information

Chapter 11 Object and Object- Relational Databases

Chapter 11 Object and Object- Relational Databases Chapter 11 Object and Object- Relational Databases Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 11 Outline Overview of Object Database Concepts Object-Relational

More information

More about Formatting. Olivier Danvy. Aarhus University. December Abstract

More about Formatting. Olivier Danvy. Aarhus University. December Abstract More about Formatting Olivier Danvy Computer Science Department Aarhus University (danvy@daimi.aau.dk) December 1993 Abstract This is an extension of the \format" example, in our POPL tutorial [2]. The

More information

Comp 311 Principles of Programming Languages Lecture 21 Semantics of OO Languages. Corky Cartwright Mathias Ricken October 20, 2010

Comp 311 Principles of Programming Languages Lecture 21 Semantics of OO Languages. Corky Cartwright Mathias Ricken October 20, 2010 Comp 311 Principles of Programming Languages Lecture 21 Semantics of OO Languages Corky Cartwright Mathias Ricken October 20, 2010 Overview I In OO languages, data values (except for designated non-oo

More information

Publications related to Chez Scheme

Publications related to Chez Scheme Publications related to Chez Scheme [1] Andrew W. Keep and R. Kent Dybvig. Automatic cross-library optimization. In Scheme 2013: Workshop on Scheme and Functional Programming, 2013. Describes how Chez

More information

Supporting Class / C++ Lecture Notes

Supporting Class / C++ Lecture Notes Goal Supporting Class / C++ Lecture Notes You started with an understanding of how to write Java programs. This course is about explaining the path from Java to executing programs. We proceeded in a mostly

More information

Types. Type checking. Why Do We Need Type Systems? Types and Operations. What is a type? Consensus

Types. Type checking. Why Do We Need Type Systems? Types and Operations. What is a type? Consensus Types Type checking What is a type? The notion varies from language to language Consensus A set of values A set of operations on those values Classes are one instantiation of the modern notion of type

More information

Overloading, Type Classes, and Algebraic Datatypes

Overloading, Type Classes, and Algebraic Datatypes Overloading, Type Classes, and Algebraic Datatypes Delivered by Michael Pellauer Arvind Computer Science and Artificial Intelligence Laboratory M.I.T. September 28, 2006 September 28, 2006 http://www.csg.csail.mit.edu/6.827

More information

Object Oriented Programming. Assistant Lecture Omar Al Khayat 2 nd Year

Object Oriented Programming. Assistant Lecture Omar Al Khayat 2 nd Year Object Oriented Programming Assistant Lecture Omar Al Khayat 2 nd Year Syllabus Overview of C++ Program Principles of object oriented programming including classes Introduction to Object-Oriented Paradigm:Structures

More information

Safe Dynamic Multiple Inheritance

Safe Dynamic Multiple Inheritance Safe Dynamic Multiple Inheritance Erik Ernst 1 Dept. of Computer Science, University of Aarhus, Denmark Abstract. Combination of descriptive entities i.e. multiple inheritance and related mechanisms is

More information

Efficient Separate Compilation of Object-Oriented Languages

Efficient Separate Compilation of Object-Oriented Languages Efficient Separate Compilation of Object-Oriented Languages Jean Privat, Floréal Morandat, and Roland Ducournau LIRMM Université Montpellier II CNRS 161 rue Ada 34392 Montpellier cedex 5, France {privat,morandat,ducour}@lirmm.fr

More information

HOW AND WHEN TO FLATTEN JAVA CLASSES?

HOW AND WHEN TO FLATTEN JAVA CLASSES? HOW AND WHEN TO FLATTEN JAVA CLASSES? Jehad Al Dallal Department of Information Science, P.O. Box 5969, Safat 13060, Kuwait ABSTRACT Improving modularity and reusability are two key objectives in object-oriented

More information

22. Subtyping, Inheritance and Polymorphism

22. Subtyping, Inheritance and Polymorphism 741 Last Week: ression Trees 742 22. Subtyping, Inheritance and Polymorphism ression Trees, Separation of Concerns and Modularisation, Type Hierarchies, Virtual Functions, Dynamic Binding, Code Reuse,

More information

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 24 Thursday, April 19, 2018 1 Error-propagating semantics For the last few weeks, we have been studying type systems.

More information

Chapter 5 Object-Oriented Programming

Chapter 5 Object-Oriented Programming Chapter 5 Object-Oriented Programming Develop code that implements tight encapsulation, loose coupling, and high cohesion Develop code that demonstrates the use of polymorphism Develop code that declares

More information

Type Hierarchy. Comp-303 : Programming Techniques Lecture 9. Alexandre Denault Computer Science McGill University Winter 2004

Type Hierarchy. Comp-303 : Programming Techniques Lecture 9. Alexandre Denault Computer Science McGill University Winter 2004 Type Hierarchy Comp-303 : Programming Techniques Lecture 9 Alexandre Denault Computer Science McGill University Winter 2004 February 16, 2004 Lecture 9 Comp 303 : Programming Techniques Page 1 Last lecture...

More information

On the correctness of template metaprograms

On the correctness of template metaprograms Proceedings of the 7 th International Conference on Applied Informatics Eger, Hungary, January 28 31, 2007 Vol 2 pp 301 308 On the correctness of template metaprograms Ádám Sipos, István Zólyomi, Zoltán

More information

Teaching Encapsulation and Modularity in Object-Oriented Languages with Access Graphs

Teaching Encapsulation and Modularity in Object-Oriented Languages with Access Graphs Teaching Encapsulation and Modularity in Object-Oriented Languages with Access Graphs Gilles Ardourel, Marianne Huchard To cite this version: Gilles Ardourel, Marianne Huchard. Teaching Encapsulation and

More information

J&: Nested Intersection for Scalable Software Composition

J&: Nested Intersection for Scalable Software Composition J&: Nested Intersection for Scalable Software Composition Nathaniel Nystrom Xin Qi Andrew C. Myers Computer Science Department Cornell University {nystrom,qixin,andru@cs.cornell.edu Abstract This paper

More information

Object Oriented Programming. Java-Lecture 11 Polymorphism

Object Oriented Programming. Java-Lecture 11 Polymorphism Object Oriented Programming Java-Lecture 11 Polymorphism Abstract Classes and Methods There will be a situation where you want to develop a design of a class which is common to many classes. Abstract class

More information

An Efficient Staging Algorithm for Binding-Time Analysis

An Efficient Staging Algorithm for Binding-Time Analysis An Efficient Staging Algorithm for Binding-Time Analysis Takuma Murakami 1, Zhenjiang Hu 1,2, Kazuhiko Kakehi 1, and Masato Takeichi 1 1 Department of Mathematical Informatics, Graduate School of Information

More information

Java Primer 1: Types, Classes and Operators

Java Primer 1: Types, Classes and Operators Java Primer 1 3/18/14 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser, Wiley, 2014 Java Primer 1: Types,

More information

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub Lebanese University Faculty of Science Computer Science BS Degree Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub 2 Crash Course in JAVA Classes A Java

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

PROCESS DEVELOPMENT METHODOLOGY The development process of an API fits the most fundamental iterative code development

PROCESS DEVELOPMENT METHODOLOGY The development process of an API fits the most fundamental iterative code development INTRODUCING API DESIGN PRINCIPLES IN CS2 Jaime Niño Computer Science, University of New Orleans New Orleans, LA 70148 504-280-7362 jaime@cs.uno.edu ABSTRACT CS2 provides a great opportunity to teach an

More information

Data Structures (list, dictionary, tuples, sets, strings)

Data Structures (list, dictionary, tuples, sets, strings) Data Structures (list, dictionary, tuples, sets, strings) Lists are enclosed in brackets: l = [1, 2, "a"] (access by index, is mutable sequence) Tuples are enclosed in parentheses: t = (1, 2, "a") (access

More information

IC Language Specification

IC Language Specification CS 301 Spring 2016 IC Language Specification The IC Language For the implementation project, you will build a compiler for an object-oriented language called IC (for Irish Coffee 1 ), which is essentially

More information

CSE P 501 Compilers. Implementing ASTs (in Java) Hal Perkins Winter /22/ Hal Perkins & UW CSE H-1

CSE P 501 Compilers. Implementing ASTs (in Java) Hal Perkins Winter /22/ Hal Perkins & UW CSE H-1 CSE P 501 Compilers Implementing ASTs (in Java) Hal Perkins Winter 2008 1/22/2008 2002-08 Hal Perkins & UW CSE H-1 Agenda Representing ASTs as Java objects Parser actions Operations on ASTs Modularity

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

Agenda. Objects and classes Encapsulation and information hiding Documentation Packages

Agenda. Objects and classes Encapsulation and information hiding Documentation Packages Preliminaries II 1 Agenda Objects and classes Encapsulation and information hiding Documentation Packages Inheritance Polymorphism Implementation of inheritance in Java Abstract classes Interfaces Generics

More information

Programming Languages: OO Paradigm, Polymorhism and Class Members

Programming Languages: OO Paradigm, Polymorhism and Class Members Programming Languages: OO Paradigm, Polymorhism and Class Members Onur Tolga Şehitoğlu Computer Engineering,METU 1 May 2009 Outline 1 2 Abstract Classes Inheritance inclusion polymorphism Binding is still

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

G Programming Languages Spring 2010 Lecture 6. Robert Grimm, New York University

G Programming Languages Spring 2010 Lecture 6. Robert Grimm, New York University G22.2110-001 Programming Languages Spring 2010 Lecture 6 Robert Grimm, New York University 1 Review Last week Function Languages Lambda Calculus SCHEME review 2 Outline Promises, promises, promises Types,

More information

CSE Lecture 3: Objects 2 September Nate Nystrom University of Texas at Arlington

CSE Lecture 3: Objects 2 September Nate Nystrom University of Texas at Arlington CSE 3302 Lecture 3: Objects 2 September 2010 Nate Nystrom University of Texas at Arlington Administration Out of town this afternoon thru Monday HW1 due next Thursday 9/9 Types Last time: strongly typed

More information

Wrapping a complex C++ library for Eiffel. FINAL REPORT July 1 st, 2005

Wrapping a complex C++ library for Eiffel. FINAL REPORT July 1 st, 2005 Wrapping a complex C++ library for Eiffel FINAL REPORT July 1 st, 2005 Semester project Student: Supervising Assistant: Supervising Professor: Simon Reinhard simonrei@student.ethz.ch Bernd Schoeller Bertrand

More information

CSE P 501 Compilers. Implementing ASTs (in Java) Hal Perkins Autumn /20/ Hal Perkins & UW CSE H-1

CSE P 501 Compilers. Implementing ASTs (in Java) Hal Perkins Autumn /20/ Hal Perkins & UW CSE H-1 CSE P 501 Compilers Implementing ASTs (in Java) Hal Perkins Autumn 2009 10/20/2009 2002-09 Hal Perkins & UW CSE H-1 Agenda Representing ASTs as Java objects Parser actions Operations on ASTs Modularity

More information

COMP322 - Introduction to C++

COMP322 - Introduction to C++ COMP322 - Introduction to C++ Winter 2011 Lecture 08 - Inheritance continued School of Computer Science McGill University March 8, 2011 Last Time Single Inheritance Polymorphism: Static Binding vs Dynamic

More information

Resolving of Intersection Types in Java

Resolving of Intersection Types in Java Resolving of Intersection Types in Java Martin Plümicke University of Cooperative Education Stuttgart Department of Information Technology Florianstraße 15, D 72160 Horb m.pluemicke@ba-horb.de Abstract.

More information

Compilation of Object Oriented Languages Tik Compilers Seminar

Compilation of Object Oriented Languages Tik Compilers Seminar Compilation of Object Oriented Languages Burlacu Mihai Helsinki University of Technology burlacum@cc.hut.fi Abstract The paper covers briefly the object-oriented concepts, usability and advantages of using

More information

I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++

I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++ No. of Printed Pages : 3 I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination 05723. June, 2015 BCS-031 : PROGRAMMING IN C ++ Time : 3 hours Maximum Marks : 100 (Weightage 75%)

More information

An Approach to Behavioral Subtyping Based on Static Analysis

An Approach to Behavioral Subtyping Based on Static Analysis TACoS 04 Preliminary Version An Approach to Behavioral Subtyping Based on Static Analysis Francesco Logozzo 1 STIX - École Polytechnique F-91128 Palaiseau, France Abstract In mainstream object oriented

More information

Types and Type Inference

Types and Type Inference CS 242 2012 Types and Type Inference Notes modified from John Mitchell and Kathleen Fisher Reading: Concepts in Programming Languages, Revised Chapter 6 - handout on Web!! Outline General discussion of

More information

CPS 506 Comparative Programming Languages. Programming Language

CPS 506 Comparative Programming Languages. Programming Language CPS 506 Comparative Programming Languages Object-Oriented Oriented Programming Language Paradigm Introduction Topics Object-Oriented Programming Design Issues for Object-Oriented Oriented Languages Support

More information

Object Oriented Issues in VDM++

Object Oriented Issues in VDM++ Object Oriented Issues in VDM++ Nick Battle, Fujitsu UK (nick.battle@uk.fujitsu.com) Background VDMJ implemented VDM-SL first (started late 2007) Formally defined. Very few semantic problems VDM++ support

More information

OO Technology: Properties and Limitations for Component-Based Design

OO Technology: Properties and Limitations for Component-Based Design TDDD05 Component-Based Software OO Technology: Properties and Limitations for Component-Based Design Interfaces Design by by Contract Syntactic Substitutability Inheritance Considered Harmful Fragile Base

More information

Intermediate Code, Object Representation, Type-Based Optimization

Intermediate Code, Object Representation, Type-Based Optimization CS 301 Spring 2016 Meetings March 14 Intermediate Code, Object Representation, Type-Based Optimization Plan Source Program Lexical Syntax Semantic Intermediate Code Generation Machine- Independent Optimization

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

Separation of Concerns

Separation of Concerns Separation of Concerns Erik Ernst Dept. of Computer Science, University of Aarhus, Denmark eernst@daimi.au.dk Abstract. Separation of concerns is a crucial concept in discussions about software engineering

More information

CIS24 Project #3. Student Name: Chun Chung Cheung Course Section: SA Date: 4/28/2003 Professor: Kopec. Subject: Functional Programming Language (ML)

CIS24 Project #3. Student Name: Chun Chung Cheung Course Section: SA Date: 4/28/2003 Professor: Kopec. Subject: Functional Programming Language (ML) CIS24 Project #3 Student Name: Chun Chung Cheung Course Section: SA Date: 4/28/2003 Professor: Kopec Subject: Functional Programming Language (ML) 1 Introduction ML Programming Language Functional programming

More information

Subtyping. Lecture 13 CS 565 3/27/06

Subtyping. Lecture 13 CS 565 3/27/06 Subtyping Lecture 13 CS 565 3/27/06 Polymorphism Different varieties of polymorphism: Parametric (ML) type variables are abstract, and used to encode the fact that the same term can be used in many different

More information

A Unification of Inheritance and Automatic Program Specialization

A Unification of Inheritance and Automatic Program Specialization c 2000 Springer-Verlag, published in LNCS 3286: Proceedings of CPCE 04 A Unification of Inheritance and Automatic Program Specialization Ulrik P. Schultz DAIMI/ISIS University of Aarhus Denmark Abstract.

More information

Types and Type Inference

Types and Type Inference Types and Type Inference Mooly Sagiv Slides by Kathleen Fisher and John Mitchell Reading: Concepts in Programming Languages, Revised Chapter 6 - handout on the course homepage Outline General discussion

More information

Generative Programming from a Domain-Specific Language Viewpoint

Generative Programming from a Domain-Specific Language Viewpoint Generative Programming from a Domain-Specific Language Viewpoint Charles Consel To cite this version: Charles Consel. Generative Programming from a Domain-Specific Language Viewpoint. Unconventional Programming

More information

Data Structures and Algorithms Design Goals Implementation Goals Design Principles Design Techniques. Version 03.s 2-1

Data Structures and Algorithms Design Goals Implementation Goals Design Principles Design Techniques. Version 03.s 2-1 Design Principles Data Structures and Algorithms Design Goals Implementation Goals Design Principles Design Techniques 2-1 Data Structures Data Structure - A systematic way of organizing and accessing

More information

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. P. N. Hilfinger

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. P. N. Hilfinger UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division CS 164 Spring 2005 P. N. Hilfinger Project #2: Static Analyzer for Pyth Due: Wednesday, 6 April

More information

VIRTUAL FUNCTIONS Chapter 10

VIRTUAL FUNCTIONS Chapter 10 1 VIRTUAL FUNCTIONS Chapter 10 OBJECTIVES Polymorphism in C++ Pointers to derived classes Important point on inheritance Introduction to virtual functions Virtual destructors More about virtual functions

More information

Making New instances of Classes

Making New instances of Classes Making New instances of Classes NOTE: revised from previous version of Lecture04 New Operator Classes are user defined datatypes in OOP languages How do we make instances of these new datatypes? Using

More information

Outline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring

Outline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring Java Outline Java Models for variables Types and type checking, type safety Interpretation vs. compilation Reasoning about code CSCI 2600 Spring 2017 2 Java Java is a successor to a number of languages,

More information

An Approach to Polyvariant Binding Time Analysis for a Stack-Based Language

An Approach to Polyvariant Binding Time Analysis for a Stack-Based Language Supported by Russian Foundation for Basic Research project No. 06-01-00574-a and No. 08-07-00280-a, and Russian Federal Agency of Science and Innovation project No. 2007-4-1.4-18-02-064. An Approach to

More information

An Approach to Polyvariant Binding Time Analysis for a Stack-Based Language

An Approach to Polyvariant Binding Time Analysis for a Stack-Based Language An Approach to Polyvariant Binding Time Analysis for a Stack-Based Language Yuri A. Klimov Keldysh Institute of Applied Mathematics, Russian Academy of Sciences RU-125047 Moscow, Russia, yuklimov@keldysh.ru

More information

Compiling Generics Through User-Directed Type Specialization

Compiling Generics Through User-Directed Type Specialization Compiling Generics Through User-Directed Type Specialization Iulian Dragos École Polytechnique Fédérale de Lausanne, Switzerland iulian.dragos@epfl.ch Martin Odersky École Polytechnique Fédérale de Lausanne,

More information

Big Bang. Designing a Statically Typed Scripting Language. Pottayil Harisanker Menon, Zachary Palmer, Scott F. Smith, Alexander Rozenshteyn

Big Bang. Designing a Statically Typed Scripting Language. Pottayil Harisanker Menon, Zachary Palmer, Scott F. Smith, Alexander Rozenshteyn Big Bang Designing a Statically Typed Scripting Language Pottayil Harisanker Menon, Zachary Palmer, Scott F. Smith, Alexander Rozenshteyn The Johns Hopkins University June 11, 2012 Scripting Languages!

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

Chapter 5: Procedural abstraction. Function procedures. Function procedures. Proper procedures and function procedures

Chapter 5: Procedural abstraction. Function procedures. Function procedures. Proper procedures and function procedures Chapter 5: Procedural abstraction Proper procedures and function procedures Abstraction in programming enables distinction: What a program unit does How a program unit works This enables separation of

More information

CS-202 Introduction to Object Oriented Programming

CS-202 Introduction to Object Oriented Programming CS-202 Introduction to Object Oriented Programming California State University, Los Angeles Computer Science Department Lecture III Inheritance and Polymorphism Introduction to Inheritance Introduction

More information

From IMP to Java. Andreas Lochbihler. parts based on work by Gerwin Klein and Tobias Nipkow ETH Zurich

From IMP to Java. Andreas Lochbihler. parts based on work by Gerwin Klein and Tobias Nipkow ETH Zurich From IMP to Java Andreas Lochbihler ETH Zurich parts based on work by Gerwin Klein and Tobias Nipkow 2015-07-14 1 Subtyping 2 Objects and Inheritance 3 Multithreading 1 Subtyping 2 Objects and Inheritance

More information

Derived and abstract data types. TDT4205 Lecture 15

Derived and abstract data types. TDT4205 Lecture 15 1 Derived and abstract data types TDT4205 Lecture 15 2 Where we were We ve looked at static semantics for primitive types and how it relates to type checking We ve hinted at derived types using a multidimensional

More information

CS153: Compilers Lecture 15: Local Optimization

CS153: Compilers Lecture 15: Local Optimization CS153: Compilers Lecture 15: Local Optimization Stephen Chong https://www.seas.harvard.edu/courses/cs153 Announcements Project 4 out Due Thursday Oct 25 (2 days) Project 5 out Due Tuesday Nov 13 (21 days)

More information

JQueryScapes: customizable Java code perspectives

JQueryScapes: customizable Java code perspectives JQueryScapes: customizable Java code perspectives [Forum Demonstration Proposal] Lloyd Markle, Kris De Volder Department of Computer Science University of British Columbia Vancouver, BC, Canada 604-822-1290

More information

Semantic Analysis and Type Checking

Semantic Analysis and Type Checking Semantic Analysis and Type Checking The compilation process is driven by the syntactic structure of the program as discovered by the parser Semantic routines: interpret meaning of the program based on

More information

Design issues for objectoriented. languages. Objects-only "pure" language vs mixed. Are subclasses subtypes of the superclass?

Design issues for objectoriented. languages. Objects-only pure language vs mixed. Are subclasses subtypes of the superclass? Encapsulation Encapsulation grouping of subprograms and the data they manipulate Information hiding abstract data types type definition is hidden from the user variables of the type can be declared variables

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

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe Chapter 12 Outline Overview of Object Database Concepts Object-Relational Features Object Database Extensions to SQL ODMG Object Model and the Object Definition Language ODL Object Database Conceptual

More information

Software Paradigms (Lesson 3) Object-Oriented Paradigm (2)

Software Paradigms (Lesson 3) Object-Oriented Paradigm (2) Software Paradigms (Lesson 3) Object-Oriented Paradigm (2) Table of Contents 1 Reusing Classes... 2 1.1 Composition... 2 1.2 Inheritance... 4 1.2.1 Extending Classes... 5 1.2.2 Method Overriding... 7 1.2.3

More information

301AA - Advanced Programming [AP-2017]

301AA - Advanced Programming [AP-2017] 301AA - Advanced Programming [AP-2017] Lecturer: Andrea Corradini andrea@di.unipi.it Tutor: Lillo GalleBa galleba@di.unipi.it Department of Computer Science, Pisa Academic Year 2017/18 AP-2017-12: Polymorphisms

More information

Overview of OOP. Dr. Zhang COSC 1436 Summer, /18/2017

Overview of OOP. Dr. Zhang COSC 1436 Summer, /18/2017 Overview of OOP Dr. Zhang COSC 1436 Summer, 2017 7/18/2017 Review Data Structures (list, dictionary, tuples, sets, strings) Lists are enclosed in square brackets: l = [1, 2, "a"] (access by index, is mutable

More information

The Decaf Language. 1 Lexical considerations

The Decaf Language. 1 Lexical considerations The Decaf Language In this course, we will write a compiler for a simple object-oriented programming language called Decaf. Decaf is a strongly-typed, object-oriented language with support for inheritance

More information

STUDENT LESSON A20 Inheritance, Polymorphism, and Abstract Classes

STUDENT LESSON A20 Inheritance, Polymorphism, and Abstract Classes STUDENT LESSON A20 Inheritance, Polymorphism, and Abstract Classes Java Curriculum for AP Computer Science, Student Lesson A20 1 STUDENT LESSON A20 Inheritance, Polymorphism, and Abstract Classes INTRODUCTION:

More information