Tip:
Highlight text to annotate it
X
Welcome to the webcast introducing Domain-Specific Modeling.
Engineering software is all about bridging the gap between the solution
expressed in the problem domain terms
show here in the red area
to its implementation
in the machine code running on the hardware
shown in the blue area.
Regardless of what kind of software you are developing finding a solution always
starts by expressing that solution in terms of the problem domain.
Once you have defined your solution
you can then map
it into the implementation...
in your code.
Over the years technologies have helped
software engineer to raise the level abstraction closer to the problem domain
by providing
better programming languages, such as Fortran or C
for instance.
And then these languages have automation mechanisms that provide and
translate the specifications
in those languages
too lower abstract
machine code.
This has made software development much more productive and less complex than before.
Newer programming languages, such as
Java or C#
have changed his picture very little.
To raise the level of abstraction further, to tackle the complexity and
growing size of software
modeling languages such as UML or SySML were introduced.
UML for instance
provides software engineers a way to make a visual plan of the code
before writing that code.
The problem with this approach is that it forces the developer to solve
the same problem
several times.
First in the problem domain
concepts,
then in UML models
and finally
in code.
UML, unfortunately,
does not raise the abstraction level further,
does not assist software engineer in making correct design because it's
general purpose:
Allows only
very little code
to be generated from it.
As a result
engineers trying to apply UML
typically throw those models away once they start coding.
With domain-specific modeling
we can continue to raise the level of abstraction
closer to the problem domain.
We do this
not by trying to visualize the code
but by providing a highly tailored modeling languages that visualize the problem
domain
and therefore guide the modelers
into making correct designs.
Modelers design here
application visually
with the concepts that mimic closely real real objects and then also enable
generating the lower level code
from these designs.
Let's look next a practical example.
While each domain is different and have specific language I'll use here a
domain we already know and are familiar with: Time.
We have here a domain-specific languages for
digital wristwatches.
This company makes different kind of watcj products for different market
segments
but all applications
somehow deal with time
and provide different kind of
features like timer, worldtime, stopwatch, laptime, and so forth.
The actual watches that we implement here
we can target different
executing languages like C
Java, lets say for
Android
or C# for Windows or Windows Phones.
Let's
inspect next these in a modeling tool.
I apply here MetaEdit+.
MetaEdit+ is a modeling tool
and also
a language development tool.
What we have here is two different kind of languages.
I have here a language
for describing watch family.
We have here five different kind of
watches: Ace,
Delecia, Sporty
Celestron and Celestra.
If I click here
one of these models
now I can see that this language says that
the model called 'Ace'
is a watch for an adventure person
and
each watch
contains one display
and one logical
behavior.
If you look these..
display definitions in more detail
we can see that each display contains a set of icons,
unit zones, like minutes, seconds, hours
and a set of buttons.
This language allows me to add
new icons and buttons but restricts now
the
design space
into this domain.
So what this describes now is
a structure
off the
display.
Watch must also do something and there is behavior.
What I have here is a description of the behavior side and some of these can be
reused
for multiple watches.
So let's see the behavior.
If I go and put
a battery to my watch it goes to time, from time to alarm, alarm to
stopwatch
and I can also go and see
what looks the individual
watch applications
like here
the stopwatch.
And we could now add here
more features.
But here the language is a bit different than the watch family language.
Now the modeling concepts that I have here and are visible in the toolbar,
like actions,
alarms,
buttons, displays, icons
and so forth. So I now design my application using these
high-level
concepts.
We could for example add here
laptime feature
so by pressing certain button when
we are running the time
we could freeze the display to show the current elapsed time.
And then pressing maybe the
button again we would go back to see the current stopwatch time.
So let's add
here
a new state called
laptime.
Then I can connect my laptime state by saying that
once our time is running
then we can go to a laptime.
Then, of course, I need to say somehow that
what triggers the transition
and now when I am using the domain concepts
I could reuse some of these buttons and say that if I press the
'down' button
then I can
trigger
this transition.
This language also allows knows rules of this domain.
If I want to do some
silly things, like connect this button to this icon, it
doesn't allow me to do that.
It only allows me to do correct kind of designs
like these.
I can also have other kind of designs - if I for example
add here functionality like actions
which are not related to any of my designs
I can run a number of checkers
or annotate my models
to see that
there are some things that I need
to correct
before I continue.
To finalize this application,
let's add here an action and this language has the support for
aritmetic so I can
calculate also the time.
I could say that let's calculate the laptime by taking
'systemtime'
minus 'starttime' and put the result to
'stoptime'.
So now we are done.
As you saw, all the modeling concepts I'm using here
are
high-level
language concepts. They are no programming
concepts here.
So let's next look if our laptime is working.
I can choose here
different generation targets ... into which we would like to generate the
code
and in this case we could generate the code
into Java
and also animate our models
while we are using it.
So here is all the generated code
and now we have different kind of watch applications
here visible.
Let's go to this 'Ace' model
and let's go there to the
laptime
feature.
So now we are in this state called 'stopped'.
If I press up button
it triggers the transition
put's the icon on
calculates the time to be shown in this display
and we are now in the 'running' state.
But if I now press the 'down' button
we are in the newly created laptime
and we see the current laptime here.
Nothing should happen with the other buttons unless we press
'down' button again.
As you noticed
none of the concepts in this language
deal with implementation, low-level detailed coding concepts.
The language raises our abstraction level and
allowed us to build the applications
very fast.
So what is Domain-Specific Modeling?
With this example you saw that domain- specific language aims to capture domain
knowledge - not to visualize the code. Visualizing the code helps very little.
The language itself uses domain abstractions and domain concepts
as modeling constructs.
So the engineers don't need to learn any new languages.
They can use the concepts they already know in their domain.
The language also narrows down the design space.
It also means that the developers
can design the products using
domain terms so they
can work with the already existing concepts,
only solve the right kind of problems
and only solve the problems once -
in the model.
No need
to update models and code or
make a changes into multiple files because the files are now generated.
No round-tripping needed.
Thank you for your time.
If you want to play with this example language you can download it
at metacase.com/download.
For more examples on domain-specific please have a look at our
DSM examples webcast as
seeing an example to is closer to your problem domain will likely help
you in assisting applicability of Domain-Specific Modeling
in your organization.
Thank you for watching!