Type

Data source

Date

Thumbnail

Search results

8 records were found.

Although roles have been around for a long time they have not yet reached mainstream programming languages. The variety of existing role models may be a limiting factor. We believe that for roles to be widely accepted they must enhance code reuse. An outcome would be a library of roles. We present and discuss what we feel are the characteristics that a role model must have to enable reusable and player independent roles. In this paper we present our role model and JavaStage, a role language that extends Java, with examples of reusable roles. Finally, we present our steps towards the building of a role library, by presenting the roles developed from the analysis of the GoF Design Patterns. The results obtained, we developed roles for 10 of the 23 GoF patterns, are promising.
Object oriented decomposition is the most successful decomposition strategy used nowadays. But a single decomposition strategy cannot capture all aspects of a concept. Roles have been successfully used to model the different views a concept may provide but, despite this, roles have not been used as building blocks. Roles are mostly used to extend objects at runtime. In this paper we propose roles as a way to compose classes that provides a modular way of capturing and reusing those aspects that fall outside a concept’s main purpose, while being close to the OO approach. We present how roles can be made modular and reusable. We also show how we can use roles to compose classes using JavaStage, a java extension that support roles To validate our approach we developed generic and reusable roles for the Gang of Four patterns. We were able to develop reusable roles for 10 out of 23 patterns, which is a good outcome.
Roles are not a new concept, but they have been used in two different ways: as modeling concepts in a static view and as instance extensions in a dynamic view. For these views only the dynamic offers supporting languages. The static view, although proving the utility of roles in modeling, does not offer a programming language that allows developers to use roles all the way from modeling to programming. We try to overcome this by presenting our role language JavaStage, based on the Java language. We do this by designing and implementing a simple framework and then compare the results with its OO equivalent. Our results show that static roles are in fact useful when used in code and that JavaStage features expand role reuse.
Modularization allows the development of independent modules and their reuse. However a single decomposition strategy cannot neatly capture all the systems concerns. Thus some concerns are spread over several modules – the crosscutting concerns. To cope with this we need to have other class composition techniques than those available in traditional Object Oriented programming languages. One of such compositions is roles. If roles are used to compose classes and if a role models a crosscutting concern, then the concern is limited to the role and not spread over several classes. To validate this approach we conducted a case study. In the case study crosscutting concerns were identified in a system using a clone detection tool and roles were developed to model those crosscutting concerns. Results show that this approach reduces significantly the spreading of crosscutting concerns code.
Code replication has significant drawbacks in system maintenance. Code replication can have its origins in the composition limitations of the language. Several proposals have tried to overcome these limitations. A popular one is traits. However, traits do not support state or visibility control. Static roles are also a way of composing classes that has the benefits of traits and offers state, visibility control and other advantages as block renaming. We compare both approaches on how they are used to compose classes, and how they can be used to reduce code replication caused by composition limitations. As a case study we will compare how both approaches can reduce code replication by detecting and removing code clones within the JHotDraw framework. Results show that roles are capable of reducing a larger amount of replicated code than traits.
In object oriented languages the problem of crosscutting concerns, due to limitations in the composition mechanisms, is recurrent. In order to reduce this problem we propose to use roles as a way of composing classes that extends the Object Oriented approach and can be used to model crosscutting concerns. To support our approach we developed a role language that extends Java, while being compatible with existing virtual machines. As validation we conducted a case study using three open source systems. We identified crosscutting concerns in the systems and then modeled them using our role approach. Results show that roles are a viable option for modeling crosscutting concerns.
The existence of replicated code in a system makes that system harder to maintain and evolve. To remove replicated code the usual way is to use refactorings. However there are always clones that cannot be removed by refactorings alone. Some are due to lack of composition mechanisms in the underlying programming language. We propose the use of roles to remove such clones since roles provide a finer degree of composition. We sketch four role refactorings to remove code clones and apply them in a case study using the JHotDraw framework. Results show that roles have a positive impact in clone reduction as they were able to remove almost all clones traditional refactorings could not.
Roles can be used to overcome some composition limitations in Object Oriented Languages and contribute to a better code reuse, reducing code replication and improve code maintenance. Therefore, the refactoring of legacy code to roles is an important step in maintaining and evolving this code. In this paper, we present refactorings to convert a system to roles We also present some refactorings that enable roles to be even more reusable.