Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
APPLICATIONS DEVELOPMENT
Carlos Abalde, Vı́ctor M. Gulı́as, Laura M. Castro, Carlos Varela and J. Santiago Jorge
MADS Group, Department of Computer Science, University of A Coruña, A Coruña, Spain
cabalde@udc.es, gulias@udc.es, lcastro@udc.es, carlosvarela@udc.es, sjorge@udc.es
Keywords: Distributed systems, functional languages, design patterns, cluster computing, client/server architecture.
Abstract: This paper presents our ideas about how to evolve a first and early architecture, which has been used in the
development of a large scale management client/server application, to a more sophisticated one, which could
be reused in other developments, significantly reducing the development life cycles of future versions. We
also expose some problems that arised in the process and suggest some solutions.
DB
Distributed DB
DB
DB
DB
The paper is structured as follows. Section 2 gives Client side Server side
422
ERLANG/OTP FRAMEWORK FOR COMPLEX MANAGEMENT APPLICATIONS DEVELOPMENT
• Persistent objects layer: Here, domain trans- • Customer.java, which is an user interface facade
fer objects (TOs) and data access objects to access the service and perform internal tasks.
(DAOs) (Marinescu, 2002) are defined. Each TO
models a domain entity, and the DAO is the mod- 2.2 Access Points and Use Cases
ule that interacts with the persistence layer.
• Persistence: It represents the permanent storage Each access point is described by means of it use
over a relational database. cases. Use case descriptions include names, input pa-
Source code for implementing these layers can be rameter list, and transactional information.
automatically generated from a description of: As in the previous section, two Erlang modules
are built from each access point description:
• The client-server communication format.
<access-point name="customer">
• The use cases. <use-case name="add_customer" trans="yes">
• The domain transfer objects and relationships. <param name="CustomerName"/>
<param name="CustomerDescription"/>
</use-case>
2.1 Client-Server Communication </access-point>
The transport layer needs to be lightweight and easily The Erlang generated black box module for this
integrable with different client applications. There are access point is:
several possibilities to solve this problem. For exam- -module(customer_facade).
ple, interface definition languages like XDR (XDR, -export([add_customer/3]).
2003) or ASN.1 (ASN.1, 2003) or complex frame-
works like CORBA (Corba, 2003), most of them sup- add_customer(Session, CName, CDescription) ->
ConnRef = db_facade:connect(),
ported by Erlang/OTP.
session:set_connection(Session, ConnRef),
The UBF scheme (Universal Binary Format (Arm- R = customer_facade_cb:add_customer(Session,
strong, 2002)) has the expressive power of the XML CName, CDescription),
set of standards, but it is considerably simpler. Thus, db_facade:endtrans(ConnRef),
in our framework, we can see the server as a service R.
whose interface is defined in XML as follows, And the callback module skeleton is:
<method name="add_customer" cache="0">
<input>UBF description</input> -module(customer_facade_cb).
<output>UBF description</output> -export([add_customer/3]).
</method>
add_customer(Session, CName, CDescription) ->
Then, our compiler gets each facade interface de- %% write your code here
finition and builds the following skeletons: not_implemented.
• customer.erl, which is a black box module The parameter Session represents the distributed
(from the programmer’s point of view). database over the deployment cluster, in which client
add_customer(Session, UBFParams) -> session state data is stored, providing fault-tolerance
% unpack UBFParameters features. Database connections are organised within
% callback implementation module
R = customer_cb:add_customer(Session,
a supervision tree, so that automatic rollbacks can be
Param1, performed if necessary.
...,
ParamN), 2.3 Persistent Objects Layer
% pack R in a UBF value
Business logic associated with a complex RMIS usu-
• customer_cb.erl, which is a callback module ally has to deal with a big number of domain entities
skeleton that must be filled in by the programmer. with complex relationships amongst them. The actual
add_customer(Session, P1,..., PN) -> coding of these objects and relationships storage is a
% call domain facade very annoying and repeatable task.
case customer_facade:add_customer(Session, The entities are described with their name, a list
P1,...,
PN) of
of their attributes and their relationships.
{error, Reason} -> % adapt result <entity name="customer">
R -> % adapt result; <primary-key>
end. <attribute name="id" type="integer"/>
</primary-key>
423
WEBIST 2007 - International Conference on Web Information Systems and Technologies
424
ERLANG/OTP FRAMEWORK FOR COMPLEX MANAGEMENT APPLICATIONS DEVELOPMENT
425