Presentation is loading. Please wait.

Presentation is loading. Please wait.

Compound Types for Java Object Oriented Systems and Languages © 2001 Marcus Handte.

Similar presentations


Presentation on theme: "Compound Types for Java Object Oriented Systems and Languages © 2001 Marcus Handte."— Presentation transcript:

1 Compound Types for Java Object Oriented Systems and Languages © 2001 Marcus Handte

2 Object Oriented Systems & Languages2 Overview Java Type System Component Software The Problem Solutions Compound Types

3 Marcus Handte Object Oriented Systems & Languages3 Java Type System Code inheritance via single subclassing Multiple subtyping via interfaces (= 3 ways of subtyping) Name equivalence class A implements I1, I2 {... }; class B implements I1, I2 {... }; A a = new B();

4 Marcus Handte Object Oriented Systems & Languages4 Component Software NATO Conference on SE (1968) Basic ideas: Premanufactured building blocks Mutually unaware companies (independent development) Component market (plug-and-play components) Information Hiding (interaction using contracts) Implemented by JavaBeans™ Types as contracts

5 Marcus Handte Object Oriented Systems & Languages5 A Scenario Two indepentent standards... public interface Text {... } /* part of a text framework */ public interface Container {... } /* part of a document framework */ Different vendors develop compoents... class TextContainerA implements Text, Container {... } /* vendor A‘s component */ class TextContainerB implements Text, Container {... } /* vendor B‘s component */

6 Marcus Handte Object Oriented Systems & Languages6 The Problem A third company wants to build a component based on a TextContainer... class Component { public setTextContainer( ? tc); } What type should tc have ? Which company is responsible ? What now ?

7 Marcus Handte Object Oriented Systems & Languages7 Solutions Forget about name equivalence use structural equivalence instead Radical change of Java‘s type system. Use naming conventions Mutually unaware vendors ? Use runtime type checking public setTextContainer(Text t, Container c) { if (t != c) throw new RuntimeException();... } Efficiency ? Type checking at runtime ?

8 Marcus Handte Object Oriented Systems & Languages8 Compound Types A compound type describes a type that is composed out of a set of other types. Compound types lie between structural and name equivalence. name equivalence compound types structural equivalence

9 Marcus Handte Object Oriented Systems & Languages9 Java Integration Critical issue – type soundness (all values produced during any program execution respect their static types). Compound types are allowed as... parameter types, return types, variable types, cast operators, and instanceof operators.

10 Marcus Handte Object Oriented Systems & Languages10 Java Integration (cont‘) Compound types are not permitted in... extend clauses and implements clauses. Implemented as anonymous types. Specified as sets, ex. [Text, Container]. Proof of soundness is available.

11 Marcus Handte Object Oriented Systems & Languages11 Conclusion The proposed extension effects only java compilers (no need to change the jvm or legacy code). Component types are a nice extension that overcome some limitations of the java language.... is the problem relevant ?

12 Marcus Handte Object Oriented Systems & Languages12 Literature Compound types for Java Martin Büchi, Wolfgang Weck ACM SIGPLAN Notices, Proceedings of the conference on Object-oriented programming, systems, languages, and applications October 1998 Volume 33 Issue 10 Any questions ?


Download ppt "Compound Types for Java Object Oriented Systems and Languages © 2001 Marcus Handte."

Similar presentations


Ads by Google