WWW.DIS.XLIBX.INFO
FREE ELECTRONIC LIBRARY - Thesis, dissertations, books
 
<< HOME
CONTACTS



Pages:   || 2 | 3 |

«Abstract. Data encapsulation is a familiar property in object-oriented programming. It is not only useful for modelling things in the real world, but ...»

-- [ Page 1 ] --

Data Encapsulation in Software Components

Kung-Kiu Lau and Faris M. Taweel

School of Computer Science, The University of Manchester

Manchester M13 9PL, United Kingdom

{Kung-Kiu,Faris.Taweel}@cs.manchester.ac.uk

Abstract. Data encapsulation is a familiar property in object-oriented

programming. It is not only useful for modelling things in the real world,

but it also facilitates reuse by enabling the creation of multiple instances

of the same class, each with its own identity and private data. For CBSE, this kind of reuse is clearly also one of the key desiderata. However, it must be achieved in conjunction with composition, which is central to CBSE. In this paper we show how data encapsulation can be combined with composition, by extending a component model we have defined previously.

1 Introduction Data encapsulation is a familiar property of objects, as in object-oriented programming. It is not only useful for modelling things in the real world, but it also facilitates reuse by enabling the creation of multiple instances of the same class, each with its own identity and private data. For CBSE, this kind of reuse is clearly also one of the key desiderata, since components are considered to be reusable templates for multiple component instances. However, since composition is central to CBSE, the question is how to design composition mechanisms or operators that make data encapsulation possible at every level of composition, that is, how to make sure that every composite component created by composition encapsulates its own data. In this paper, we argue that this combination of data encapsulation and composition is not possible in current component models; and then show that it can be achieved by extending a component model that we have defined previously.

Current component models can largely be divided into two categories [9,5]: (i) models where components are objects, as in object-oriented programming; (ii) models where components are architectural units, as in software architectures [14,1]. Exemplars of these categories are Enterprise JavaBeans (EJB) [3,12] and architecture description languages (ADLs) [2,10] respectively. In models where components are objects, components are assembled by method calls. However, this is not (algebraic) composition, since an object O1 assembled with an object O2 by calling a method in O2 will result in two objects, not one (composite) object. Therefore, even though data encapsulation is possible in O1 and O2 separately, there is no composition mechanism that can compose O1 and O2 properly, let alone preserve data encapsulation.

H.W. Schmidt et al. (Eds.): CBSE 2007, LNCS 4608, pp. 1–16, 2007.

c Springer-Verlag Berlin Heidelberg 2007 2 K.-K. Lau and F.M. Taweel In component models where components are architectural units, port connections provide a composition mechanism, and composites can be defined. However, data encapsulation is not always defined or possible. In fact, the role of data is very unclear in architectural units. These units can represent both computation and data, or just data, and data encapsulation is not considered as part of composition in general. Where architectural units have data ports, it could be argued that these ports represent data encapsulation. Even in this case, however, it is not clear whether data encapsulation is possible at every level of composition.

In this paper, we describe an approach to composition that allows data encapsulation at every level of composition. Our approach is based on a component model [6] where composition operators are first-class citizens, and they also enable every component instance, in particular a composite component instance, to encapsulate its own data.

2 Composition with Data Encapsulation Components are intended for composition, and so they should be compositional, i. e. if C1 and C2 are components, then a composition C3 of C1 and C2 must be a component too. Furthermore, the composition should be defined as a composition operator that composes components into new (composite) components. In other words, in a component model, components and composition operators should be first-class citizens. Any component model should have this property.

A good component model should also allow components to encapsulate data, but to be really useful it should do so at every level of composition. We have proposed a component model in [6] and in this paper we describe how we can extend this model and use it to achieve this kind of data encapsulation.

For illustrative purposes, we shall consider a simple banking example.

Example 1. Consider a banking system with two bank consortia BC1 and BC2, consisting of the sets of banks {B11, B12} and {B21, B22} respectively.

Each bank, in turn, consists of a set of branches, e.g. bank B21 has branches {BB211, BB212}, and so on.

In our component model we would build up the system by composing components using composition operators (see Fig. 2).

In our model, we have two kinds of components: atomic and composite components. Composite components are built from atomic (and other composite) components, but all components are templates, with no data except constants,

–  –  –

