SlideShare a Scribd company logo
1 of 68
Download to read offline
1
Modular Architecture Today




     Kirk Knoernschild
         @pragkirk



                             2
Java Application Architecture
                               Modularity Patterns with Examples Using OSGi


Forewords by Robert C. Martin and Peter Kriens
     I’m dancing! By god I’m dancing on the walls. I’m dancing on the ceiling. I’m
     ecstatic. I’m overjoyed. I’m really, really pleased.”
         - From the Foreword by Robert C. Martin (a.k.a. Uncle Bob)

Java Application Architecture will help you

  ‣Design modular software that is extensible, reusable, maintainable, and adaptable
  ‣Design modular software today, in anticipation of platform support for modularity
  ‣Break large software systems into a flexible composite of collaborating modules
  ‣Understand where to place your architectural focus
  ‣Migrate large-scale monolithic applications to applications with a modular architecture
  ‣Articulate the advantages of modular software to your team

                              Visit http://modularity.kirkk.com for more information.
                                                                                             3
The Code

https://github.com/pragkirk/poma/network



       or just Google   pragkirk github




                                           4
Goals Today

    2 Simple Goals Today
  1.) Start designing modular software tomorrow!


   2.) Don’t flip the bit on OSGi as too complex!




                                                   5
Modular Architecture Today

      Introducing Modularity
     The Modularity Patterns
     Refactor to Modularity
         Introducing OSGi
         OSGi-ify the App
                               6
Agile Architecture

            Introducing Modularity
                                                                 What
                                                                        ch
      What                           Why i
                                             s mo d             us to d allenges fac
             are th                                 ula                ay in           e
                   e ben            neces                                    design
      mo dul
            arity?       efits o             sar y c rity a      mo dul
                                                                      ar sof        ing
                                f   ag ile         o mpon                   tware
                                           archit         en                      ?
                                                  ecture t of
                                                        ?




                                                                                           7
Modularity - Not New!




                                1972        (or a bit before)




On The Criteria To Be Used in Decomposing Systems into Modules
  by David Parnas at http://www.cs.umd.edu/class/spring2003/cmsc838p/Design/criteria.pdf


                                                                                           8
Defining Module
                   Hey, it’s a JAR file!

                                              - unit
                                                      of reu
                                             - unit          se
                                                     of co m
                                            - unit           po
                                                    of dep sition
                                           - unit          loyme
                                                   of ma         nt
                                                          nagem
                                                                ent




      A module system provides a runtime environment for modules




                                                                      9
The Facets
        Runtime                                      Development

       Infras                       Progr                            Desig
             tructu                      am   ming                         n   Para dThink    about when
                       re                            Mo de                           igm
                                                              l
       Runtim                      The fr                            The te            you started using
              e plat                     amew                                 chniqu
      suppo           for m       techn          o r ks a
                                                         nd         to i de          esobjects! Using the
                                                                                        use d
            rt hel                      olog ie                             ntify
     enforc        ps            allow          s that             create         an d language constructs
            e mo d                      us to                                the ri
    archit          ular         mo dul        create             o f mo           ghtwere easy, but
          ecture                       ar sof                             dules         set
                  .                           tware
                                                                                       creating designs
                                                                                       was still really hard.

                               The Design Paradigm
                       - What’s the right granularity for a module?
                          - What the right weight for a module?
                                                                                                   demo
                                                                                                           10
Paradox

                                                                                   Increa
                                                                                          sing e
                                                                                  decre         volvab
                                                                                        ases s           ility
                                                                                               ur viva
                                                                                                       bility
            (Reuse,
          Compose,
           Extend,
         Lightweight,
       Fine-Grained, ...)



                                  (Use, Maintain, Understand, ...)



 ... making everything easy to change makes the entire system very
                              complex...
                                    - Ralph Johnson in “Who Needs an Architect”


                                                                                                                 11
Architectural Joints or Seams
                                       Here?



     Which                                             Here?
   system area of the
          deman
                   ds mo
        flexib            re
              ility?
                               Here?                    Here?




                              Here?                      Here?

                                               Here?

                                                                 12
Complexity and Knowledge




    Source: http://www.tensegrity.hellblazer.com/   Source: http://adaptevolve.blogspot.com/



                                                                                               13
Complexity, Knowledge, & Modularity




                                      14
demo
Architectural Joints or Seams
                                         Here?



       Which                                             Here?
     system area of the
            deman
                     ds mo
          flexib            re
                ility?
                                 Here?                    Here?




 Modularizing software          Here?                      Here?
 affects our design in
 interesting ways.
                                                 Here?

                                                                      15
Benefits of Modularity

    - reus
           e                    Increases architectural agility!
   - re du
           ce co m
  - ease          ple
           mainte xity
 - incr           nance
        ease
exten
       sibility




Umm...we can already do this with objects, aspects, methods, and services!


                                                                             16
All the Way Down



          ?

                        Reuse Release Equivalence:
                   Unit of reuse is the unit of release!


                                                           17
Agile Architecture

       The Modularity Patterns

                What
                       are th
                mo dul        e
                      arity
                            patter
                                   ns?




                                         18
Base Patterns
 • Manage Relationships – Design Module Relationships.
 • Module Reuse – Emphasize reusability at the module level.
 • Cohesive Modules – Module behavior should serve a singular
   purpose.




                                                                19
Dependency Patterns
 • Acyclic Relationships - Module relationships must be acyclic.
 • Levelize Modules – Module relationships should be levelized.
 • Physical Layers - Module relationships should not violate the
     conceptual layers.
 •   Container Independence - Modules should be independent of
     the runtime container.
 •   Independent Deployment - Modules should be independently
     deployable units.


                                                                   20
