MODULAR ARCHITECTURES
By Param Rengaiah (@its_param)
March 18, 2014
What they are and why do they matter now.
PROLOGUEHistory matters, at least to me.
This is a three part story.
PART IDefinition, Sort of.
What is
Software Architecture?
The word software architecture intuitively denotes the high level structures of a software system.
- Wikipedia
“
1STRUCTUREOF THE SYSTEM
2PROCESSOF CREATING SUCH STRUCTURES
3RECORDOF THIS STRUCTURE
STYLESArchitecture are indicated in terms of their
MANY STYLES
An useful system always uses
LAYEREDSTYLE 1
PHYSICAL LAYOUT
Focuses on
SERVICE ORIENTED
STYLE 2
INTEGRATION & CUMMINICATION
Focuses on
What is
Modular Architecture?
GOING ONE STEP FURTHER
Modular Architecture is
SMALLER MODULES
Dividing a layer or a service into
deployable, manageable, natively reusable, composable, stateless unit of software that provides a concise interface to consumers. - Kirk Knoernschild
MODULE IS A
“
CHARACTERISTICSOf a module are
1PHYSICALSHOULD BE
2SCOPECLEAR BUSINESS
3 LAYERSCONFINES WITHIN EXISTING
4CONTEXTWORKS WITHIN ITS
5RATE OF CHANGE
SCOPED BY
6 INTERFACEEXPRESSED THROUGH PUBLIC
7STATELESSMODULE INTERFACES ARE
JARA module in Java can be expressed as
COMPOSITION & COMPREHENSION
Focuses on
BENEFITSOf Modular Architectures
1UNDERSTANDHELP US
2EXTENDINGMAKES IT EASY FOR
3DEPENDENCYHELP US MANAGE
Enabling us to
ARCHITECT ALL THE WAY DOWN
Provide us with
DESIGN TIME MODULARITY
RUNTIME MODULARITY
But my system is already modular.
FRAMEWORKDOES NOT MAKE CODE MODULAR
A NEW LANGDOES NOT MAKE CODE MODULAR
SOADOES NOT MAKE CODE MODULAR
PRETTY DIAGRAMDOES NOT MAKE CODE EASY TO UNDERSTAND
PHYSICAL DESIGNIS THE ONLY THING THAT HELP YOU UNDERSTAND, EXTEND AND MANAGE.
PART IIPrerequisites, Sort of.
But why would we want to restructure in the first place?
VISIONARCHITECTS
RESULT IS?
REALITY ISAfter a year or so,
SPAGHETTI
Complicated, difficult to understand,and impossible to maintain is
BRIAN FOOTE JOSEPH YODER
[ Big ball of mud / spaghetti ] systems show unmistakable signs of unregulated growth and repeated, expedient repair.
“
DESIGN ROT
Tightly coupled code with excessive dependencies is known as
ROBERT C. MARTIN (UNCLE BOB)
There are four primary symptoms that tell us that our designs are rotting : rigidity, fragility, immobility, and viscosity.
“
TECHNICAL DEBT
When you choose to defer internal things that will impede future development, you incur
MARTIN FOWLER
Development organizations let their debt get out of control and spend most of their future development effort paying crippling interest payments.
“
Restructuring addresses
1 LOGICALDESIGN FLAWS
MARTIN FOWLER
I see refactoring as a very specific technique to do the more general activity of restructuring.
Restructuring is any rearrangement of parts of a whole.
“
The physical architecture is the skeleton of the system – if it is malformed, there is no cosmetic remedy for alleviating its unpleasant symptoms.
“
JOHN LAKOS
2PHYSICAL& STRUCTURAL DESIGN FLAWS
Restructuring to Modularity.
I was fortunate to have these …
1MODULARITY PATTERNS
A BOOK ON
2 UI MODULESEPERATE
GWT
3 DOMAIN MODEL
SEPERATE
Ubiquitous Language
4 EXTERNAL INTEGRATION
ISOLATED
Clear business context. Explicit boundary. Physical adapters.
5 RULES & WORKFLOW
GROOVY BASED
Essential ComplexityVsAccidental Complexity
Choice between
6DESIGN & ARCH REVIEWS
PERIODIC
Making choices under given context and constraints.
Architecture is about
7 TRUST & FAITH
STAKEHOLDERS SHOULD HAVE
Trusting is one thing, but keeping you on the toe is another.
8 IMPL TEAMROCK STAR
Willing to unlearn what you have known for years.
PART IIIThe works, if you say so.
16 to 82Number of JAR modules
How did we do it?
Arrive at a “Ubiquitous Language” for the domain model.
Simply the lifecycle of managed resources.
Catalog the lifecycle events, triggers, contexts and swim-lanes.
Refactor the domain model to confer to the new ubiquitous language.
Extract core domain model and reference models as separate modules.
Create a separate module to manage each stage of lifecycle for each resource.
Divide the modules further consider rate of change, rate of reuse and for removing cyclical dependencies.
Create a contract module for each external system as it relates to your business
For each of above logical modules, create two physical modules - a spec and an implementation.
Manage physical dependencies through spec modules.
Create deployable modules as a composition of smaller modules (WAR).
Deployed module endpoints are exposed as stateless REST APIs.
Composition provides runtime inter-module integrations.
Composition essentially addresses time and space.
Scalability is baked into composition.
You will arrive at an event-driven, message-driven, comprehensible, extensible, scalable
and maintainable system.
EPILOGUEWhy does it matter now? Finally.
Have you been asked to do any of this?
LETS ADD A MOBILE SKIN
WE SHOULD SUPPORT TOUCH
DEVICES
PUT IT ON THE CLOUD
100% SOA
ITS A SAAS APP BABY!
WE SUPPORT BIG DATA
WE DID “RESPONSIVE WEB
DESIGN”
Modular Architecture prepares you for the future.
Talking about new trends..
REACTIVE ARCHITECTURE
Modular Architecture is an essential facet of RESPONSIVE ARCHITECTURE.
Thank You.Follow me at @its_param