How to Streamline Your Software Development Projects with Eclipse Jason R. Wilson

How to Streamline Your Software
Development Projects with Eclipse
Jason R. Wilson
Steven Greffenius
Version 1.1
March 15, 2005
Pathfinder Solutions LLC
33 Commercial Drive, Suite 2
Foxboro, MA 02035 USA
www.PathfinderMDA.com
508-543-7222
©2005 by Pathfinder Solutions
Table Of Contents
1.
Introduction .......................................................................................... 1
2.
What Is Eclipse?.................................................................................... 1
What It Is .............................................................................................. 1
Why It Was Developed............................................................................. 1
How It Is Structured ................................................................................ 2
3.
Model Driven Architecture..................................................................... 5
Modeling ................................................................................................ 6
Eclipse Modeling Framework ..................................................................... 6
UML Editors............................................................................................ 7
4.
Model Transformation ........................................................................... 8
Transformation ....................................................................................... 8
Transformation Maps ............................................................................... 9
Transformation Configurations .................................................................. 9
5.
Integrated Development Environments............................................... 10
6.
Target Testing ..................................................................................... 11
Testing Tools .........................................................................................11
MDA Testing Scenario .............................................................................11
7.
Development Scenario ........................................................................ 12
Monday Afternoon ..................................................................................12
Tuesday Morning....................................................................................12
Tuesday Afternoon .................................................................................13
Nearly Done ..........................................................................................13
8.
Conclusion........................................................................................... 14
References ................................................................................................. 14
Documents............................................................................................14
Websites...............................................................................................14
About Pathfinder Solutions ........................................................................ 15
ii
1.
Introduction
This paper discusses how you can apply Model Driven Architecture in
an Eclipse environment to improve your software development
processes. Eclipse creates a place where tool providers can develop
new tools, and integrate tools across the development environment.
How tool interoperability works in practice is one subject of this paper.
At a general level, Eclipse is designed to meet these requirements:
• Take advantage of Java’s usefulness for writing tools.
• Run on Windows, Linux, Unix, and other operating systems.
• Support all application development environments, whether or
not they have a graphical user interface.
• Promote the integration of software development tools, no matter
who the tool vendor or what the type of content (HTML, Java, C,
C++, XML, and so on).
The Eclipse framework integrates your development tools, and tool
integration streamlines the development process for embedded
systems. Embedded systems engineers and project managers can
benefit from this paper if they want to:
• Learn how to use the Eclipse framework in embedded systems
development, and explore the possibilities that Eclipse creates for
embedded systems engineers.
• Acquaint themselves with Model Driven Architecture (MDA), and
apply MDA to development of their own systems.
• Learn how to take advantage of some new advances in the field of
tool integration.
1
How to Streamline Your Software Development Projects with Eclipse
2.
What Is Eclipse?
Eclipse is a tools platform. It acts as the shell of an integrated
development environment. Within the shell, Eclipse contains menus,
editors, wizards, and other aids that help you build and integrate
software systems of all kinds. Eclipse lets disparate tools communicate
and create work products for each other, within a common framework.
You can do all of your development work in one place, but not be tied
to a single, proprietary development environment. In fact, you can
construct a development environment that meets the requirements of
your own project.
Before you become acquainted with how to use Eclipse for embedded
systems development, let’s take a brief look at its background. This
section explains what Eclipse is, why it was developed, and how it is
structured.
What It Is
Think of Eclipse as a developer’s backplane. It is an open source
framework, developed at IBM’s initiative. The effort began in the late
1990s. To learn more about Eclipse online, visit www.eclipse.org.
Why It Was Developed
Disparate tools have made the software developer’s workflow more
cumbersome than it needs to be. The development environment, text
editor, compiler, and debugger have all been separate tools. Microsoft
addressed this problem and developed first Visual Studio, then .NET.
IBM went to work with similar goals, and started what became Eclipse.
While both Eclipse and Visual Studio work to solve the problem of
disparate tools, only Eclipse is an open source solution that is easy to
extend and adapt.
1
How to Streamline Your Software Development Projects with Eclipse
How It Is Structured
Eclipse’s graphical interface is built around perspectives (Figure 1).
Each perspective contains views and an editor. The Eclipse workbench
organizes the perspectives and views. Projects, folders, and files
visible in these views are called resources. The Eclipse workspace
organizes these resources around Eclipse projects.
Figure 1. Perspectives and Views in the Eclipse Workbench
In a large development project, the UML editor, source code
generator, compiler, debugger, and testing tools are likely separate
applications, each with its own environment. Eclipse enables engineers
to bring all of these tools together in one environment, as plug-ins for
Eclipse. Thus you can go through the entire development process
without changing applications.
Shared data help to make interoperability possible. The same
resources are available to the different tools in Eclipse. For example,
the code generator has access to the project folder because it
generates code into it. The compiler uses the same folder, as does as
any other tool that needs the source code.
2
How to Streamline Your Software Development Projects with Eclipse
Furthermore, plug-ins are also aware of the state of resources. A
common use of this awareness is to recompile code automatically
when the source code file is saved with changes. Since both the code
generator and the compiler in an Eclipse environment have access to
the same resources, you can set the compiler to recompile the code
automatically after the code generator has created new source files.
Hence you can move from requirements to models, from models to
code, from code to deployment, and from deployment to testing
without leaving the Eclipse environment.
The Eclipse workbench is organized into perspectives, each having a
set of views and an editor pane. These perspectives function as
modules within the Eclipse platform, and they are completely
customizable. An Eclipse user can select only the modules and the
plug-ins they currently need for their project. Resources open in
Eclipse – such as diagrams, source code files, and configuration
properties – are available to any perspective or view.
Each perspective has an editor to modify the resources in Eclipse. You
might use a source code editor in one perspective, and a UML drawing
tool in another. You can open multiple editors simultaneously, but only
one can be active at a time.
3
How to Streamline Your Software Development Projects with Eclipse
Figure 2 shows the layout of the Resource perspective in Eclipse:
• The Navigator view is on the left. It lists the resources available in
the perspective.
• On the right side, the editor pane has a simple text editor open.
• In the lower left is the Outline view. If the format of the current
file is suitable, the Outline view let’s you browse the outline of the
file and navigate to a portion of the file selected in the view.
• The task pane displays a list of to do items for the project.
The right side of the toolbar shows that the Resource perspective is
open. Other perspectives would contain alternate selections and
layouts of views, with the same resources available.
Figure 2. Resource Perspective in Eclipse
4
How to Streamline Your Software Development Projects with Eclipse
3.
Model Driven Architecture
Model Driven Architecture is a set of standards established by the
Object Management Group (OMG). It is designed to separate the
business logic of a system from its implementation. In Figure 3, the
industries in the outer circle dictate the business logic, and the
platform-driven requirements in the inner circles dictate the
implementation.
Figure 3. MDA Standards and Applications
In addition to the standards shown in Figure 3, MDA works with
several environments and development technologies, including J2EE,
.NET, and XML. In fact, one of the greatest advantages of MDA is that
it is not tied to any single technology, tool, or vendor. As the OMG
states, “MDA provides an open, vendor-neutral approach to the
challenge of business technology change.” In principle, the tools used
to apply MDA should work together and be easily interchangeable. In
practice, MDA tools must work together. They can take advantage of
the Eclipse framework in order to do so.
Model Driven Architecture offers big gains for embedded systems
developers, but the problem of how to integrate the various tools
required for MDA has not yielded a simple solution. To start, MDA
developers need a UML editor, a transformation engine, a compiler,
and a code debugger. A model-level debugger and hardware
simulators also aid the process. Eclipse solves most of these
integration problems and streamlines the development process. In
doing so, Eclipse helps embedded systems developers with practical
problems of design, model transformation, debugging, and system
deployment.
5
How to Streamline Your Software Development Projects with Eclipse
Modeling
One of the key concepts of MDA is the separation of concerns of a
system. The business and application logic may be designed
independent of the implementation. MDA supports modeling this
business logic using the Unified Modeling Language (UML) and the
soon to be release UML 2.0 standard.
This paper is not intended to give the reader a full and in depth
understanding of MDA and UML, but we will take the time here to
explain a few important points about modeling. The next two sections,
Eclipse Modeling Framework and UML Editors, tie these points to
Eclipse.
Five diagrams are important to the MDA process:
• Use Case Diagram – shows a set of scenarios, how they are
related, pre- and post-conditions.
• Sequence Diagram – models a series of actions and behaviors
between subsystems or classes.
• Subsystem (Domain) Diagram – displays the architectural
breakdown of a system into subsystem and their dependencies.
• Class Diagram – consists of a sets of classes and associations
between the classes. The classes may also display its set of
attributes and operations.
• Statechart Diagram – shows the states of an instance of a class
and its transitions between them.
Additionally, we need a way to model actions in a system. We
accomplish that with activity diagrams, action language, or a
combination of both.
Numerous vendors support these UML diagrams. Many of these tools
allow for interoperability by allowing for the saving of the UML models
in a data format defined by the OMG standard XML Meta-Data
Interchange (XMI). The XMI data may then be ported to another tool
where the model data may be accessed. OMG has also defined a metamodel for UML using its Meta-Object Facility (MOF).
Eclipse Modeling Framework
Eclipse has implemented a MOF-like meta-model to support modeling
called Ecore, which is part of the Eclipse Modeling Framework (EMF).
EMF supports importing model data from XMI, XML, Rose models, or
annotated Java code. Then the EMF Generator can create a set of Java
classes for the model along with a set of adapter classes to view and
edit the model. Perhaps the most important feature of EMF is that
these generated classes provide “the foundation for the interoperability
with other EMF-based tools and applications.” (www.eclipse.org/emf).
Just as MDA is a set of standards that support interoperable tools, EMF
allows tools built into the Eclipse environment to be interoperable in
reality.
6
How to Streamline Your Software Development Projects with Eclipse
The code generated from EMF often is used as the repository for the
persistent data for a tool being developed with EMF. The UML2 tool
project is a component that allows UML objects to be stored in EMF.
Due to the generated code from EMF including code to integrate it into
the Eclipse platform, a tool based on EMF can easily interoperate with
other Eclipse tools. You could have a tool for test case generation, one
for design rationale, and one for tracing requirements, each with its
own EMF-based repository, but all of which can simultaneously operate
on the models and codes currently being developed.
UML Editors
A vendor choosing to create a UML editor for the Eclipse platform may
extend and plug into the EMF, UML2, Graphical Editing Framework
(GEF) tools, along with many other Eclipse plug-ins. The central
functionality provided by the UML Editor in Eclipse is a graphical
modeling toolkit.
Other tools perform these functions:
• The Eclipse Modeling Framework serializes data.
• UML2 interprets data from UML to the EMF repository.
• The Graphical Editing Framework displays core graphical
elements.
• The Team Framework or its extensions handle configuration
management.
Figure 4 illustrates the relationship among Eclipse tools, UML features,
and other Eclipse plug-ins.
Figure 4. Eclipse Framework
7
How to Streamline Your Software Development Projects with Eclipse
4.
Model Transformation
A Platform Independent Model, or PIM, includes all of the business
logic required for a system. As the name implies, the PIM is
independent of its implementation. It does not contain any information
beyond how the system logically works. The Object Management
Group writes at its website that platform-independent models move
software systems “away from technology-specific code, helping to
insulate business applications from technology evolution, and further
enable interoperability.”
Transformation
Model transformation is the process of transforming a Platform
Independent Model into a Platform Specific Model (PSM). A
transformation engine takes as input a PIM, a set of transformation
rules or maps, a set of properties, and some realized code. From these
inputs, the transformation engine produces fully executable code
tailored for the target platform (Figure 5).
Figure 5. Elements of Model Transformation
8
How to Streamline Your Software Development Projects with Eclipse
Transformation Maps
The transformation maps are a set of templates or scripts defining how
to map meta-model elements to platform specific elements. Each
target platform may have its own map definitions. For example, a
transformation map may define translations to C++ running in Red
Hat on an x86 processor. This map may also include make files or
project files customized for compiling the generated code. In Eclipse,
the transformation map specifies how to create and configure an
Eclipse project for the code (see Transformation Configurations below).
Engineers can customize the maps in order to control model
transformations. Customizations may include improvements,
extensions, or alternatives to the transformation rules.
Transformation Configurations
A transformation map may be generalized to include transformations
from the model to C++ code running on any platform. One may then
assume that this will result in bloated, unreadable code full of #ifdef
statements. Alternately, you can provide the transformation engine
with a set of properties that define how to translate the model using
the designated transformation map. This results in generated code
that is specific to the targeted platform.
To continue this example: many C++ transformation rules are the
same for different processors and operating systems, especially at the
more abstract levels. An advantage of this uniformity is that it allows
us to use the same transformation map to generate code for various
target platforms, including the embedded target, the host
development environment, or a testing and validation environment.
The transformation map generally uses the same rules for each of the
targets, but the transformation properties allow the map to generate
specific code for the platform for portions that need to be platformspecific.
The transformation properties are edited and applied using an EMFbased tool. A repository of properties and configurations is generated
using EMF. This repository then allows the engineer to set properties
for the model and the transformation map. Since both the editor and
the modeler are EMF-based, the property editor is aware of modeled
elements. For example, one may want to define one subsystem to run
on its own processor while the rest of the subsystems run on another
processor, but both are running the same RTOS. Additionally, the lone
subsystem needs to be optimized for float number computations and a
small memory footprint. The transformation properties editor allows
the engineer to select modeled elements, such as a subsystem, and
define properties for it, such as a target processor, floats-only, and
minimized code size.
9
How to Streamline Your Software Development Projects with Eclipse
5.
Integrated Development Environments
One of the principal purposes of Eclipse is to support IDEs. With the
standard installation of Eclipse, a Java IDE called Java Development
Tools (JDT) is complete with an editor, a compiler, and a debugger.
Another Eclipse project is the C/C++ Development Tools (CDT), which
includes an editor, debugger, parser, makefile generator, and more.
Most RTOS vendors have supported an IDE for development on their
RTOS. Most of these vendors have taken advantage of tool
interoperability in Eclipse, and have integrated their IDE into Eclipse.
These IDEs have traditionally included an editor, compiler, debugger,
and profiler. Using Eclipse, IDE tool vendors can extend already
created Eclipse tools and provide customizations for their environment.
Since Eclipse is an extendable platform, an IDE may be able to focus
on just one or two pieces of the IDE, such as the compiler and
debugger. Another tool vendor could provide another Eclipse plug-in
for the code editor, and yet another may provide a plug-in for
profiling. Since Eclipse supports interoperability of tools, the plug-ins
work together fluidly and prevent the user from needing to jump
around from tool to tool and window to window.
Perspectives work with plug-ins to make these fluid transitions
possible. You can organize your Eclipse perspective to have one view
showing memory profiles, another with a browser of the code files, and
another watching variables, all while the editor shows the currently
executing line of code. Pursuing these advantages, most vendors of
code development tools now provide an IDE built for Eclipse, or have
extended an existing IDE for use in Eclipse.
10
How to Streamline Your Software Development Projects with Eclipse
6.
Target Testing
We have a variety of testing options available to use in Eclipse. From
the Eclipse environment we can test at the model level and at the code
level. Both can be done in your host environment and on your target
hardware. In addition, hardware scoping and profiling tools are
available for Eclipse.
We increase the testability of a system when we can run tests on both
the host and the target environments. In the Eclipse IDE, we can
create a set of tests for our system, including all inputs, expected
outputs, and (for white box testing) any internal actions expected.
These tests can be run from inside the Eclipse environment on your
models and code. Using the Eclipse IDE plug-in for your RTOS, you can
upload the code to your hardware and then run the same suite of
tests.
Testing Tools
So often during testing, we have a slew of tools we are simultaneously
using to test and debug the software. We may have a tool monitoring
input and output channels, a test driver, a code debugger, a processor
profiler, and more. Often these are independent tools that do not know
about each other and thus do not work together. Occasionally we will
have a debugger with built in functionalities like a profiler, but it is
often not as good as external profilers.
In Eclipse, one environment has each required tool plugged in. Using
the resource notification capabilities of Eclipse, these tools can
communicate and notify each other. This architecture allows the tools
to focus on what they are good at without needing to add additional
functionality. The debugger plug-in only needs to worry about
debugging code and the vendor of it can specialize and focus on that
exclusively. Another vendor can then produce a profiler that utilizes
the Eclipse platform to communicate to the other tools like the
debugger.
MDA Testing Scenario
Let’s run through an example. We have a system designed in UML,
have transformed it into code, compiled it in our target debugger, and
loaded it onto the hardware. We start the software on the target. Both
the model debugger and the code debugger show the software is
running. We then start our test driver and provide inputs to the target.
Our model debugger allows us to observe the sequence of actions the
software is taking, including monitoring an instance of a class
transition from state to state. When it finds a bug, you must switch to
the code debugger to find where in the code the bug exists. On the
Eclipse platform, however, you can simultaneously view the defective
code, the location in the model where the bug is found, and the
template used to transform the portion of the model into the defective
code.
11
How to Streamline Your Software Development Projects with Eclipse
7.
Development Scenario
The following is an example of a development scenario designed to
show the work flow of an embedded software project and how using
MDA in an Eclipse environment streamlines this process.
Monday Afternoon
An engineer launches Eclipse and plans to start a new software
project. First, there are some project management issues to solve like
setting up source control. Then we quickly move on to analyzing the
system requirements. So we begin creating Use Case diagrams to help
us gain better understanding of the system and how it breaks down.
We can soon move on to dividing up the system into subsystems and
creating a domain model. So by now we have one domain model and
say five use case diagrams. Suddenly we have six UML diagrams, all of
which have been done in Eclipse. Sounds like a good day’s work: let’s
check this into source control. Using Eclipse Team functionality, this is
done using whatever source control you are using (provided the right
plug-in is installed by your superb IT department).
Tuesday Morning
So on the next day, you want to gain a better understanding of your
subsystems, so you create some sequence diagrams to model the flow
of control of the system. Great, we are making excellent headway on
the logical understanding of the software system.
Your manager, however, is having all sorts of questions about how you
are going to deal with memory management and clock speeds and
such. Thankfully, the engineer in the next cubicle is on top of this.
While you are busy with the logical system, your neighbor is working
on a separate concern, the implementation and design. She is creating
test systems to run on the target hardware and then tinkering with the
design to improve the performance.
So back to our UML diagram, we have a good set of high level
sequence diagrams and then we dive into each of these domains and
create class diagrams and quickly onto statechart diagrams for many
of the classes. Of course, all along you have been very careful to
document the model thoroughly. Each class, attribute, operation, and
more have at least a one sentence description.
Again, your manager comes along seeing what you are up to. He is a
little concerned because your neighbor is running code on your target,
but you are still drawing models. He wants to know what you have
been up to. No problem, before your manager can even walk away,
you have clicked a few buttons and transformed your models and the
associated documentation into a full report, printed, and handed to the
manager to chew on for a while.
So now you can get back to work creating more details for your
diagrams. You add some new symbols, as well as action language to
12
How to Streamline Your Software Development Projects with Eclipse
add actions to the model. Now you begin to wonder if the model’s
logical structure holds together. With a few clicks of the mouse, you
generate test cases and test drivers from your sequence diagrams and
use cases, and transform your model into code ready to run in a
simulation environment on your host machine.
Tuesday Afternoon
Using a model level debugger and test harness, the test cases are
executed and you are able to observe the behavior of your system
thus far by monitoring the execution of the models. You find a bug,
invoke a change on the running simulated system to see if your
potential change could fix the problem, verify your result, stop the
debugger, make the change in the model and rerun the test.
At last, after a few hours of careful work, you have enough of the
system logically designed to tryg it on your target environment. Using
the Eclipse Team Framework, you get a copy of the design that your
neighbor is working on, transform your model into code using this
design, compile it, load it, and again run your test cases. You and your
neighbor watch the model debugger as the target executes the
software. You find that a class erroneously transitioned to an
unexpected state. Now looking at both the code and the model side by
side, your neighbor finds a mistake in the design and returns to her
cubicle to fix, test, debug, and test again.
Meanwhile you promote your models to CM so your colleague can
generate her own code and run on the target hardware. This parallel
process continues and continues. Finally, you have a good portion of
the software running correctly on the target hardware.
Nearly Done
But now you need to start planning to run portions of this software on
two processors simultaneously. No problem: you bring up in Eclipse
your transformation configurations and preferences – similar to your
compiler preferences – and adjust the settings to generate code for
two processors running on the same OS communicating over sockets.
You re-generate the code, upload it to memory, and run your tests
again.
Right when you think you are getting close to completion, your
manager comes in and informs you of some requirement changes. The
functional changes are given to you, the non-functional are given to
your neighbor. Each of you retreat to your cubicle. You muck around in
the model, change a few state diagrams, add a class or two, and the
like. All over again, you generate the code, now using your neighbor’s
updated design incorporating the non-functional requirements, upload
to the hardware, run your tests, debug, and so on.
At last you are done, it only took you a few hours and you never
opened a single piece of software other than Eclipse.
13
How to Streamline Your Software Development Projects with Eclipse
8.
Conclusion
The development of embedded systems poses some difficult
challenges. Many of these challenges arise from the peculiar
constraints associated with deploying software to chips used to
operate highly specialized equipment. By separating the logic of a
software system from its target environment, Model Driven
Architecture overcomes a number of these challenges.
For all of the problems it has solved, MDA remains a fairly complex
engineering method. One source of this complexity is the number of
tools you have to use to practice MDA successfully. If these tools could
operate together more easily, sharing both data and work products,
MDA would become a transparently simple process, and its advantages
would be obvious. Eclipse, a relatively new platform, effectively
integrates an extraordinary range of software development tools. Its
capabilities as an open tools platform make MDA a practical and
streamlined path to deployable, high-performance systems, no matter
how constrained the operating environment.
References
Documents
Accelerate Embedded Software Development with Model Driven
Architecture, Carolyn Duby, January 2005.
How to Apply Model Driven Architecture: Rigorous Software
Development with Domain Modeling, Peter Fontana, January 2005.
Managing a Transition to Model Driven Architecture, Peter Fontana,
January 2005.
A New Development Environment for the Enterprise: Rational Software
and the Eclipse Platform, Sky Matthews, December 2002.
Eclipse Platform Technical Overview, February 2003.
Websites
www.eclipse.org
www.eclipse.org/emf
www.omg.org/mda
www.pathfindermda.com
14
How to Streamline Your Software Development Projects with Eclipse
About Pathfinder Solutions
Headquartered in Foxboro, Massachusetts, Pathfinder Solutions
provides embedded software engineers with the tools, methods and
services needed to reduce development costs and improve quality.
Pathfinder Solutions is an active member of the Object Management
Group, and is helping to shape the future of Model Driven Architecture.
If you would like to learn more about Model Driven Architecture,
please contact us at:
Pathfinder Solutions
33 Commercial Street, Suite 2
Foxboro, Massachusetts 02035
Phone: 508-543-7222
Email: [email protected]
Internet: www.PathfinderMDA.com
15