Languages and Types for Component-Based Programming

Languages and Types for Component-Based Programming

Universidade Nova de Lisboa Faculdade de Cienciasˆ e Tecnologia Departamento de Informatica´ Languages and Types for Component-Based Programming Joao˜ Ricardo Viegas da Costa Seco Dissertac¸ao˜ apresentada para a obtenc¸ao˜ do Grau de Doutor em Informatica´ pela Univer- sidade Nova de Lisboa, Faculdade de Cienciasˆ e Tecnologia. Lisboa (2006) Evaluation Committee: Lu´ıs Monteiro, Universidade Nova de Lisboa (President) Sophia Drossoupoulou, Imperial College London (Main Referee) Davide Ancona, Universita di Genova (Main Referee) Lu´ıs Caires, Universidade Nova de Lisboa (Supervisor) Antonia´ Lopes, Universidade de Lisboa Lu´ıs Lopes, Universidade do Porto Artur Miguel Dias, Universidade Nova de Lisboa ii This dissertation was prepared under the supervision of Professor Luis Caires, of the Faculdade de Cienciasˆ e Tecnologia, Universidade Nova de Lisboa. To my loving wife Joana, and my lovely children Martim, Teresa, and Leonor iv Acknowledgements The work presented in this dissertation would not have been possible without the collaboration of a considerable number of people to whom I would like to express my gratitude. To my wife Joana, for her dedication and unconditional love. To my son Martim, and my two daughters, Teresa and Leonor, for their everlasting love and tenderness. I stole too much of the time that was rightfully theirs in these past years. To my parents, Carlos and Zulmira, for their confidence, and also to my parents in law, Ricardo and Lalita, for their continuous encouragement and support. To Lu´ıs Caires to whom I owe a great deal, for his guidance on a area of research which was completely new to me, for the long hours discussing from the most abstract ideas to the finest of details. His example and encouragement were of most importance to achieve the present result. To Sergio´ Duarte and Henrique Joao˜ Domingos with whom I shared an office for many years and who showed infinite patience for all the gibberish that constantly filled our whiteboard. To Anabela Ribeiro, Carmen Morgado, Cec´ılia Gomes, Fernando Birra, Joao˜ Lourenc¸o, Nuno Preguic¸a, Pedro Medeiros, and V´ıtor Duarte for being the best of colleagues. To Miguel Durao˜ for experimenting with componentJ and giving a hand with the ML implementation of the component calculus. To Lu´ıs Monteiro, coordinator of the ”Programming Languages and Models” Research Stream of the CITI, for his encouragement and support. To all the anonymous referees that reviewed our papers and commented on our research approaches and results. To Luca Cardelli for some discussions on components and dynamic reconfiguration, and to Dario Colazzo for his comments on our work about subtyping recursive types. My work was partially funded by the Fundac¸ao˜ para a Cienciaˆ e Tecnologia, by the re- search stream Programming Languages and Models of the Centro de Investigac¸ao˜ em In- formatica´ e Tecnologias da Informac¸ao˜ research centre (CITI), by the research project Databricks (POSI/33924/00), and the ComponentGlue project funded by Microsoft Research Cambridge (MSR Research Grant 2002/73). v vi Abstract Component-Oriented Programming has been, for the past few years, an emergent program- ming paradigm. However, it has been supported mainly by low-level technological solutions. Traditionally, modularity in object-oriented languages has been based on the notion of class, and software reuse achieved by either implementation inheritance or object aggregation. On the one hand, inheritance has proved to become problematic in the context of large-scale soft- ware systems, as it may hinder evolution and interferes with issues such as dynamic loading. On the other hand, object aggregation is usually implemented by ad-hoc idioms that manually build webs of objects. This dissertation contributes to this field by introducing appropriate programming lan- guage abstractions and type systems for expressing the assembly, adaptation, and evolution of software components. Our model is formally expressed by means of a core typed program- ming language whose first-class values are objects, components, and configurators. Objects are component instances which aggregate state and functionality in the standard object-oriented sense. Components are entities that specify the structure and behaviour of objects by means of a combination and adaptation of smaller components. From a network of elements, which is specified by a configurator value, only well identified interfaces, that import and export services, remain visible to be used in further compositions. Configurators are operations that produce structures by aggregating and connecting components in an implementation inde- pendent way; they are either defined using canonical composition operations, that insert or connect elements in a composition, or by a combination of other configurators, thus producing their joint effect. Configurators are uniformly used to produce components or modify the in- ternal structure of objects. Thus, this variety of values and language constructs allows for both the expression of dynamic construction of new components (based on run-time decisions) and the unanticipated reconfiguration of component instances. We develop several type systems to ensure the structural soundness of components and objects, before and after reconfiguration actions. In particular, configurators are typed with intensional type information, revealing certain aspects of their internal structure which play an essential role in the typing of composition and reconfiguration actions. We also define a novel approach to subtyping second-order recursive types, we prove its decidability by de- vii viii signing a subtyping algorithm and proving its correction. This result is then used to enrich our component language with recursive types and polymorphism (universal and subsumption- based), and define a flexible structural subsumption relation between components, instances and reconfiguration scripts. The decidability of the typing relation and the correction of the corresponding algorithms are also presented and proved correct. We define and prove type safety by means of subject reduction properties which imply the intended structural sound- ness results. To perform actual experimentation of our programming model, we also developed and implemented a prototype compiler for a Java-like programming language, componentJ. Sum´ario A Programac¸ao˜ Orientada por Componentes tem tido nos ultimos´ anos uma relevanciaˆ cres- cente como paradigma de programac¸ao.˜ No entanto, tem sido apenas suportada por soluc¸oes˜ tecnologicas´ de baixo n´ıvel. Tradicionalmente, a modularidade em linguagens orientadas por objectos tem sido baseada na noc¸ao˜ de classe e a reutilizac¸ao˜ de software conseguida atraves´ de mecanismos de heranc¸a ou de agregac¸ao˜ de objectos. Por um lado, o mecanismo de heranc¸a pode tornar-se problematico´ no contexto do desenvolvimento de software em larga escala pois condiciona a evoluc¸ao˜ dos programas e interfere com outros mecanismos como por exemplo o do carregamento dinamicoˆ de codigo.´ Por outro lado, a agregac¸ao˜ de objectos e´ normalmente implementada por redes de objectos montadas de uma forma ad-hoc ou seguindo alguns idi- omas de programac¸ao.˜ A contribuic¸ao˜ desta dissertac¸ao˜ esta´ na introduc¸ao˜ de abstracc¸oes˜ adequadas a` definic¸ao˜ da montagem, adaptac¸ao˜ e evoluc¸ao˜ de componentes de software ao n´ıvel das linguagens de programac¸ao.˜ O nosso modelo e´ expresso formalmente numa linguagem de programac¸ao˜ cujos valores de primeira classe sao˜ objectos, componentes e configuradores. Os objectos sao˜ instanciasˆ de componentes que agregam estado e funcionalidade como e´ habitual nas lingua- gens orientadas por objectos. Os componentes sao˜ entidades que especificam a estrutura e com- portamento dos objectos. A sua construc¸ao˜ e´ feita por uma operac¸ao˜ da linguagem que, a partir de um configurador que liga e adapta outros componentes, produz um valor que esconde os detalhes da sua estrutura interna. Apenas os pontos de ligac¸ao˜ explicitamente definidos, de- nominados portos, ficam vis´ıveis no componente resultante. Os configuradores sao˜ operac¸oes˜ que produzem estruturas por agregac¸ao˜ e conexao˜ de componentes independentemente das suas implementac¸oes.˜ Os configuradores sao˜ definidos a partir de operac¸oes˜ canonicas´ de composic¸ao˜ que inserem ou ligam elementos, ou por composic¸ao˜ de outros configuradores. Os configuradores sao˜ aplicados de uma maneira indiferenciada tanto na produc¸ao˜ de com- ponentes como na modificac¸ao˜ da estrutura interna de objectos. Esta panoplia´ de valores e abstracc¸oes˜ permite a codificac¸ao˜ tanto da construc¸ao˜ dinamicaˆ de novos componentes (tendo como base decisoes˜ de execuc¸ao),˜ como a reconfigurac¸ao˜ inesperada de instanciasˆ de compo- nentes. ix x Sao˜ apresentados nesta dissertac¸ao˜ varios´ sistemas de tipos que asseguram a consistenciaˆ estrutural de componentes e objectos, antes e depois de acc¸oes˜ de reconfigurac¸ao.˜ Em parti- cular e´ utilizada informac¸ao˜ de tipos intensional para descrever os configuradores que revela aspectos da sua estrutura interna. Esta informac¸ao˜ desempenha um papel fundamental na tipificac¸ao˜ de operac¸oes˜ de composic¸ao˜ e de reconfigurac¸ao.˜ Tambem´ se define uma relac¸ao˜ inovadora de subtipificac¸ao˜ para tipos recursivos de segunda ordem e e´ apresentada e provada a correcc¸ao˜ do algoritmo correspondente. A linguagem de componentes e´ entao˜ extendida com tipos recursivos e polimorfismo (parametrico´ e de inclusao)˜ utilizando estes resultados. A decidibilidade

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    253 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us