Usability Patterns
 • Published Interface - Make a module’s published interface well
     known.
 •   External Configuration – Modules should be externally
     configurable.
 •   Default Implementation - Provide modules with a default
     implementation.
 •   Module Facade – Create a facade serving as a coarse-grained
     entry point to another fine-grained module’s underlying
     implementation.

                                                                    21
Extensibility Patterns
 • Abstract Modules - Depend upon the abstract elements of a
     module.
 •   Implementation Factory - Use factories to create a module’s
     implementation classes.
 •   Separate Abstractions - Place abstractions and the classes that
     implement them in separate modules.




                                                                       22
Utility Patterns
 • Colocate Exceptions: Exceptions should be close to the class or
     interface that throws them.
 •   Levelize Build – Execute the build in accordance with module
     levelization.
 •   Test Module – Each module should have a corresponding test
     module.




                                                                     23
Agile Architecture


          Patterns Applied
           Ho w c                     Ho w d                   This is the Design
                  an I u                    o they
           mo dul
                 arity
                         se the      acco m          h
                                            mo dat elp         Paradigm
                       patter       archit        e
                              ns?          ectura
                                                  l shift
                                                          s?




                                                                                    24
The System

     Design a system to handle payment and auditing of
     various types of bills. The system must integrate with
     3rd party auditing software, and a legacy financials
     system that must be fed payment information for
     reconciliation.




                                                              25
The Class Model

 Note t
          he bi-
 a sso ci        direct
         ations         ional
               !




                                26
demo
Initial Systems Modules

                              If I la
                                      ye
                              but no r conceptua
                                     t phys         lly
                             then a         ically,
                                    m
                            the a d I realizing
                                   vantag
                           layeri          e
                                  ng? W s of
                          layer ?        hy do
                                                I




                                                             27
Physical Layers
       Module relationships should not violate the conceptual layers.




                                                                        28
Abstract Modules
                   Depend upon the abstract elements of a module.
                                                                package client;
                                                                import service.*;
                                                                public class Client {
                                                                  Service service;
                                                                }


                                                                package service;

                                                                public interface Service {
                                                                  public void doService();
                                                                }
        - “Inje
                 ct
       implem ” the                                             package service;
                entati
      Client.         on int
                             o                                  public class ServiceImpl implements
     - “ Lo o
              ku p                                              Service {
    implem ” the
              entati                                              public void doService() {
    Client.         on w it
                            hin                                      ....
                                                                  };
                                                                }

                                                                                                      29
Abstract Modules

        What
              if
       to use Bill must be
              differ
      system        ent au able
             s?           diting




                                   30
Abstract Modules




                    Au ditF
                            aca de
                   into B          1 is in
                          ill as           jecte d
                   Au ditF       an
                          aca de
                                  type.




                                                     31
Abstract Modules




                   32
Acyclic Relationships
        Module relationships must be acyclic




                                               33
Recall - Abstract Modules




                                    Au ditF
                                            aca de
                                   into B          1 is in
                                          ill as           jecte d
                                   Au ditF       an
                                          aca de
                                                  type.




               Same problem here

                                                                     34
Recall - Abstract Modules




                            35
Uni-Directional




                  36
demo
Acyclic Relationships




                           37
Separate Abtractions
       Separate abstractions from the classes that realize them.

      How d
              o I in
      with a         tegra
                           te
             nothe
     auditi        r
            ng sy
                 stem?
    Wher
           e doe
                 s
    Audit
          Facad
                e2 liv
                       e?




                                                                   38
Separate Abstractions

      Shoul
             d I p
                  ut
      Audit
            Facad
                  e2 i n
     audit.
           jar?




                           39
Separate Abstractions




                        40
Colocate Exceptions
                     Exceptions should be close to the classes that throw them


     Audit
              Facad
                    e thro
     the A                ws
             uditEx
                    ceptio
                           n.




                                                                   Exception goes here.

                                                                                          41
Independent Deployment
   Modules should be independently deployable units.


              How d
                      o I re
             bill.ja          use
                     r wi t h
            financ           out
                    ial.ja
                           r? Lik
           a bat                  e in
                  ch ap
                         plicat
                                ion?




                                                       42
Independent Deployment




                         43
Independent Deployment
                    1.) PayAction invokes Bill.pay()
                    and passes BillPayAdapter
                    as a BillPayer.
                    2.) Bill.pay() invokes
                    BillPayer.generateDraft()
                    3.)BillPayAdapeter.generateDraft()
                    invokes Payment.generateDraft()
                    passing itself as a Payable.
                    4.) Payment.generateDraft()
                    invokes Payable.getAmount()




                                                         44
Independent Deployment




                         45
Implementation Factory
       Use factories to create a modules implementation classes.




                                                                   46
demo
The Final Structure




                         47
Opportunities




                48
Modular Architecture Today

                       Introducing OSGi?

                                                                This is the
                        Is OS
    What
           is OSG
                             Gi   new?   Who i
                                              s usin            Infrastructure &
                  i?                                 g OSG
                                                           i?   Programming
                                                                Model




                                                                              49
Modularity is coming to the Java platform!




OpenJDK




                                              50
A Bit of History
 • JSR 8 - Open Services Gateway specification in 1999 (JSR 232
     or JSR 291)
  •   Gateway for providing services to home devices
  •   lifecycle management, dependencies, installing, versioning, configuration
 • OSGi Alliance formed in 1999 and delivered V1.0 in 2000
 • Very popular on the desktop; driven by Eclipse 3.0 adoption in
     2003
 •   Today, just about all Java middleware products use OSGi
  •   WAS, WebLogic, GlassFish, Paremus Service Fabric, JBoss, Geronimo, ...

                                                                                 51
