15.01.2015 Views

4th International Conference on Principles and Practices ... - MADOC

4th International Conference on Principles and Practices ... - MADOC

4th International Conference on Principles and Practices ... - MADOC

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Typeless programming in Java 5.0<br />

Martin Plümicke<br />

University of Cooperative Educati<strong>on</strong> Stuttgart<br />

Department of Informati<strong>on</strong> Technology<br />

Florianstraße 15, D–72160 Horb<br />

m.pluemicke@ba-horb.de<br />

Jörg Bäuerle<br />

AWM Media<br />

<str<strong>on</strong>g>Internati<strong>on</strong>al</str<strong>on</strong>g> IT Department<br />

P.O. Box 4006, Worthing BN13 1AP, UK<br />

Joerg.Baeuerle@gmx.net<br />

ABSTRACT<br />

With the introducti<strong>on</strong> of Java 5.0 [9] the type system has<br />

been extended by parameterized types, type variables, type<br />

terms, <strong>and</strong> wildcards. As a result very complex types can<br />

arise. The term<br />

Vector<br />

is for example a correct type in Java 5.0.<br />

C<strong>on</strong>sidering all that, it is often rather difficult for a programmer<br />

to recognize whether such a complex type is the<br />

correct <strong>on</strong>e for a given method or not. Furthermore there are<br />

methods whose principle types would be intersecti<strong>on</strong> types.<br />

But intersecti<strong>on</strong> types are not implemented in Java 5.0. This<br />

means that Java 5.0 methods often d<strong>on</strong>’t have the principle<br />

type which is c<strong>on</strong>tradictive to the OOP-Principle of writing<br />

re-usable code.<br />

This has caused us to develop a Java 5.0 type inference<br />

system which assists the programmer by calculating types<br />

automatically. This type inference system allows us, to declare<br />

method parameters <strong>and</strong> local variables without type<br />

annotati<strong>on</strong>s. The type inference algorithm calculates the<br />

appropriate <strong>and</strong> principle types.<br />

We implement the algorithm in Java using the observer<br />

design pattern.<br />

Categories <strong>and</strong> Subject Descriptors<br />

D.1.5 [Programming Techniques]: Object-oriented Programming;<br />

D.2.2 [Software Engineering]: Design Tools<br />

<strong>and</strong> Techniques—modules <strong>and</strong> interfaces; D.3.3 [Programming<br />

Languages]: Language C<strong>on</strong>structs <strong>and</strong> Features—<br />

data types <strong>and</strong> structures<br />

General Terms<br />

Algorithms, Theory<br />

Keywords<br />

Code generati<strong>on</strong>, language design, program design <strong>and</strong> im-<br />

Permissi<strong>on</strong> to make digital or hard copies of all or part of this work for<br />

pers<strong>on</strong>al or classroom use is granted without fee provided that copies are<br />

not made or distributed for profit or commercial advantage <strong>and</strong> that copies<br />

bear this notice <strong>and</strong> the full citati<strong>on</strong> <strong>on</strong> the first page. To copy otherwise, to<br />

republish, to post <strong>on</strong> servers or to redistribute to lists, requires prior specific<br />

permissi<strong>on</strong> <strong>and</strong>/or a fee.<br />

PPPJ 2006 August 30 - September 1, 2006, Mannheim, Germany.<br />

Copyright 2006 ACM ...$5.00.<br />

class Matrix extends Vector {<br />

Matrix mul(Matrix m){<br />

Matrix ret = new Matrix();<br />

int i = 0;<br />

while(i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!