Fig. 2. A component-based implementation of the banking system but with code for the services they provide. Since components are templates, it is meaningful and possible to make copies of components. For the bank system, for a particular bank consortium, a bank branch can be an atomic component with code for the usual operations like withdrawal, deposit and check balance.





This provides a template for all bank branches, and so we can construct many bank branches (all the BB’s) as copies of this component.

Furthermore, in our model, it is possible to create instances from different component copies. For example, bank branches BB111 and BB211, which are different copies of BB11 (which is in turn a copy of the bank branch atomic component), and which belong to different consortia, can be each instantiated with their own address, sort code and customer accounts.

In our model, composite components, just like atomic components, can also be copied (and the copies instantiated later). For example, two bank branches, say BB11 and BB12, can be composed by a suitable composition operator to produce a bank composite component B11. The latter is a template that contains all the operations its sub-components provide. Therefore, it would make sense to construct other bank components from this component by copying. The original component as well as its copies contain, in addition to operations, some place holders for private data that can be initialised when the complete (composite) components are instantiated.

Similarly, a bank consortium component can be constructed by composing bank components. In Fig.2, using a suitable composition operator, a bank component composed with a copy of a bank component yields a bank consortium component. This new component can be further composed with a copy of itself to build the bank system.

It is worth noting that in the bank example, only one atomic component (bank branch) and one composition operator are necessary to build the entire bank system. Each composition in our implementation results in a properly defined composite. Clearly our model provides proper composition mechanisms.

The question is whether we can also make it encapsulate data.

3 Our Component Model Before we discuss how we extend our component model to enable data encapsulation, in this section we briefly outline the model that we presented in [6].

4 K.-K. Lau and F.M. Taweel In our model, we have two kinds of basic entities: (i) computation units, and (ii) connectors. A computation unit U encapsulates computation. It provides a set of methods (or services). Encapsulation means that U ’s methods do not call methods in other computation units; rather, when invoked, all their computation occurs in U. Thus U could be thought of as a class that does not call methods in other classes.

There are two kinds of connectors: (i) invocation, and (ii) composition. An invocation connector is connected to a computation unit U so as to provide access to the methods of U.

A composition connector encapsulates control. It is used to define and coordinate the control for a set of components (atomic or composite). For example, a sequencer connector that composes components C1,..., Cn can call methods in C1,..., Cn in that order. Another example is a selector connector, which selects (according to some specified condition) one of the components it composes, and calls its methods.

Components are defined in terms of computation units and connectors. There are two kinds of components: (i) atomic, and (ii) composite (see Fig. 3). An

–  –  –

Fig. 3. Atomic and composite components: encapsulation and compositionality atomic component consists of a computation unit with an invocation connector that provides an interface to the component. A composite component consists of a set of components (atomic or composite) composed by a composition connector.

The composition connector provides an interface to the composite.

For example, in the bank system (Fig. 2) in Example 1, the atomic component BB11, a bank branch, may be defined as shown in Fig. 4(a), with an invocation connector IBB11, and a computation unit with the methods deposit, withdraw, balance. The composite component B1, a bank, may be defined as shown in

–  –  –

Fig. 4(b), as a composition of the atomic components BB11 and BB12 using a selector connector (denoted here by B1 too, for convenience). The bank consortium composite component in Fig. 2 may also be composed (from banks) using a selector connector, since the consortium has to choose the bank with the branch to which the customer’s account belongs.

In our model, invocation and composition connectors form a hierarchy [8].

This means that composition is done in a hierarchical manner. Furthermore, each composition preserves encapsulation. This kind of compositionality is the distinguishing feature of our component model. An atomic component encapsulates computation (Fig. 3(a)), namely the computation encapsulated by its computation unit. A composite component encapsulates computation and control (Fig. 3(b)). The computation it encapsulates is that encapsulated in its sub-components; the control it encapsulates is that encapsulated by its composition connector. In a composite, the encapsulation in the sub-components is preserved. Indeed, the hierarchical nature of the connectors means that composite components are self-similar to their sub-components; this property provides a basis for hierarchical composition.

In the next section, we will show how to extend our model to include data encapsulation.

4 Data Encapsulation

Our approach to data encapsulation is illustrated by Fig. 5. Basically, we want to extend our model (Fig. 3) to allow each component (atomic or composite) to define place-holders for its own data at design time. These place-holders are indicated by patterned squares in Fig. 5. Thus, whereas in our current model, a composite encapsulates computation and control (Fig. 3(b)), in the extended model, a composite additionally encapsulates data (Fig. 5(b)).