Introducing OSGi
   Dynamic Module System for Java
 ClassLoaders
 - Each bundle has it’s own classloader and it’s own
 lifecycle

 µServices
 - Bundle exposes it’s
 behavior via well-defined
 interface
                                                       MODULE
 Bundles
 - Bundle is a JAR file with
 manifest


                                                                52
A Valid Bundle
              myjar.jar                                   Manifest.mf
                                     Manifest-Version: 1.0
                                     Bundle-ManifestVersion: 2
                                     Bundle-Name: Scala Calculator

                     JAR
                           +         Bundle-SymbolicName: scala calculator
                                     Bundle-Version: 1.0.0
                                     Import-Package:
                                     com.extensiblejava.loan,scala.annotation.unchecked;us
                                     es:="scala.reflect,scala"
                                      ;version="2.8.0.final"

<osgi:service id="LoanCalculator" ref="loanCalculator"
interface="com.extensiblejava.loan.LoanCalculator"/>   Register µServices
<osgi:reference id="paymentFactory"                    µService Reference
interface="com.extensiblejava.loan.PaymentFactory"/>

                                                                                         53
The Basic Workings
                        Private packages      Classloader restricts
                       are implementation            visibility


          Imported                           Exported
          packages                           packages



                                                    Publishes the
                           JAR is a module       interface, ideally as
      Classloader gives                               µServices
     each module its own
                                 DYNAMICITY
          lifecycle

                                                                         54
Modules as First Class Citizens

       INSTALLED            STARTING


                    start              Because bundles have their
                                       own classloader, they can be
                                         managed independently.
       RESOLVED              ACTIVE      Hence, a very dynamic
                                              environment.

                                stop


      UNINSTALLED           STOPPING



                                                                      55
demo
The Runtime

                 - Dyn
                       ami
                - Mult c deployme
                       ipl             nt
               - Enfo e versions
                      rce de
              - Enca         pen de
                     psulat         ncies
                            ion




                                               56
demo
Too Complex?

“OSGi provides little value and is too complex as demonstrated by our failed attempt to make
modularity invisible when porting our legacy system to it with over 150 third-party JARs.
-- http://blogs.mulesoft.org/osgi-no-thanks



“OSGi is a great solution for complex applications with stringent modularity requirements.”
-- http://www.theserverside.com/news/thread.tss?thread_id=62590




                                                                                                  57
A Modular System TODAY!




                          58
Standard Java Lack Encapsulation




                            Everything is still
                          visible; no dynamics!




                                              59
No Encapsulation




                   60
Type Visibility


              Any public class in any JAR on the classpath can be seen by any
                                other class on the classpath!




                      With OSGi, you have control who sees what!




                                        Cookie Jar images courtesy of Richard Hall


                                                                                     61
Not Visible




              62
demo
Encapsulation




                Nothing can reach this
                        class!

                                         63
Modularity Today
   Platforms discourage modularity!    Why a
                                              re
                                      design n’t we
                                             in
                                      mo dul g more
                                            ar sof
                                                  tware
                                                        ?




                                                            64
demo
Modularity Tomorrow
  This is the next generation application platform!
                                                        - Dyn
                                                              ami
                                                       - Mult c deployme
                                                              ipl             nt
                                                      - Expl e versions
                                                            icit de
                                                                    pen de
                                                                           ncies




                                                                                      65
Modular Architecture Today

                            OSGi-ify the App

      Ho w d
             o I bu              Is it i                         Is it r
      applic        ild                 nvasiv                          eally
            ations                            e to m                            to o co
                   using                             y co de                            mplex
                         OSGi?                               ?                               ?




                                                                                                 66
Java Application Architecture
                               Modularity Patterns with Examples Using OSGi


Forewords by Robert C. Martin and Peter Kriens
     I’m dancing! By god I’m dancing on the walls. I’m dancing on the ceiling. I’m
     ecstatic. I’m overjoyed. I’m really, really pleased.”
         - From the Foreword by Robert C. Martin (a.k.a. Uncle Bob)

Java Application Architecture will help you

  ‣Design modular software that is extensible, reusable, maintainable, and adaptable
  ‣Design modular software today, in anticipation of platform support for modularity
  ‣Break large software systems into a flexible composite of collaborating modules
  ‣Understand where to place your architectural focus
  ‣Migrate large-scale monolithic applications to applications with a modular architecture
  ‣Articulate the advantages of modular software to your team

                              Visit http://modularity.kirkk.com for more information.
                                                                                             67
Q&A

      68

More Related Content

What's hot

What's hot (20)

Frank o gehry
Frank o gehryFrank o gehry
Frank o gehry
 
Rationalism Architecture
Rationalism ArchitectureRationalism Architecture
Rationalism Architecture
 
Philip johnson
Philip johnson Philip johnson
Philip johnson
 
PETER EISENMAN
PETER EISENMANPETER EISENMAN
PETER EISENMAN
 
Post Modern Architecture
Post Modern ArchitecturePost Modern Architecture
Post Modern Architecture
 
Deconstructivism
Deconstructivism Deconstructivism
Deconstructivism
 
Emergence of modern architecture ppt
Emergence of modern architecture  pptEmergence of modern architecture  ppt
Emergence of modern architecture ppt
 
Louis i khan ppt
Louis i khan  pptLouis i khan  ppt
Louis i khan ppt
 
LESS IS MORE(MIES VAN DER ROHE)
LESS IS MORE(MIES VAN DER ROHE)LESS IS MORE(MIES VAN DER ROHE)
LESS IS MORE(MIES VAN DER ROHE)
 
Deconstructivism
DeconstructivismDeconstructivism
Deconstructivism
 
Chicago school (new)
Chicago school (new)Chicago school (new)
Chicago school (new)
 
