showed that using the lightweight approach and its
extension not only yields more compact code, but
also yields faster execution when compared to the
heavyweight approach.
5 RELATED WORK
The concept of ports is also available in other
modeling languages. UML-RT (Selic, 1998) and
MARTE (OMG, 2011) are two of the UML
extensions for modeling safety-critical embedded
real-time software. In UML-RT, a protocol defines
which kind of messages can be received and sent
from a port. In UML, the provided and required
properties of ports capture the information captured
by the protocol concept. On the other hand, MARTE
categorizes ports as client/server ports and flow
ports. Client/server ports are a syntactic sugar over
UML ports, enabling a more convenient way to
define the port contracts. The flow ports are used to
model the data flow between structured components.
Flow properties and flow specifications are used to
define the messages which can flow through the
ports. If flow specifications and properties are
mapped to interfaces, flow ports can be realized
using the approaches presented in this article, or else
they may need different realization approaches.
Based on the purpose of port representation and
realization, such alternative languages do not offer
additional advantages. Consequently, we have
exploited UML 2.0 due to its wider usage and our
access on vast project material.
UML ports and composite structures are
mentioned in previous studies, which use ports to
model embedded systems. The ports are mapped to
target languages such as SystemC (Andersson,
2008), (Xi et al., 2005), VHDL (Vidal et al., 2009)
and Simulink (Brisolara et al., 2008). In these
studies, one-to-one mapping between UML ports
and the target languages could be performed since
the target languages provided constructs, which
correspond to UML ports.
For mapping ports into object oriented
programming languages, there are studies which
suggest mapping ports using objects (Willersrud,
2006). The heavyweight approach, which is
presented in this paper, is employed by IBM
Rhapsody (IBM, 2015). To cope with the
performance degradation, IBM Rhapsody offers an
optimization, which is performed at runtime to find
the final destinations of ports (Douglass, 2007). The
optimization runs during the initialization of
software and uses algorithms to traverse the relay
connector chains to find the ultimate targets of the
messages. However, the additional computation
during initialization and the use of special data
structures make the code even more complex and
harder to review.
Possibility of a lightweight realization of ports
was mentioned previously (Bock, 2004). It was
argued that ports need not to be realized as objects,
but they can also be realized in a lightweight
fashion, with no port objects created at runtime.
However, the study did not present a specific
method for the mentioned lightweight realization of
ports. Another approach for realization of ports
(Mraidha et al., 2013) is very similar to the
lightweight approach presented in this paper.
However, the approach creates the getter methods
using only the name of the ports, without utilizing
the interface names. This naming scheme cannot
cope with cases where a source port requires more
than one interface in its contract and it is connected
to more than one destination ports, each destination
port providing one of the different interfaces
required by the source port. Moreover, the validity
of the approach was not demonstrated by a case
study or other means.
6 CONCLUSIONS
This article proposed a lightweight approach for
mapping UML ports to object oriented programming
language constructs. The article first presented a
widely used method for realization of UML ports,
which is prone to performance and code size
problems. Afterwards, the lightweight approach,
which enables the use of ports without sacrificing
runtime performance and source code size, was
presented. Additionally, the problems which may be
caused by disconnected ports are discussed and an
extension to the lightweight approach, which can be
used for handling disconnected ports in the source
model was presented.
Presented approaches were compared using
metrics collected from a real-life case study. Metrics
used for comparison are logical source lines of code,
average runtime performance, model transformation
duration and binary size. The case study showed that
the proposed lightweight approach results in more
efficient and more compact code. Additionally, the
time required for realization of ports and the size of
executable binaries produced after compilation were
also lower with the proposed approach. Better
performance may yield more headroom for meeting
hard real-time requirements, while smaller and less