Our extension is centred on the constructor of a component. We want to be able to make copies of a component at design time, so that they all have the same types of data place-holders. Copies of a component will also have the same constructor as the of the original component. At run-time, we want to be able to create an instance of a component or a copy by using the component’s constructor, and we want to be able to initialise its data place-holders with

–  –  –

actual data. This way, instances of different copies (atomic or composite) can encapsulate their own private data.

For the bank example, this is illustrated by Fig. 6. In Fig. 6(a), a branch component BB11 encapsulates its customers’ data. Using a suitable composition connector, a bank component can be constructed from branch components BB11 and BB12, where both components are actually copies of the bank branch component. As shown in Fig. 6(b), the bank (composite) component encapsulates its own data which is separate from its sub-components’ data. The encapsulation of the latter in each branch sub-component is preserved in the bank composite.

The process of instantiating a component (or a copy) often requires initialisation of encapsulated data. Such data can either be constants defined in the component’s design phase; or data created at instantiation time. A component therefore must have a constructor which enables data initialisation to be performed. In our model, we use data constructors in the component constructor for this purpose. Data constructors may require to read data from external resources during the data initialisation process. Therefore, connectors must have data I/O semantics to carry out their tasks. In our model, connectors are capable of performing data I/O operations.

Initialisation of encapsulated data in the bank example is illustrated in Fig. 7.

A bank branch component must be initialised with the branch name which is a constant string. It must also read and persist data about the process that owns the branch component instance. The latter data may include date, process account and network information, etc. For simplicity, we assume that the component only logs its instantiation date. The invocation connector of a branch component accesses these data values during component construction at runtime. A bank component composed from two branches also has its own separate constructor which performs its data initialisation operations. These operations include, for example, setting the bank name as well as logging a record on the instantiation date and other system data. As far as data is concerned, the bank component and its sub-components set their initial data independently, each using its own constructor. In Fig. 7, bank component B1 reads bank name (B1 ) and date (sysdate). Its sub-components perform similar data initialisation operations when their instances are created. Initialisation performed by each connector of B1 is indicated by arrows bearing data names.



Pages:   || 2 | 3 |


Similar works:

«SERIES IZA DP No. 5918 Exploring the Impacts of Public Childcare PAPER on Mothers and Children in Italy: Does Rationing Play a Role? Ylenia Brilli DISCUSSION Daniela Del Boca Chiara Pronzato August 2011 Forschungsinstitut zur Zukunft der Arbeit Institute for the Study of Labor Exploring the Impacts of Public Childcare on Mothers and Children in Italy: Does Rationing Play a Role? Ylenia Brilli DEFAP (Catholic University of Milan and University of Milano-Bicocca) Daniela Del Boca University of...»

«Analysis: Smart Meter and Smart Grid Problems Legislative Proposal December 2012 Original edition sponsored by Sonoma County Citizens Against Smart Meters Jolie Andritzakis P.O. Box 239 Sebastopol, CA 95473-0239 707-837-0934 Analysis prepared by Nina Beety P. O. Box 1505 Monterey, CA 93942 nbeety@netzero.net Second Edition December 2012 Table of Contents Introduction 5 What is a Smart Meter? 7 Smart Grid/Smart Meter problems and issues o Overview 9 o Overcharging, accuracy, and the Structure...»

«Resource Guide for Persons with Disabilities ACKNOWLEDGEMENTS Sincere thanks to Helena Livitz, YLS Special Project Coordinator who updated and contributed to this 3rd edition of Resource Guide for Persons with Disabilities. THANK YOU Special thanks is due to the following agencies and individuals whose efforts in updating this Resource Guide have proven invaluable: Equip for Equality Barry Taylor, Vice President for Civil Rights and Systemic Litigation Bylynda Bridges Cecille Escartin Brynna...»

«Working While Disabled — How We Can Help What’s inside Contacting Social Security..... 3 Getting disability benefits? We can help you get to work.... 4 Social Security disability rules Social Security work incentives at a glance.......... 6 How your earnings affect your Social Security benefits........ 8 What to report if you work and receive Social Security disability............ 9 If you lose your job............ 9 Special rules for...»