Rem koolhaas
Rem koolhaasRem koolhaas
Rem koolhaas
 
Lecture 9 postmodernism
Lecture 9   postmodernismLecture 9   postmodernism
Lecture 9 postmodernism
 
Postmodernism3
Postmodernism3Postmodernism3
Postmodernism3
 
Neo-Modern Architecture
Neo-Modern ArchitectureNeo-Modern Architecture
Neo-Modern Architecture
 
Tadao ando-powerpoint-presentation
Tadao ando-powerpoint-presentationTadao ando-powerpoint-presentation
Tadao ando-powerpoint-presentation
 
Critical Regionalism
Critical RegionalismCritical Regionalism
Critical Regionalism
 
Post modern architecture
Post modern architecturePost modern architecture
Post modern architecture
 
Guggenheim museum in NYC
Guggenheim museum in NYCGuggenheim museum in NYC
Guggenheim museum in NYC
 
B.V. DOSHI
B.V. DOSHIB.V. DOSHI
B.V. DOSHI
 

Viewers also liked

Modular Architectures: What they are why do they matter now.
Modular Architectures: What they are why do they matter now.Modular Architectures: What they are why do they matter now.
Modular Architectures: What they are why do they matter now.Param Rengaiah
 
ZF2 Modular Architecture - Taking advantage of it
ZF2 Modular Architecture - Taking advantage of itZF2 Modular Architecture - Taking advantage of it
ZF2 Modular Architecture - Taking advantage of itSteve Maraspin
 
#6a modular construction (1)
#6a    modular construction (1)#6a    modular construction (1)
#6a modular construction (1)Eveana Crystle
 
10 key words for architecture
10 key words for architecture10 key words for architecture
10 key words for architectureceiprosachacel
 
COMMERCIAL MODULAR ARCHITECTURE
COMMERCIAL MODULAR ARCHITECTURECOMMERCIAL MODULAR ARCHITECTURE
COMMERCIAL MODULAR ARCHITECTUREUsman Waziri
 
Software design principles
Software design principlesSoftware design principles
Software design principlesRitesh Singh
 
modelingtools
modelingtoolsmodelingtools
modelingtoolslearnt
 
Tips and Tricks for Automating Windows with Chef
Tips and Tricks for Automating Windows with ChefTips and Tricks for Automating Windows with Chef
Tips and Tricks for Automating Windows with ChefChef Software, Inc.
 
Software Architecture Taxonomies - modularity
Software Architecture Taxonomies - modularitySoftware Architecture Taxonomies - modularity
Software Architecture Taxonomies - modularityJose Emilio Labra Gayo
 
MT23 Benefits of Modular Computing from Data Center to Branch Office
MT23 Benefits of Modular Computing from Data Center to Branch OfficeMT23 Benefits of Modular Computing from Data Center to Branch Office
MT23 Benefits of Modular Computing from Data Center to Branch OfficeDell EMC World
 
MT25 Server technology trends, workload impacts, and the Dell Point of View
MT25 Server technology trends, workload impacts, and the Dell Point of ViewMT25 Server technology trends, workload impacts, and the Dell Point of View
MT25 Server technology trends, workload impacts, and the Dell Point of ViewDell EMC World
 
Bojan Veljanovski - Modular Software Architecture and Design (Code Camp 2016)
Bojan Veljanovski - Modular Software Architecture and Design (Code Camp 2016)Bojan Veljanovski - Modular Software Architecture and Design (Code Camp 2016)
Bojan Veljanovski - Modular Software Architecture and Design (Code Camp 2016)Bojan Veljanovski
 
David Goulden keynote at Dell EMC World
David Goulden keynote at Dell EMC WorldDavid Goulden keynote at Dell EMC World
David Goulden keynote at Dell EMC WorldDell EMC World
 
High Rise Building Research Document
High Rise Building Research DocumentHigh Rise Building Research Document
High Rise Building Research DocumentNicholas Socrates
 
Mumbai High Rise Buildings Case studies of Kohinoor Square, Aquaria Grande, K...
Mumbai High Rise Buildings Case studies of Kohinoor Square, Aquaria Grande, K...Mumbai High Rise Buildings Case studies of Kohinoor Square, Aquaria Grande, K...
Mumbai High Rise Buildings Case studies of Kohinoor Square, Aquaria Grande, K...Prateek Srivastava
 
High-rise structural systems
High-rise structural systemsHigh-rise structural systems
High-rise structural systemsAkshay Revekar
 
Pre stressed concrete- modular construction technology
Pre stressed concrete- modular construction technologyPre stressed concrete- modular construction technology
Pre stressed concrete- modular construction technologyAnjith Augustine
 

Viewers also liked (20)

Modular Architectures: What they are why do they matter now.
Modular Architectures: What they are why do they matter now.Modular Architectures: What they are why do they matter now.
Modular Architectures: What they are why do they matter now.
 
ZF2 Modular Architecture - Taking advantage of it
ZF2 Modular Architecture - Taking advantage of itZF2 Modular Architecture - Taking advantage of it
ZF2 Modular Architecture - Taking advantage of it
 
Product Architecture
Product ArchitectureProduct Architecture
Product Architecture
 
#6a modular construction (1)
#6a    modular construction (1)#6a    modular construction (1)
#6a modular construction (1)
 
10 key words for architecture
10 key words for architecture10 key words for architecture
10 key words for architecture
 
COMMERCIAL MODULAR ARCHITECTURE
COMMERCIAL MODULAR ARCHITECTURECOMMERCIAL MODULAR ARCHITECTURE
COMMERCIAL MODULAR ARCHITECTURE
 
Software design principles
Software design principlesSoftware design principles
Software design principles
 
