c.dedek | Orientation In Objects GmbH
p.g.taboada | pgt technology scouting GmbH
Modularisierung – vom
Toolalptraum ins
Architekturchaos in 60
Minuten
Dienstag, 7. Dezember 2010Modularisierung...
Mit Java 7 und Jigsaw
werden wir alle schon über die
Plattform mit einem Modularisierungskonzept und
passendem Build-Management versorgt.
Bisher etablierte Konzepte und Vorgehensweisen zur
Modularisierung wie
OSGi und JEE werden hierdurch
auf den Prüfstand gestellt
.
"Ist doch viel zu monolitisch", "wird doch nicht testbar"... –
Wo aber bleibt die Architektur bei all der Technologie in
der Debatte?
Wir geben Hinweise, wie man sich anständig durch das
Chaos schlägt.
Session
Topics
Modularization?
Java & Modularization
A word on tooling
Dienstag, 7. Dezember 2010architecture?
Spring
JSF
JPA 2.0
5
Wikipedia
As documentation produced by architects, typically
drawings, plans and technical specifications,
architecture defines the
structure
and/or
behavior
of a building or any other kind of system
that is to be or has been constructed.
Dienstag, 7. Dezember 2010
!
7
XML as meta language
XML is
extensible
XML is
creativity
XML is
fun
Dienstag, 7. Dezember 2010XML as meta language
• Mit XML darf man
kreativ
sein
XML is
extensible
XML is
creativity
XML is
fun
8
XML used in XMI
Dienstag, 7. Dezember 2010
XML used in XMI
<xmi:XMI xmi:version="2.1" timestamp="Sat May 27 19:48:23 CEST 2006" xmlns:uml="http://schema.omg.org/spec/UML/2.0" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1">
<xmi:Documentation xmi:Exporter="MagicDraw UML" xmi:ExporterVersion="11.0"/>
<uml:Model xmi:id="eee_1045467100313_135436_1" name="Data" visibility="public">
<xmi:Extension xmi:Extender="MagicDraw UML 11.0" xmi:ExtenderID="MagicDraw UML 11.0">
<moduleExtension ignoredInModule="true"/>
</xmi:Extension>
<ownedComment xmi:type="uml:Comment" xmi:id="_11_0_1_8b70279_1148722106536_123286_1" body="Author:papick. Created:27.05.06 11:28. Title:. Comment:. " annotatedElement="eee_1045467100313_135436_1"/>
<ownedMember xmi:type="uml:Package" xmi:id="_11_0_1_8b70279_1148722111694_682770_2" name="com.clickandbuy" visibility="public"/>
<ownedMember xmi:type="uml:Component" xmi:id="_11_0_1_8b70279_1148722161245_471481_7" name="subsystem-core" visibility="public">
<realization xmi:type="uml:Realization" xmi:id="_11_0_1_8b70279_1148722190807_781764_30" visibility="public" realizingClassifier="_11_0_1_8b70279_1148722190807_12161_28" supplier="_11_0_1_8b70279_1148722190807_12161_28" client="_11_0_1_8b70279_1148722161245_471481_7"/>
<realization xmi:type="uml:Realization" xmi:id="_11_0_1_8b70279_1148722395292_63694_157" visibility="public" realizingClassifier="_11_0_1_8b70279_1148722358809_513951_140" supplier="_11_0_1_8b70279_1148722358809_513951_140" client="_11_0_1_8b70279_1148722161245_471481_7"/>
<realization xmi:type="uml:Realization" xmi:id="_11_0_1_8b70279_1148733508912_898457_546" visibility="public" realizingClassifier="_11_0_1_8b70279_1148733508912_180621_544" supplier="_11_0_1_8b70279_1148733508912_180621_544" client="_11_0_1_8b70279_1148722161245_471481_7"/>
<realization xmi:type="uml:Realization" xmi:id="_11_0_1_8b70279_1148733540788_592306_586" visibility="public" realizingClassifier="_11_0_1_8b70279_1148733540788_228842_584" supplier="_11_0_1_8b70279_1148733540788_228842_584" client="_11_0_1_8b70279_1148722161245_471481_7"/>
<nestedClassifier xmi:type="uml:Interface" xmi:id="_11_0_1_8b70279_1148722190807_12161_28" name="PublishedService" visibility="public"/>
<nestedClassifier xmi:type="uml:Class" xmi:id="_11_0_1_8b70279_1148733508912_180621_544" visibility="public"/>
<nestedClassifier xmi:type="uml:Class" xmi:id="_11_0_1_8b70279_1148733540788_228842_584" name="DOM" visibility="public"/>
<interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_11_0_1_8b70279_1148722217446_942875_60" visibility="public"
contract="_11_0_1_8b70279_1148722190807_12161_28" supplier="_11_0_1_8b70279_1148722190807_12161_28" client="_11_0_1_8b70279_1148722161245_471481_7"/>
</ownedMember>
<ownedMember xmi:type="uml:Component" xmi:id="_11_0_1_8b70279_1148722264834_475474_73" name="subsystem-impl" visibility="public">
<interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_11_0_1_8b70279_1148733557612_907435_606" visibility="public"
contract="_11_0_1_8b70279_1148722190807_12161_28" supplier="_11_0_1_8b70279_1148722190807_12161_28" client="_11_0_1_8b70279_1148722264834_475474_73"/>
</ownedMember>
<ownedMember xmi:type="uml:Component" xmi:id="_11_0_1_8b70279_1148722312903_528399_94" visibility="public"/>
<ownedMember xmi:type="uml:Dependency" xmi:id="_11_0_1_8b70279_1148722312923_409077_96" visibility="public" supplier="_11_0_1_8b70279_1148722312903_528399_94" client="_11_0_1_8b70279_1148722264834_475474_73"/>
<ownedMember xmi:type="uml:Artifact" xmi:id="_11_0_1_8b70279_1148722358809_513951_140" visibility="public"/>
<ownedMember xmi:type="uml:Component" xmi:id="_11_0_1_8b70279_1148732049524_447560_277" name="subsystem-serviceExporter" visibility="public">
<realization xmi:type="uml:Realization" xmi:id="_11_0_1_8b70279_1148736855494_61906_1426" visibility="public" realizingClassifier="_11_0_1_8b70279_1148736855494_900019_1424" supplier="_11_0_1_8b70279_1148736855494_900019_1424" client="_11_0_1_8b70279_1148732049524_447560_277"/>
<realization xmi:type="uml:Realization" xmi:id="_11_0_1_8b70279_1148736866450_127377_1447" visibility="public" realizingClassifier="_11_0_1_8b70279_1148736866440_37201_1445" supplier="_11_0_1_8b70279_1148736866440_37201_1445" client="_11_0_1_8b70279_1148732049524_447560_277"/>
<nestedClassifier xmi:type="uml:Class" xmi:id="_11_0_1_8b70279_1148736855494_900019_1424" name="DTO" visibility="public"/>
<nestedClassifier xmi:type="uml:Interface" xmi:id="_11_0_1_8b70279_1148736866440_37201_1445" name="PublishedRemoteDTOService" visibility="public"/>
<interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_11_0_1_8b70279_1148732140745_117398_312" visibility="public"
9
XML as XMI
XML is not
extensible
creativity???
XML is
no fun
Dienstag, 7. Dezember 2010XML as XMI
• Mit XML darf man
kreativ
sein
XML is not
extensible
creativity???
XML is
10
XML used in XMI
Dienstag, 7. Dezember 2010
XML used in XMI
<xmi:XMI xmi:version="2.1" timestamp="Sat May 27 19:48:23 CEST 2006" xmlns:uml="http://schema.omg.org/spec/UML/2.0" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1">
<xmi:Documentation xmi:Exporter="MagicDraw UML" xmi:ExporterVersion="11.0"/>
<uml:Model xmi:id="eee_1045467100313_135436_1" name="Data" visibility="public">
<xmi:Extension xmi:Extender="MagicDraw UML 11.0" xmi:ExtenderID="MagicDraw UML 11.0">
<moduleExtension ignoredInModule="true"/>
</xmi:Extension>
<ownedComment xmi:type="uml:Comment" xmi:id="_11_0_1_8b70279_1148722106536_123286_1" body="Author:papick. Created:27.05.06 11:28. Title:. Comment:. " annotatedElement="eee_1045467100313_135436_1"/>
<ownedMember xmi:type="uml:Package" xmi:id="_11_0_1_8b70279_1148722111694_682770_2" name="com.clickandbuy" visibility="public"/>
<ownedMember xmi:type="uml:Component" xmi:id="_11_0_1_8b70279_1148722161245_471481_7" name="subsystem-core" visibility="public">
<realization xmi:type="uml:Realization" xmi:id="_11_0_1_8b70279_1148722190807_781764_30" visibility="public" realizingClassifier="_11_0_1_8b70279_1148722190807_12161_28" supplier="_11_0_1_8b70279_1148722190807_12161_28" client="_11_0_1_8b70279_1148722161245_471481_7"/>
<realization xmi:type="uml:Realization" xmi:id="_11_0_1_8b70279_1148722395292_63694_157" visibility="public" realizingClassifier="_11_0_1_8b70279_1148722358809_513951_140" supplier="_11_0_1_8b70279_1148722358809_513951_140" client="_11_0_1_8b70279_1148722161245_471481_7"/>
<realization xmi:type="uml:Realization" xmi:id="_11_0_1_8b70279_1148733508912_898457_546" visibility="public" realizingClassifier="_11_0_1_8b70279_1148733508912_180621_544" supplier="_11_0_1_8b70279_1148733508912_180621_544" client="_11_0_1_8b70279_1148722161245_471481_7"/>
<realization xmi:type="uml:Realization" xmi:id="_11_0_1_8b70279_1148733540788_592306_586" visibility="public" realizingClassifier="_11_0_1_8b70279_1148733540788_228842_584" supplier="_11_0_1_8b70279_1148733540788_228842_584" client="_11_0_1_8b70279_1148722161245_471481_7"/>
<nestedClassifier xmi:type="uml:Interface" xmi:id="_11_0_1_8b70279_1148722190807_12161_28" name="PublishedService" visibility="public"/>
<nestedClassifier xmi:type="uml:Class" xmi:id="_11_0_1_8b70279_1148733508912_180621_544" visibility="public"/>
<nestedClassifier xmi:type="uml:Class" xmi:id="_11_0_1_8b70279_1148733540788_228842_584" name="DOM" visibility="public"/>
<interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_11_0_1_8b70279_1148722217446_942875_60" visibility="public"
contract="_11_0_1_8b70279_1148722190807_12161_28" supplier="_11_0_1_8b70279_1148722190807_12161_28" client="_11_0_1_8b70279_1148722161245_471481_7"/>
</ownedMember>
<ownedMember xmi:type="uml:Component" xmi:id="_11_0_1_8b70279_1148722264834_475474_73" name="subsystem-impl" visibility="public">
<interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_11_0_1_8b70279_1148733557612_907435_606" visibility="public"
contract="_11_0_1_8b70279_1148722190807_12161_28" supplier="_11_0_1_8b70279_1148722190807_12161_28" client="_11_0_1_8b70279_1148722264834_475474_73"/>
</ownedMember>
<ownedMember xmi:type="uml:Component" xmi:id="_11_0_1_8b70279_1148722312903_528399_94" visibility="public"/>
<ownedMember xmi:type="uml:Dependency" xmi:id="_11_0_1_8b70279_1148722312923_409077_96" visibility="public" supplier="_11_0_1_8b70279_1148722312903_528399_94" client="_11_0_1_8b70279_1148722264834_475474_73"/>
<ownedMember xmi:type="uml:Artifact" xmi:id="_11_0_1_8b70279_1148722358809_513951_140" visibility="public"/>
<ownedMember xmi:type="uml:Component" xmi:id="_11_0_1_8b70279_1148732049524_447560_277" name="subsystem-serviceExporter" visibility="public">
<realization xmi:type="uml:Realization" xmi:id="_11_0_1_8b70279_1148736855494_61906_1426" visibility="public" realizingClassifier="_11_0_1_8b70279_1148736855494_900019_1424" supplier="_11_0_1_8b70279_1148736855494_900019_1424" client="_11_0_1_8b70279_1148732049524_447560_277"/>
<realization xmi:type="uml:Realization" xmi:id="_11_0_1_8b70279_1148736866450_127377_1447" visibility="public" realizingClassifier="_11_0_1_8b70279_1148736866440_37201_1445" supplier="_11_0_1_8b70279_1148736866440_37201_1445" client="_11_0_1_8b70279_1148732049524_447560_277"/>
<nestedClassifier xmi:type="uml:Class" xmi:id="_11_0_1_8b70279_1148736855494_900019_1424" name="DTO" visibility="public"/>
<nestedClassifier xmi:type="uml:Interface" xmi:id="_11_0_1_8b70279_1148736866440_37201_1445" name="PublishedRemoteDTOService" visibility="public"/>
<interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_11_0_1_8b70279_1148732140745_117398_312" visibility="public"
11
Analogy?
•
Technologies as meta-language
•
you can do everything
•
technologies are fun
•
you must be creative
•
Architecture
•
is how we finally structure
our thing and use the
technologies
•
stops being fun
Dienstag, 7. Dezember 2010
left-hand-right-hand
situation
•
Should architectures be neutral to technologies?
•
When do we find out if a given architecture fits a
given technology stack?
super-architect
Dienstag, 7. Dezember 2010modularization?
Spring
JSF
JPA 2.0
Divide & Conquer
Dienstag, 7. Dezember 2010
break it into pieces
•
components
•
layers
•
modules
bad guy
0100100101001100
110010010010010
010010010101
01010010101
010010010101
100100101010
10101010
010010010101
101
101111001011
0101010101
Dienstag, 7. Dezember 2010bad guy
0100100101001100
110010010010010
010010010101
01010010101
010010010101
100100101010
10101010
010010010101
101
101111001011
0101010101
I am amonolithical thing!
bad guy
0100100101001100
110010010010010
010010010101
01010010101
010010010101
100100101010
10101010
010010010101
101
101111001011
0101010101
I am amonolithical thing!
I am not known for
reusability, maintainability, etc..
Dienstag, 7. Dezember 2010
see the duplicate code?
0100100101001100
110010010010010
010010010101
01010010101
010010010101
100100101010
10101010
010010010101
101
101111001011
0101010101
re-use it!
0100100101001100
110010010010010
010010010101
01010010101
010010010101
100100101010
10101010
010010010101
101
101111001011
0101010101
Dienstag, 7. Dezember 2010lifecycle? state? runtime?
0100100101001100
110010010010010
XXX
01010010101
XXX
100100101010
10101010
XXX
101
101111001011
0101010101
XXX
010010010101
managed bean!
XXX
010010010101
provides interfaces
provides services
Dienstag, 7. Dezember 2010component based development
XXX
010010010101
YYY
Granularität
Dienstag, 7. Dezember 2010
break it into pieces
✓
components
•
layers
•
modules
layers
presentation layer
business logic layer
integration layer
Dienstag, 7. Dezember 2010
layers
presentation layer
business logic layer
integration layer
business
delegate
session
facade
service beans
daos
entity beans
transfer objects
manager
beans
break it into pieces
✓
components
✓
layers
•
modules
•
aspects?
Dienstag, 7. Dezember 2010modules?
business logic la
ye
r
integration
la
ye
r
business logic la
ye
r
integration
la
ye
r
business logic la
ye
r
integration
la
ye
r
Dienstag, 7. Dezember 2010allow
ed intimacy le
ve
l?
business logic la
ye
r
integration
la
ye
r
business logic la
ye
r
integration
la
ye
r
business logic la
ye
r
integration
la
ye
r
Dienstag, 7. Dezember 2010modules?
business logic la
ye
r
integration
la
ye
r
business logic la
ye
r
integration
la
ye
r
business logic la
ye
r
integration
la
ye
r
Dienstag, 7. Dezember 2010modules?
business logic la
ye
r
integration
la
ye
r
business logic la
ye
r
integration
la
ye
r
business logic la
ye
r
integration
la
ye
r
Dienstag, 7. Dezember 2010break it into pieces
✓
components
✓
layers
✓
modules
•
aspects?
Dienstag, 7. Dezember 2010minimum aop?
business logic la
ye
r
integration
la
ye
r
business logic la
ye
r
integration
la
ye
r
business logic la
ye
r
integration
la
ye
r
security
monitoring
transaction
Dienstag, 7. Dezember 2010break it into pieces
✓
components
✓
layers
✓
modules
✓
aspects?
Dienstag, 7. Dezember 2010integration?
Dienstag, 7. Dezember 2010
simple 2 client situation
RCP Client
JSF Client
BL „1“
BL „2“
BL „3“
... with versions ...
RCP Client
JSF Client
BL „1“
BL „2“
BL „3“
DAO „A“
DAO „B“
DAO „C“
DAO „D“
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
Dienstag, 7. Dezember 2010
and 3rd party libs
RCP Client
JSF Client
BL „1“
BL „2“
BL „3“
DAO „A“
DAO „B“
DAO „C“
DAO „D“
PrimeFaces
DOJO
Spring
Log4J
Hibernate
RCP
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
windows?
jboss
v.5.x
tomcat
v.6.x
and runtimes
RCP Client
JSF Client
BL „1“
BL „2“
BL „3“
DAO „A“
DAO „B“
DAO „C“
DAO „D“
PrimeFaces
DOJO
Spring
Log4J
Hibernate
RCP
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
Dienstag, 7. Dezember 2010How?
•
Release management?
•
Versioning?
•
Backwards compatibility?
•
Dependency resolution & mediation?
Session
Topics
Modularization?
Java & Modularization
A word on tooling
Dienstag, 7. Dezember 2010Java EE
WA
R
EJB-JAR
util JAR
Java EE
Servlet
WA
R
EJB-JAR
util JAR
Dienstag, 7. Dezember 2010Java EE
EAR
Servlet
WA
R
EJB-JAR
util JAR
Java EE
EAR
Servlet
WA
R
EJB-JAR
util JAR
Dienstag, 7. Dezember 2010java EE modules
ear
ejb-jar
ejb-jar
util-jar
„instance sharing“
„class sharing“
packaging, class loaders, ....
modules?
business logic la
ye
r
integration
la
ye
r
business logic la
ye
r
integration
la
ye
r
business logic la
ye
r
integration
la
ye
r
Dienstag, 7. Dezember 2010allow
ed intimacy le
ve
l?
business logic la
ye
r
integration
la
ye
r
business logic la
ye
r
integration
la
ye
r
business logic la
ye
r
integration
la
ye
r
Dienstag, 7. Dezember 2010we can...
•
package modules
•
do class sharing
•
do instance sharing
•
no versions
•
no visibility constraints
•
no module lifecycle
Dienstag, 7. Dezember 2010DI container/ Spring
BL „1“
DAO „A“
interface
impl
mock
template
dependencies
runtime
testtime
compiletime
hibernate api
runtime dependency
scopes
•
compile time dependencies handled by compiler,
IDE, classpath
•
runtime dependency declared/ managed in
context
Dienstag, 7. Dezember 2010
Maven (ivy too...)
artefact „1“
artefact „2“
artefact „3“
v1.2
v1.0
POM
dependency mediation for
poor EE people
•
because we have versions
•
solve version problems at compile time
•
no fancy-OSGi features at runtime
Dienstag, 7. Dezember 2010
and 3rd party libs
RCP Client
JSF Client
BL „1“
BL „2“
BL „3“
DAO „A“
DAO „B“
DAO „C“
DAO „D“
PrimeFaces
DOJO
Spring
Log4J
Hibernate
RCP
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
transitive dependencies
JSF Client
BL „3“
DAO „D“
PrimeFaces
DOJO
Spring
Log4J
Hibernate
RCP
Frontend Libs
Backend Libs
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
v.1.0
Dienstag, 7. Dezember 2010OSGi
Bundle
INSTALLED RESOLVED UNINSTALLED install update refresh update refresh resolve uninstall uninstall RESOLVED STARTING ACTIVE STOPPING start stop stop Dienstag, 7. Dezember 2010OSGi
Bundle
INSTALLED RESOLVED UNINSTALLED install update refresh update refresh resolve uninstall uninstall RESOLVED STARTING ACTIVE STOPPING start stop stopOSGi
Bundle
INSTALLED RESOLVED UNINSTALLED install update refresh update refresh resolve uninstall uninstall RESOLVED STARTING ACTIVE STOPPING start stop stop Dienstag, 7. Dezember 2010OSGi bundles
OSGi Runtime
Bundle
Bundle
Bundle
„instance sharing“
„class sharing“
packaging, class loaders, ....
v1.0
v1.1
visible
visible
visible
INSTALLED RESOLVED UNINSTALLED install update refresh update refresh resolve uninstall uninstall RESOLVED STARTING ACTIVE STOPPING start stop stop INSTALLED RESOLVED UNINSTALLED install update refresh update refresh resolve uninstall uninstall RESOLVED STARTING ACTIVE STOPPING start stop stop INSTALLED RESOLVED UNINSTALLED install update refresh update refresh resolve uninstall uninstall RESOLVED STARTING ACTIVE STOPPING start stop stopwe can...
•
do class sharing
•
do instance sharing
•
do runtime loading/ unloading
•
do multi-version-loading
•
define visibility constraints
•
hard to do cross-module-container-ee-services
Dienstag, 7. Dezember 2010
Java EE APIs
don‘t fit into OSGi
e.g. ....
monolothical configs
classloading nightmares
Java 7, 8, ...
super packages?
modules?
simplified module system?
dynamic modules?
==> Java EE ?!?
Dienstag, 7. Dezember 2010
Blog: Superpackage strawman and
All this works fine
as long as a project fits into
a single package
. Once the project grows
beyond that, you may find yourself forced to
make
implementation classes public
in order
to access them from multiple packages in the
project.
That
loses the benefits of information hiding
,
which is clearly
suboptimal
and a long-standing
complaint that often comes up in language
discussions in forums such as JavaOne.
Blog: Superpackage strawman and
the JSR 294 mailing list
All this works fine
as long as a project fits into
a single package
.
Once the project grows
beyond that, you may find yourself
forced to
make
implementation classes public
in order
to access them from multiple packages in the
project.
That
loses the benefits of information hiding
,
which is
clearly
suboptimal
and a long-standing
complaint that often comes up in language
discussions in forums such as JavaOne.
Dienstag, 7. Dezember 2010
Strawman Proposal for JSR 294
Superpackages
However, if a project is too large to fit into a
single package, Java does not provide a
Session
Topics
Modularization?
Java & Modularization
A word on tooling
Dienstag, 7. Dezember 2010
develop modular
software
•
APIs
•
IDEs
•
Test-Frameworks
Dienstag, 7. Dezember 2010build modular software
•
integration server
•
automated builds
•
distributed builds?
•
provisioning?
run modular software
•
runtime for modules
•
module/ app deployment
•
intelligent clustering?
Dienstag, 7. Dezember 2010
each tool is great
•
and does (mostly) not work with the others
Was tun?
Dienstag, 7. Dezember 2010Problem
Technologien
können
einem
das noch so
schönes
und ausgeklügeltes
Architekturvorhaben
ordentlich
versaubeuteln
Zauberhafte Technologien
•
Sind nicht mehr so zauberhaft wenn man
versucht modular zu entwickeln.
•
Viele Komponentenmodelle, keine
Lösungsansätze für Modularisierung
•
Zaubertrank wird schnell zum Gift
Dienstag, 7. Dezember 2010