155 research outputs found

    Safer typing of complex API usage through Java generics

    Get PDF
    When several incompatible implementations of a single API are in use in a Java program, the danger exists that instances from different implementations may inadvertently be mixed, leading to errors. In this paper we show how to use generics to prevent such mixing. The core idea of the approach is to add a type parameter to the interfaces of the API, and tie the classes that make up an implementation to a unique choice of type parameter. In this way methods of the API can only be invoked with arguments that belong to the same implementation. We show that the presence of a type parameter in the interfaces does not violate the principle of interface-based programming: clients can still completely abstract over the choice of implementation. In addition, we demonstrate how code can be reused between different implementations, how implementations can be defined as extensions of other implementations, and how different implementations may be mixed in a controlled and safe manner. To explore the feasibility of the approach, gauge its usability, and identify any issues that may crop up in practical usage, we have refactored a fairly large existing API-based application suite, and we report on the experience gained in the process

    Analysis of support for modularity in object teams based on design patterns

    Get PDF
    Dissertação de Mestrado em Engenharia InformáticaThe paradigm of Aspect-Oriented Programming is currently being studied and matured. Many aspectoriented languages have been proposed, including Object Teams for Java (OT/J). However, to date few studies were carried out to assess the contribution of the various languages available and compare their relative advantages and disadvantages. The aim of this dissertation is to contribute to fill this gap. In the past, implementations of design patterns in Java and AspectJ were successfully used as case studies to derive conclusions on the relative advantages and disadvantages of the language under consideration. This dissertation follows this approach, with the development of a suitable collection of examples based on the well-known Gang-of-Four design patterns. Two repositories of implementations in OT/J of the complete collection of 23 Gang-of-Four design patterns have been developed, to be used as a basis for subsequent analysis. The scenarios used for the examples are based on Java repositories by independent authors, freely available on the Web. Based on the repositories developed, an analysis of the modularizations obtained with OT/J is presented and compared with the results obtained using Java and AspectJ. OT/J provides direct language support for 3 of the patterns. 20 patterns yielded separate modules for the patterns, of which 10 modules proved to be reusable. Only in 1 of the patterns, no significant differences between Java and OT/J were obtained

    The Essence of Nested Composition

    Get PDF
    Calculi with disjoint intersection types support an introduction form for intersections called the merge operator, while retaining a coherent semantics. Disjoint intersections types have great potential to serve as a foundation for powerful, flexible and yet type-safe and easy to reason OO languages. This paper shows how to significantly increase the expressive power of disjoint intersection types by adding support for nested subtyping and composition, which enables simple forms of family polymorphism to be expressed in the calculus. The extension with nested subtyping and composition is challenging, for two different reasons. Firstly, the subtyping relation that supports these features is non-trivial, especially when it comes to obtaining an algorithmic version. Secondly, the syntactic method used to prove coherence for previous calculi with disjoint intersection types is too inflexible, making it hard to extend those calculi with new features (such as nested subtyping). We show how to address the first problem by adapting and extending the Barendregt, Coppo and Dezani (BCD) subtyping rules for intersections with records and coercions. A sound and complete algorithmic system is obtained by using an approach inspired by Pierce\u27s work. To address the second problem we replace the syntactic method to prove coherence, by a semantic proof method based on logical relations. Our work has been fully formalized in Coq, and we have an implementation of our calculus

    Safely Reusing Model Transformations through Family Polymorphism

    Get PDF
    International audienceThe engineering of systems involves many different stakeholders, each with their own domain of expertise. Hence more and more organizations are adopting Domain Specific Languages (DSLs) to allow domain experts to express solutions directly in terms of relevant domain concepts. This new trend raises new challenges about designing DSLs, evolving a set of DSLs and coordinating the use of multiple DSLs. In this talk we explore various dimensions of these challenges, and outline a possible research roadmap for addressing them. We detail one of these challenges, which is the safe reuse of model transformations.Indeed both DSL definition and tooling (e.g., checkers, document or code generators, model transformations) require significant development efforts, for a limited audience (by definition), because the current state of the art of Model Driven Engineering still makes it hard to reuse and evolve these definitions and tooling across several DSLs, even when these DSLs are conceptually very close to one other. We outline a new extension to the Kermeta language that leverages Family Polymorphism to allow model polymorphism, inheritance among DSLs, as well as evolution and interoperability of DSLs

    Tribe: More Types for Virtual Classes

    No full text
    Beginning with Beta, a range of programming language mechanisms have been developed to allow inheritance in the presence of mutually dependent classes. This paper presents Tribe, a type system which generalises and simplifies other formalisms of such mechanisms, by treating issues which are inessential for soundness, such as the precise details of dispatch and path initialisation, as orthogonal to the core formalism. Tribe can support path types dependent simultaneously on both classes and objects, which is useful for writing library code, and ubiquitous access to an objects family (= owner), which offers family polymorphism without the need to drag around family arguments. Languages based on Tribe will be both simpler and more expressive than existing designs, while having a simpler type system, serving as a useful basis for future language designs

    A qualitative assessment of modularity in CaesarJ components based on implementations of design patterns

    Get PDF
    Tese de Mestrado em Engenharia InformáticaThe advent of the Aspect-Oriented Programming (AOP) paradigm brought new features and mechanisms to support the separation of crosscutting concerns, in order to develop programs with higher modularity and consequently, higher reuse. As the paradigm matures, various aspectoriented programming languages appeared that propose varying ways to realize the paradigm’s concepts. CaesarJ is one of those aspect-oriented languages. While the majority of practical studies on AOP languages focused on the AspectJ language, the characteristics of other languages such as CaesarJ remain to be explored. The lack of research on the utilization of CaesarJ in concrete cases leads to the existence of few case studies from which to draw considerations about their strengths and shortcomings. In the past, implementations of design patterns have been used for the demonstration of the characteristics of the programming languages used to implement them. This dissertation follows a similar approach to assess CaesarJ’s support for modularity and reuse by producing CaesarJ design patterns implementations and subjecting those implementations to a qualitative analysis. This dissertation presents CaesarJ implementations of eleven Gang-of-Four pattern that serve as the basis for a qualitative analysis of the modularity degree CaesarJ enables for each pattern. A distinction is made between four levels of module reuse that the implementations support, in order to differentiate between the several levels of reuse achieved. A comparison is drawn to analogue design pattern implementations in AspectJ. Finally, general guidelines for the implementation of CaesarJ components are described
    • …
    corecore