Modular Building Institute Report
Modular Building Institute ReportModular Building Institute Report
Modular Building Institute Report
 
modelingtools
modelingtoolsmodelingtools
modelingtools
 
Tips and Tricks for Automating Windows with Chef
Tips and Tricks for Automating Windows with ChefTips and Tricks for Automating Windows with Chef
Tips and Tricks for Automating Windows with Chef
 
Software Architecture Taxonomies - modularity
Software Architecture Taxonomies - modularitySoftware Architecture Taxonomies - modularity
Software Architecture Taxonomies - modularity
 
MT23 Benefits of Modular Computing from Data Center to Branch Office
MT23 Benefits of Modular Computing from Data Center to Branch OfficeMT23 Benefits of Modular Computing from Data Center to Branch Office
MT23 Benefits of Modular Computing from Data Center to Branch Office
 
MT25 Server technology trends, workload impacts, and the Dell Point of View
MT25 Server technology trends, workload impacts, and the Dell Point of ViewMT25 Server technology trends, workload impacts, and the Dell Point of View
MT25 Server technology trends, workload impacts, and the Dell Point of View
 
Bojan Veljanovski - Modular Software Architecture and Design (Code Camp 2016)
Bojan Veljanovski - Modular Software Architecture and Design (Code Camp 2016)Bojan Veljanovski - Modular Software Architecture and Design (Code Camp 2016)
Bojan Veljanovski - Modular Software Architecture and Design (Code Camp 2016)
 
David Goulden keynote at Dell EMC World
David Goulden keynote at Dell EMC WorldDavid Goulden keynote at Dell EMC World
David Goulden keynote at Dell EMC World
 
High rise structure & core
High rise  structure & coreHigh rise  structure & core
High rise structure & core
 
High Rise Building Research Document
High Rise Building Research DocumentHigh Rise Building Research Document
High Rise Building Research Document
 
Mumbai High Rise Buildings Case studies of Kohinoor Square, Aquaria Grande, K...
Mumbai High Rise Buildings Case studies of Kohinoor Square, Aquaria Grande, K...Mumbai High Rise Buildings Case studies of Kohinoor Square, Aquaria Grande, K...
Mumbai High Rise Buildings Case studies of Kohinoor Square, Aquaria Grande, K...
 
High-rise structural systems
High-rise structural systemsHigh-rise structural systems
High-rise structural systems
 
Pre stressed concrete- modular construction technology
Pre stressed concrete- modular construction technologyPre stressed concrete- modular construction technology
Pre stressed concrete- modular construction technology
 

Similar to Modular architecture today

OSGi in the Enterprise: Agility, Modularity, and Architecture's Paradox
OSGi in the Enterprise: Agility, Modularity, and Architecture's ParadoxOSGi in the Enterprise: Agility, Modularity, and Architecture's Paradox
OSGi in the Enterprise: Agility, Modularity, and Architecture's Paradoxpragkirk
 
Introduction to design specifications to Summer of Code NZ students
Introduction to design specifications to Summer of Code NZ studentsIntroduction to design specifications to Summer of Code NZ students
Introduction to design specifications to Summer of Code NZ studentsLulu Pachuau
 
Paremus Cloud and OSGi Beyond the VM - OSGi Cloud Workshop March 2012
Paremus Cloud and OSGi Beyond the VM - OSGi Cloud Workshop March 2012Paremus Cloud and OSGi Beyond the VM - OSGi Cloud Workshop March 2012
Paremus Cloud and OSGi Beyond the VM - OSGi Cloud Workshop March 2012mfrancis
 
colony framework & omni platform
colony framework & omni platformcolony framework & omni platform
colony framework & omni platformHive Solutions
 
Hive solutions cloudviews 2010 presentation
Hive solutions cloudviews 2010 presentationHive solutions cloudviews 2010 presentation
Hive solutions cloudviews 2010 presentationEuroCloud
 
Reverse engineering
Reverse engineeringReverse engineering
Reverse engineeringSaswat Padhi
 
Agile Engineering Environment (Agile Tour 2009 Chengdu)
Agile Engineering Environment (Agile Tour 2009 Chengdu)Agile Engineering Environment (Agile Tour 2009 Chengdu)
Agile Engineering Environment (Agile Tour 2009 Chengdu)Vernon Stinebaker
 
Building a DevOps Team that isn't Evil
Building a DevOps Team that isn't EvilBuilding a DevOps Team that isn't Evil
Building a DevOps Team that isn't EvilIBM UrbanCode Products
 
A classification framework for component models
A classification framework for component modelsA classification framework for component models
A classification framework for component modelsIvica Crnkovic
 
The Lean Tech Stack
The Lean Tech StackThe Lean Tech Stack
The Lean Tech StackBill Scott
 
Story of Puppet @eBay Global Classifieds Group (eCG)
Story of Puppet @eBay Global Classifieds Group (eCG)Story of Puppet @eBay Global Classifieds Group (eCG)
Story of Puppet @eBay Global Classifieds Group (eCG)Puppet
 
EclipseCon 2016 - OCCIware : one Cloud API to rule them all
EclipseCon 2016 - OCCIware : one Cloud API to rule them allEclipseCon 2016 - OCCIware : one Cloud API to rule them all
EclipseCon 2016 - OCCIware : one Cloud API to rule them allMarc Dutoo
 
OCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open Wide
OCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open WideOCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open Wide
OCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open WideOCCIware
 
What's new in CQ 5.3? Top 10 features.
What's new in CQ 5.3? Top 10 features.What's new in CQ 5.3? Top 10 features.
What's new in CQ 5.3? Top 10 features.David Nuescheler
 
VRE Definition And Creation
VRE Definition And CreationVRE Definition And Creation
VRE Definition And CreationFAO
 