«The Tramp in Transition: The Musical Movements of City Lights Jim Lochner jim@jimlochner.com 1. INTRODUCTION Beginning with City Lights in 1931, every Chaplin film bears some form of the controversial credit—“Music by Charles Chaplin”. Yet Chaplin could not read or write music. Instead, he employed a string of “music associates” to help him arrange and orchestrate his musical vision into a proper orchestral score. In his review of City Lights titled “The Chaplin Buncombe,” noted...»

«adria action 361 pd adria action 361 pd Adria Wohnmobil | wohnmobilpark.com gebraucht kaufen beim Wohnmobilpark Bundesweite Preisgarantie ! Wohnwagen Adria Action 361 PD günstig mieten Mieten Sie diesen Wohnwagen zu günstigen Preisen. Wir führen auch viele weitere tolle gebrauchte Wohnwagen zu besonders günstigen Preisen Vorzelt für Adria Action 361 LH oder 361 PD (#936681 Das passgenaue Vorzelt für den Adria Action 361 LH Schließt passgenau ab mit der Rundung der Außenwand. Viel Licht...»

«September 2009 Common Operations Conventions Contents 1. Know Your Client 2. Confirmations 2.1. What is a Confirmation? 2.2. Matching of Confirmations 2.3. Acceptable Forms of Confirmation 2.3.1. Facsimile 2.3.2. SWIFT 2.4. Amending Deals 3. Settlement 3.1. What is a Settlement? 3.2. Standard Settlement Instructions (SSI) 3.2.1. SSI Issuing Procedures 3.3. Settlement Methods, Systems and Documentation 3.3.1. Australian Payments Clearing Association 3.3.2. Real-Time Gross Settlement (RTGS)...»

«“AMATEUR” MASCOTS ON THE LOOSE: THE PRAGMATICS OF KAWAII (CUTE) by Mary Birkett Thesis Submitted for Anthropology Honors University of Michigan 2012 Advisors: Jennifer E. Robertson Erik Mueggler Birkett The Pragmatics of Kawaii (Cute) i ACKNOWLEDGEMENTS I hardly know whom to thank first. This thesis feels like it does not belong to me, but to the people below who supported and questioned me. I was lucky to have so many people who understood my thesis better than I did, who were willing to...»

«20th General Conference of the CONDENSED MATTER DIVISION of the European Physical Society Prague, Czech Republic, 19–23 July, 2004 Content Organizing Committees.......................................... ii Welcome Address............................................... iii Day by day program overview.................................... vi Abstracts: Monday morning......»

«KOMMISSION DER EUROPÄISCHEN GEMEINSCHAFTEN Brüssel, den 18.10.2006 SEK(2006) 1292 ARBEITSDOKUMENT DER KOMMISSIONSDIENSTSTELLEN Begleitdokument zu dem Vorschlag für eine RICHTLINIE DES EUROPÄISCHEN PARLAMENTS UND DES RATES zur Änderung der Richtlinie 97/67/EG über die Vollendung des Binnenmarktes für Postdienste ZUSAMMENFASSUNG DER FOLGENABSCHÄTZUNG {KOM(2006) 594 endgültig} {SEK(2006) 1291} DE DE 1. EINLEITUNG Das vorliegende Dokument bezieht sich Inhalt: auf den Punkt 2006/MARKT/006...»

«Data Communication and Computer Network Data Communication and Computer Network About the Tutorial This tutorial gives very good understanding on Data Communication and Computer Networks. After completing this tutorial, you will find yourself at a moderate level of expertise in knowing DCN, from where you can take yourself to next levels. Audience This tutorial is prepared for the beginners to help them understand Data Communication and Computer Networks. Prerequisites Before proceeding with...»

«www.golfclub.com.au Tel: 07 3366 6696 sales@golfclub.com.au October 2013 The following are responses by Golf Computer Systems to items on the interactive rd checklist for Clubs in relation to the new GA Handicapping Systems to be release 23 January 2014. Does the club know how to operate the changed functionality in our handicapping and competition management system that has been brought about by the handicapping changes? GCS supported Clubs will be provided with written and video documentation...»





 
<<  HOME   |    CONTACTS
2016 www.dis.xlibx.info - Thesis, dissertations, books

Materials of this site are available for review, all rights belong to their respective owners.
If you do not agree with the fact that your material is placed on this site, please, email us, we will within 1-2 business days delete him.