Track2 -刘希斌----c ie-net-openstack-2012-apac
Track2 -刘希斌----c ie-net-openstack-2012-apacTrack2 -刘希斌----c ie-net-openstack-2012-apac
Track2 -刘希斌----c ie-net-openstack-2012-apacOpenCity Community
 
Challenges in Maintaining a High Performance Search Engine Written in Java
Challenges in Maintaining a High Performance Search Engine Written in JavaChallenges in Maintaining a High Performance Search Engine Written in Java
Challenges in Maintaining a High Performance Search Engine Written in Javalucenerevolution
 
Testingonandroid v2-091203161835-phpapp02
Testingonandroid v2-091203161835-phpapp02Testingonandroid v2-091203161835-phpapp02
Testingonandroid v2-091203161835-phpapp02Gustavo Fuentes Zurita
 
Testingonandroid v2-091203161835-phpapp02
Testingonandroid v2-091203161835-phpapp02Testingonandroid v2-091203161835-phpapp02
Testingonandroid v2-091203161835-phpapp02Gustavo Fuentes Zurita
 

Similar to Modular architecture today (20)

OSGi in the Enterprise: Agility, Modularity, and Architecture's Paradox
OSGi in the Enterprise: Agility, Modularity, and Architecture's ParadoxOSGi in the Enterprise: Agility, Modularity, and Architecture's Paradox
OSGi in the Enterprise: Agility, Modularity, and Architecture's Paradox
 
Introduction to design specifications to Summer of Code NZ students
Introduction to design specifications to Summer of Code NZ studentsIntroduction to design specifications to Summer of Code NZ students
Introduction to design specifications to Summer of Code NZ students
 
Paremus Cloud and OSGi Beyond the VM - OSGi Cloud Workshop March 2012
Paremus Cloud and OSGi Beyond the VM - OSGi Cloud Workshop March 2012Paremus Cloud and OSGi Beyond the VM - OSGi Cloud Workshop March 2012
Paremus Cloud and OSGi Beyond the VM - OSGi Cloud Workshop March 2012
 
colony framework & omni platform
colony framework & omni platformcolony framework & omni platform
colony framework & omni platform
 
Hive solutions cloudviews 2010 presentation
Hive solutions cloudviews 2010 presentationHive solutions cloudviews 2010 presentation
Hive solutions cloudviews 2010 presentation
 
Reverse engineering
Reverse engineeringReverse engineering
Reverse engineering
 
Agile Engineering Environment (Agile Tour 2009 Chengdu)
Agile Engineering Environment (Agile Tour 2009 Chengdu)Agile Engineering Environment (Agile Tour 2009 Chengdu)
Agile Engineering Environment (Agile Tour 2009 Chengdu)
 
Building a DevOps Team that isn't Evil
Building a DevOps Team that isn't EvilBuilding a DevOps Team that isn't Evil
Building a DevOps Team that isn't Evil
 
A classification framework for component models
A classification framework for component modelsA classification framework for component models
A classification framework for component models
 
The Lean Tech Stack
The Lean Tech StackThe Lean Tech Stack
The Lean Tech Stack
 
Story of Puppet @eBay Global Classifieds Group (eCG)
Story of Puppet @eBay Global Classifieds Group (eCG)Story of Puppet @eBay Global Classifieds Group (eCG)
Story of Puppet @eBay Global Classifieds Group (eCG)
 
EclipseCon 2016 - OCCIware : one Cloud API to rule them all
EclipseCon 2016 - OCCIware : one Cloud API to rule them allEclipseCon 2016 - OCCIware : one Cloud API to rule them all
EclipseCon 2016 - OCCIware : one Cloud API to rule them all
 
OCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open Wide
OCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open WideOCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open Wide
OCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open Wide
 
What's new in CQ 5.3? Top 10 features.
What's new in CQ 5.3? Top 10 features.What's new in CQ 5.3? Top 10 features.
What's new in CQ 5.3? Top 10 features.
 
VRE Definition And Creation
VRE Definition And CreationVRE Definition And Creation
VRE Definition And Creation
 
Track2 -刘希斌----c ie-net-openstack-2012-apac
Track2 -刘希斌----c ie-net-openstack-2012-apacTrack2 -刘希斌----c ie-net-openstack-2012-apac
Track2 -刘希斌----c ie-net-openstack-2012-apac
 
Challenges in Maintaining a High Performance Search Engine Written in Java
Challenges in Maintaining a High Performance Search Engine Written in JavaChallenges in Maintaining a High Performance Search Engine Written in Java
Challenges in Maintaining a High Performance Search Engine Written in Java
 
Testing on Android
Testing on AndroidTesting on Android
Testing on Android
 
Testingonandroid v2-091203161835-phpapp02
Testingonandroid v2-091203161835-phpapp02Testingonandroid v2-091203161835-phpapp02
Testingonandroid v2-091203161835-phpapp02
 
Testingonandroid v2-091203161835-phpapp02
Testingonandroid v2-091203161835-phpapp02Testingonandroid v2-091203161835-phpapp02
Testingonandroid v2-091203161835-phpapp02
 

Recently uploaded

New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 

Recently uploaded (20)

New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 

Modular architecture today

  • 1. 1
  • 2. Modular Architecture Today Kirk Knoernschild @pragkirk 2
  • 3. Java Application Architecture Modularity Patterns with Examples Using OSGi Forewords by Robert C. Martin and Peter Kriens I’m dancing! By god I’m dancing on the walls. I’m dancing on the ceiling. I’m ecstatic. I’m overjoyed. I’m really, really pleased.” - From the Foreword by Robert C. Martin (a.k.a. Uncle Bob) Java Application Architecture will help you ‣Design modular software that is extensible, reusable, maintainable, and adaptable ‣Design modular software today, in anticipation of platform support for modularity ‣Break large software systems into a flexible composite of collaborating modules ‣Understand where to place your architectural focus ‣Migrate large-scale monolithic applications to applications with a modular architecture ‣Articulate the advantages of modular software to your team Visit http://modularity.kirkk.com for more information. 3
  • 4. The Code https://github.com/pragkirk/poma/network or just Google pragkirk github 4
  • 5. Goals Today 2 Simple Goals Today 1.) Start designing modular software tomorrow! 2.) Don’t flip the bit on OSGi as too complex! 5
  • 6. Modular Architecture Today Introducing Modularity The Modularity Patterns Refactor to Modularity Introducing OSGi OSGi-ify the App 6
  • 7. Agile Architecture Introducing Modularity What ch What Why i s mo d us to d allenges fac are th ula ay in e e ben neces design mo dul arity? efits o sar y c rity a mo dul ar sof ing f ag ile o mpon tware archit en ? ecture t of ? 7
  • 8. Modularity - Not New! 1972 (or a bit before) On The Criteria To Be Used in Decomposing Systems into Modules by David Parnas at http://www.cs.umd.edu/class/spring2003/cmsc838p/Design/criteria.pdf 8
  • 9. Defining Module Hey, it’s a JAR file! - unit of reu - unit se of co m - unit po of dep sition - unit loyme of ma nt nagem ent A module system provides a runtime environment for modules 9
  • 10. The Facets Runtime Development Infras Progr Desig tructu am ming n Para dThink about when re Mo de igm l Runtim The fr The te you started using e plat amew chniqu suppo for m techn o r ks a nd to i de esobjects! Using the use d rt hel olog ie ntify enforc ps allow s that create an d language constructs e mo d us to the ri archit ular mo dul create o f mo ghtwere easy, but ecture ar sof dules set . tware creating designs was still really hard. The Design Paradigm - What’s the right granularity for a module? - What the right weight for a module? demo 10
  • 11. Paradox Increa sing e decre volvab ases s ility ur viva bility (Reuse, Compose, Extend, Lightweight, Fine-Grained, ...) (Use, Maintain, Understand, ...) ... making everything easy to change makes the entire system very complex... - Ralph Johnson in “Who Needs an Architect” 11
  • 12. Architectural Joints or Seams Here? Which Here? system area of the deman ds mo flexib re ility? Here? Here? Here? Here? Here? 12
  • 13. Complexity and Knowledge Source: http://www.tensegrity.hellblazer.com/ Source: http://adaptevolve.blogspot.com/ 13
  • 14. Complexity, Knowledge, & Modularity 14
  • 15. demo Architectural Joints or Seams Here? Which Here? system area of the deman ds mo flexib re ility? Here? Here? Modularizing software Here? Here? affects our design in interesting ways. Here? 15
  • 16. Benefits of Modularity - reus e Increases architectural agility! - re du ce co m - ease ple mainte xity - incr nance ease exten sibility Umm...we can already do this with objects, aspects, methods, and services! 16
  • 17. All the Way Down ? Reuse Release Equivalence: Unit of reuse is the unit of release! 17
  • 18. Agile Architecture The Modularity Patterns What are th mo dul e arity patter ns? 18
  • 19. Base Patterns • Manage Relationships – Design Module Relationships. • Module Reuse – Emphasize reusability at the module level. • Cohesive Modules – Module behavior should serve a singular purpose. 19
  • 20. Dependency Patterns • Acyclic Relationships - Module relationships must be acyclic. • Levelize Modules – Module relationships should be levelized. • Physical Layers - Module relationships should not violate the conceptual layers. • Container Independence - Modules should be independent of the runtime container. • Independent Deployment - Modules should be independently deployable units. 20
  • 21. Usability Patterns • Published Interface - Make a module’s published interface well known. • External Configuration – Modules should be externally configurable. • Default Implementation - Provide modules with a default implementation. • Module Facade – Create a facade serving as a coarse-grained entry point to another fine-grained module’s underlying implementation. 21
  • 22. Extensibility Patterns • Abstract Modules - Depend upon the abstract elements of a module. • Implementation Factory - Use factories to create a module’s implementation classes. • Separate Abstractions - Place abstractions and the classes that implement them in separate modules. 22
  • 23. Utility Patterns • Colocate Exceptions: Exceptions should be close to the class or interface that throws them. • Levelize Build – Execute the build in accordance with module levelization. • Test Module – Each module should have a corresponding test module. 23
  • 24. Agile Architecture Patterns Applied Ho w c Ho w d This is the Design an I u o they mo dul arity se the acco m h mo dat elp Paradigm patter archit e ns? ectura l shift s? 24
  • 25. The System Design a system to handle payment and auditing of various types of bills. The system must integrate with 3rd party auditing software, and a legacy financials system that must be fed payment information for reconciliation. 25
  • 26. The Class Model Note t he bi- a sso ci direct ations ional ! 26
  • 27. demo Initial Systems Modules If I la ye but no r conceptua t phys lly then a ically, m the a d I realizing vantag layeri e ng? W s of layer ? hy do I 27
  • 28. Physical Layers Module relationships should not violate the conceptual layers. 28
  • 29. Abstract Modules Depend upon the abstract elements of a module. package client; import service.*; public class Client { Service service; } package service; public interface Service { public void doService(); } - “Inje ct implem ” the package service; entati Client. on int o public class ServiceImpl implements - “ Lo o ku p Service { implem ” the entati public void doService() { Client. on w it hin .... }; } 29
  • 30. Abstract Modules What if to use Bill must be differ system ent au able s? diting 30
  • 31. Abstract Modules Au ditF aca de into B 1 is in ill as jecte d Au ditF an aca de type. 31
  • 33. Acyclic Relationships Module relationships must be acyclic 33
  • 34. Recall - Abstract Modules Au ditF aca de into B 1 is in ill as jecte d Au ditF an aca de type. Same problem here 34
  • 35. Recall - Abstract Modules 35
  • 38. Separate Abtractions Separate abstractions from the classes that realize them. How d o I in with a tegra te nothe auditi r ng sy stem? Wher e doe s Audit Facad e2 liv e? 38
  • 39. Separate Abstractions Shoul d I p ut Audit Facad e2 i n audit. jar? 39
  • 41. Colocate Exceptions Exceptions should be close to the classes that throw them Audit Facad e thro the A ws uditEx ceptio n. Exception goes here. 41
  • 42. Independent Deployment Modules should be independently deployable units. How d o I re bill.ja use r wi t h financ out ial.ja r? Lik a bat e in ch ap plicat ion? 42
  • 44. Independent Deployment 1.) PayAction invokes Bill.pay() and passes BillPayAdapter as a BillPayer. 2.) Bill.pay() invokes BillPayer.generateDraft() 3.)BillPayAdapeter.generateDraft() invokes Payment.generateDraft() passing itself as a Payable. 4.) Payment.generateDraft() invokes Payable.getAmount() 44
  • 46. Implementation Factory Use factories to create a modules implementation classes. 46
  • 49. Modular Architecture Today Introducing OSGi? This is the Is OS What is OSG Gi new? Who i s usin Infrastructure & i? g OSG i? Programming Model 49
  • 50. Modularity is coming to the Java platform! OpenJDK 50
  • 51. A Bit of History • JSR 8 - Open Services Gateway specification in 1999 (JSR 232 or JSR 291) • Gateway for providing services to home devices • lifecycle management, dependencies, installing, versioning, configuration • OSGi Alliance formed in 1999 and delivered V1.0 in 2000 • Very popular on the desktop; driven by Eclipse 3.0 adoption in 2003 • Today, just about all Java middleware products use OSGi • WAS, WebLogic, GlassFish, Paremus Service Fabric, JBoss, Geronimo, ... 51
  • 52. Introducing OSGi Dynamic Module System for Java ClassLoaders - Each bundle has it’s own classloader and it’s own lifecycle µServices - Bundle exposes it’s behavior via well-defined interface MODULE Bundles - Bundle is a JAR file with manifest 52
  • 53. A Valid Bundle myjar.jar Manifest.mf Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Scala Calculator JAR + Bundle-SymbolicName: scala calculator Bundle-Version: 1.0.0 Import-Package: com.extensiblejava.loan,scala.annotation.unchecked;us es:="scala.reflect,scala" ;version="2.8.0.final" <osgi:service id="LoanCalculator" ref="loanCalculator" interface="com.extensiblejava.loan.LoanCalculator"/> Register µServices <osgi:reference id="paymentFactory" µService Reference interface="com.extensiblejava.loan.PaymentFactory"/> 53
  • 54. The Basic Workings Private packages Classloader restricts are implementation visibility Imported Exported packages packages Publishes the JAR is a module interface, ideally as Classloader gives µServices each module its own DYNAMICITY lifecycle 54
  • 55. Modules as First Class Citizens INSTALLED STARTING start Because bundles have their own classloader, they can be managed independently. RESOLVED ACTIVE Hence, a very dynamic environment. stop UNINSTALLED STOPPING 55
  • 56. demo The Runtime - Dyn ami - Mult c deployme ipl nt - Enfo e versions rce de - Enca pen de psulat ncies ion 56
  • 57. demo Too Complex? “OSGi provides little value and is too complex as demonstrated by our failed attempt to make modularity invisible when porting our legacy system to it with over 150 third-party JARs. -- http://blogs.mulesoft.org/osgi-no-thanks “OSGi is a great solution for complex applications with stringent modularity requirements.” -- http://www.theserverside.com/news/thread.tss?thread_id=62590 57
  • 58. A Modular System TODAY! 58
  • 59. Standard Java Lack Encapsulation Everything is still visible; no dynamics! 59
  • 61. Type Visibility Any public class in any JAR on the classpath can be seen by any other class on the classpath! With OSGi, you have control who sees what! Cookie Jar images courtesy of Richard Hall 61
  • 63. demo Encapsulation Nothing can reach this class! 63
  • 64. Modularity Today Platforms discourage modularity! Why a re design n’t we in mo dul g more ar sof tware ? 64
  • 65. demo Modularity Tomorrow This is the next generation application platform! - Dyn ami - Mult c deployme ipl nt - Expl e versions icit de pen de ncies 65
  • 66. Modular Architecture Today OSGi-ify the App Ho w d o I bu Is it i Is it r applic ild nvasiv eally ations e to m to o co using y co de mplex OSGi? ? ? 66
  • 67. Java Application Architecture Modularity Patterns with Examples Using OSGi Forewords by Robert C. Martin and Peter Kriens I’m dancing! By god I’m dancing on the walls. I’m dancing on the ceiling. I’m ecstatic. I’m overjoyed. I’m really, really pleased.” - From the Foreword by Robert C. Martin (a.k.a. Uncle Bob) Java Application Architecture will help you ‣Design modular software that is extensible, reusable, maintainable, and adaptable ‣Design modular software today, in anticipation of platform support for modularity ‣Break large software systems into a flexible composite of collaborating modules ‣Understand where to place your architectural focus ‣Migrate large-scale monolithic applications to applications with a modular architecture ‣Articulate the advantages of modular software to your team Visit http://modularity.kirkk.com for more information. 67
  • 68. Q&A 68