SlideShare a Scribd company logo
Modular Monoliths 
with Grails 3 and 
Spring Boot 
Lari Hotari, Pivotal Software Inc. 
presentation recording: 
http://goo.gl/LRlrQK 
© 2014 Pivotal Software, Inc. All rights reserved. ‹‹#››
Pivotal Analytics 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
Agenda 
• Modularity: Why? What? 
• How to approach the design of Modular Monoliths with 
Grails 3 and Spring Boot? 
– current alternatives 
– challenges and drawbacks 
– future possibilities? 
presentation recording: 
http://goo.gl/LRlrQK 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
What's the right way? 
© 2014 Pivotal Software, Inc. All rights reserved. ‹‹#››
Microservices? 
© 2014 Pivotal Software, Inc. All rights reserved. ‹‹#››
Velocity is the Killer App 
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and 
licensed under a 
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/ 
licenses/by-nc/3.0/
Conceptual graph of cost of change & time-to-value 
Cost & time-to-value 
per additional 
feature/change 
connected 
monolith is 
cheaper in the 
beginning 
cost per change is 
high, system 
replacement requires 
changes too 
You can plan to switch 
strategies! 
Cumulated number of changes / features 
source: Kent Beck's blog post: To Design or Not To Design? A Third Good Question 
http://www.threeriversinstitute.org/blog/?p=338 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
Modularity 
• logical partitioning of the software at design time 
• separation of concerns 
• allows complex software to be manageable for the 
purpose of implementation and maintenance 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
The challenge with using microservices 
architecture 
In the beginning: 
• You don't need it. 
• It will slow you down. 
Later on: 
• You need it. 
• Refactoring is painful. 
“Because of these issues, adopting a microservice 
architecture should not be undertaken lightly.” 
Chris Richardson: Microservices: Decomposing Applications 
for Deployability and Scalability 
http://www.infoq.com/articles/microservices-intro 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
http://martinfowler.com/bliki/SacrificialArchitecture.html 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
What is the problem we 
are trying to solve? 
© 2014 Pivotal Software, Inc. All rights reserved. ‹‹#››
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
Maintainability, not just modularity 
• modularity 
• conceptual clarity and consistency 
• easy to learn and understand from developer's point of 
view 
– it's very important that developers understand the story 
that the elements of the system is telling (DDD blue 
book) 
• as developers, we want to feel safe in doing changes to 
the system (safety net of tdd, etc.), easy to validate 
changes 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
From Reuse to Replaceability 
• earlier software reuse was one of the main goals 
• large legacy systems are hard to replace. 
– stop building large monoliths! 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
Coupling and Cohesion 
• Coupling and cohesion are measures for describing how 
easy it will be to change the behaviour of some element 
in a system 
• Modules are coupled if a change in one forces a change 
in a the other 
• A module's cohesion is a measure of whether it's 
responsibilities form a meaningful unit 
source: GOOS book 
For a longer and better explanation, read Kent Beck's blog post 
on Coupling and Cohesion 
http://www.threeriversinstitute.org/blog/?p=104 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
Optimal Coupling and Cohesion within the Context 
• Low coupling between modules ⟹ easier to change 
• High cohesion within module ⟹ meaningful single 
responsibility 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
Coupling related guidelines 
• Elements that change of the same reason should be kept 
together to minimise the ripple effects. 
• Separate things that change at different rates. 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
Other types of coupling 
• Be aware of behavioural or temporal coupling that is 
hidden and hard to detect: no static analysis can detect 
this type of coupling. 
• Shared mutable state related coupling 
• coupling via shared database 
• transactions 
• RPC 
• Your system can be extremely "clean" and technically 
loosely coupled (at design time), but this doesn't really 
improve the situation in the end when there is tight 
behavioural or temporal coupling at runtime. 
=> ripple effects, high cost of change 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
Brooks: "No silver bullet" 
• Essential complexity 
– complexity that you cannot escape 
• Accidental complexity 
– we could be adding complexity by bad design 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
Modularity of commonly 
used 
Spring/Grails application 
architectures 
styles 
© 2014 Pivotal Software, Inc. All rights reserved. ‹‹#››
Sources of excess coupling in large Grails/ 
Spring applications (applies to many others 
too) 
• There is a common misconception that shared layers are 
good for modularity. Usually they aren't. "Vertical slices" 
should be also used. 
• see Oliver Gierke's presentation for better explanation 
https://www.youtube.com/watch?v=tEm0USdF-70 
• Accidental architecture. You should have a sound plan to 
accomplish modularity and also enforce it. See Oliver's blog 
post: http://olivergierke.de/2013/01/whoops-where-did-my-architecture- 
go/ 
• Unnecessary coupling to implementation details in 
interfaces 
• DRY at extremes causes coupling which reduces flexibility. 
• Tests cause coupling too since tests have to be maintained. 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
Grails plugins 
• Grails plugins provide a way to decompose the application to 
vertical slices at design time. 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
Spring modularity related options 
• Spring Boot applications can be decomposed in separate 
jar-modules as well. These "plugins" can be reused like 
Grails plugins. 
• Spring bean contexts (configured with java config or xml) 
can be used to encapsulate groups of Spring beans to be 
packaged and reused as libraries in several applications. 
• UI resources can be referenced from web jars 
• DI is providing a way to decouple implementation classes 
from consumer classes. DI is also used to inject 
configuration parameters in Spring applications. 
• Spring Boot Auto-Configuration for activating "starter" 
modules that are on the classpath. You can build your own 
"starter"/auto-configuration modules too. 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
Grails 3 apps are Spring Boot apps 
• Since Grails 3 will be based on Spring Boot, the features 
of Spring Boot are useable in Grails 3 apps too. 
• Grails 3 apps are Spring Boot apps with extended 
functionality to bring the developer similar behaviour and 
features as in previous Grails versions. 
• Watch Graeme's keynote tomorrow for a demo and more 
information about Grails 3. 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
Presentation 
Services 
Persistence 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
Account Search Order 
Presentation 
Services 
Persistence 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
Stefan Tilkov's 
Vertical Systems approach 
a.k.a Self Contained Systems 
Microservices approach Vertical Systems approach 
• Very small 
• 100s 
• Does one thing only 
• Separate client 
• No shared DB 
• Medium sized 
• 10s 
• Small # of related things 
• Includes UI 
• No shared DB 
• You don't need any special frameworks or containers to implement the 
Self Contained Systems approach today. You usually need SSO and a way 
to make the UI consistent across the vertical slices. You don't need a 
portal server to do this. 
http://www.infoq.com/presentations/modular-ecommerce-website 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
Account 
Presentation 
Services 
Persistence 
Search Order 
Presentation 
Services 
Persistence 
Presentation 
Services 
Persistence 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
Gradually migrating to 
microservices? 
© 2014 Pivotal Software, Inc. All rights reserved. ‹‹#››
Hybrid style - Microservices and Self Contained 
Systems strategy 
Account 
Presentation 
Services 
Persistence 
Search 
Presentation 
Services 
Persistence 
Order 
Presentation 
Services 
Persistence 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
Everything as a microservice 
Unrealistic in most enterprise environments? 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
Microservices? More like client-server 
μservice 
A 
Monolith is 
now in the 
browser 
Single Page 
App in 
Browser 
API 
Gateway 
service 
SAAS 
Service A 
SAAS 
Service B 
μservice 
B 
μservice 
C 
μservice 
D 
μservice 
E 
μservice 
F 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
Do you need true "micro services"? 
• There might not even be a real requirement for going 
from self contained systems to "true" microservices. 
• You might want to keep the core parts of your business as 
"self contained systems" and add more functionality 
around these systems as smaller microservices. 
• In many context, microservices architecture has started to 
mean this style of architecture. That's why "micro" is not a 
very meaningful term in this context. 
• Applying Microservices is more about building "cloud-native" 
12-factor applications that can be run on cloud 
platforms (where servers are cattle and not pets). 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
Recommendations 
• Big monolithic systems cause trouble - don't let any single 
code base become too large. 
• Split your system in modules and gradually migrate 
from a monolith, to vertical slices, then to self contained 
systems and/or microservices. Refine as you go. 
• Split the database too. Don't share the database since it 
usually leads to a monolith. 
• Build "cloud native" systems and 12-factor apps. 
Use Spring Cloud and Reactor that contains helpers for 
this way of building applications. Functional reactive 
programming with Reactive Streams is a way to handle 
complexity and reduce coupling in certain use cases. It's 
not only about scaling to masses. 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
• Learn Domain Driven Design and the Bounded Context. 
• http://martinfowler.com/bliki/BoundedContext.html 
http://www.slideshare.net/adriancockcroft/dockercon-state-of-the-art-in-microservices/43
Strategic design 
Not all of a large 
system will be well 
designed. 
Some or none will 
be. 
-Eric Evans 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
Why is Domain Driven Design important? 
Success developing useful models comes down to three 
points. 
1. Sophisticated domain models are achievable and worth 
the trouble. 
2. They are seldom developed except through an iterative 
process of refactoring, including close involvement of the 
domain experts with developers interested in learning 
about the domain. 
3. They may call for sophisticated design skills to implement 
and to use effectively. 
source: Eric Evans: Domain Driven Design 
You can only achieve "bounded contexts" or "vertical slices" with proper design. 
Microservices are really about building in this style. 
See Kent Beck's blog article "To Design or Not To Design? A Third Good Question" from 2009, 
http://www.threeriversinstitute.org/blog/?p=338 gives good insight. 
© 2014 Pivotal Software, Inc. All rights reserved. ‹#›
As a software developer, choose your battles 
and fight for what actually matters. 
-Me just know 
Write software that matters. 
-Dan North 
Q&A 
@lhotari 
lhotari@pivotal.io 
© 2014 Pivotal Software, Inc. All rights reserved. ‹‹#››

More Related Content

PPTX
cdSummit Austin - The Future of Enterprise Service Mangagement in a DevOps Wo...
PDF
What is DevOps?
PDF
Java DevOps at Enterprise Scale
PPTX
Top Devops bottlenecks, constraints and best practices
PPTX
The 7 Principles of DevOps and Cloud Applications
PDF
Agile Secure Cloud Application Development Management
PDF
Java / Opening Open Source the Jenkins Way - Nicolas de Loof, CloudBees
PDF
DevOps - Applying Lean & Agile Principles to Operations & More
cdSummit Austin - The Future of Enterprise Service Mangagement in a DevOps Wo...
What is DevOps?
Java DevOps at Enterprise Scale
Top Devops bottlenecks, constraints and best practices
The 7 Principles of DevOps and Cloud Applications
Agile Secure Cloud Application Development Management
Java / Opening Open Source the Jenkins Way - Nicolas de Loof, CloudBees
DevOps - Applying Lean & Agile Principles to Operations & More

What's hot (20)

PPT
Mobile and agile the floating writer's survival kit
PPTX
Going Reactive in Java with Typesafe Reactive Platform
PPTX
Software operability and run book collaboration - DevOps Summit, Amsterdam
PPTX
DevOps Days Ohio
PDF
Webinar: Cloud Data Masking - Tips to Test Software Securely
PPTX
Implementing FaaS on Kubernetes using Kubeless
PDF
DOES14: Scott Prugh, CSG - DevOps and Lean in Legacy Environments
PPTX
building microservices
PPTX
Webinar: Removing Barriers to Continuous Delivery of Business Value
PDF
Deconstructing Monoliths with Domain Driven Design
PDF
Software operability and run book collaboration - DevOps Summit, Bangalore
PDF
Gartner Infrastructure and Operations Summit Berlin 2015 - DevOps Journey
PPTX
From Monolith to Microservices – and Beyond!
PDF
Blueprinting DevOps for Digital Transformation_v4
PPT
Enabling DevOps in the cloud - Federal Cloud Innovation Center
PPTX
DevOps 101 - an Introduction to DevOps
PDF
Delivering Better Software Faster (Without Breaking Everything)
PDF
When Developers Operate and Operators Develop
PDF
How to Start Your Application Modernization Journey
PPTX
Removing Barriers Between Dev and Ops
Mobile and agile the floating writer's survival kit
Going Reactive in Java with Typesafe Reactive Platform
Software operability and run book collaboration - DevOps Summit, Amsterdam
DevOps Days Ohio
Webinar: Cloud Data Masking - Tips to Test Software Securely
Implementing FaaS on Kubernetes using Kubeless
DOES14: Scott Prugh, CSG - DevOps and Lean in Legacy Environments
building microservices
Webinar: Removing Barriers to Continuous Delivery of Business Value
Deconstructing Monoliths with Domain Driven Design
Software operability and run book collaboration - DevOps Summit, Bangalore
Gartner Infrastructure and Operations Summit Berlin 2015 - DevOps Journey
From Monolith to Microservices – and Beyond!
Blueprinting DevOps for Digital Transformation_v4
Enabling DevOps in the cloud - Federal Cloud Innovation Center
DevOps 101 - an Introduction to DevOps
Delivering Better Software Faster (Without Breaking Everything)
When Developers Operate and Operators Develop
How to Start Your Application Modernization Journey
Removing Barriers Between Dev and Ops
Ad

Similar to GGX 2014 Lari Hotari Modular Monoliths with Spring Boot and Grails 3 (20)

PDF
Keynote: Architecting for Continuous Delivery (Pivotal Cloud Platform Roadshow)
PPTX
Technology insights: Decision Science Platform
PDF
Cloud Foundry and Microservices: A Mutualistic Symbiotic Relationship
PDF
Cloud Foundry and Microservices: A Mutualistic Symbiotic Relationship
PDF
A Reference Architecture to Enable Visibility and Traceability across the Ent...
PPTX
Iterating For Success: A Case Study in Remote Paired Programming, The Evoluti...
PDF
Dynamic APIs: SOA Done Right
PDF
Cloud Foundry - An Open Innovation Platform
PPTX
The dev ops drumbeat reinventing the iron triangle
PPTX
Oracle WebLogic Server 12.2.1 Do More with Less
PPTX
ThatConference 2016 - Highly Available Node.js
PDF
Cloud native Microservices using Spring Boot
PPTX
Linux Foundation Japan 2015
PDF
The New Possible: How Platform-as-a-Service Changes the Game
PPTX
Cloud Native Infrastructure Automation
PPTX
Transforming to Microservices
PDF
Accelerate Spring Apps to Cloud at Scale
PDF
Accelerate Spring Apps to Cloud at Scale—Discussion with Azure Spring Cloud C...
PPTX
[2015-11월 정기 세미나] Cloud Native Platform - Pivotal
PDF
The Reality of Managing Microservices in Your CD Pipeline
Keynote: Architecting for Continuous Delivery (Pivotal Cloud Platform Roadshow)
Technology insights: Decision Science Platform
Cloud Foundry and Microservices: A Mutualistic Symbiotic Relationship
Cloud Foundry and Microservices: A Mutualistic Symbiotic Relationship
A Reference Architecture to Enable Visibility and Traceability across the Ent...
Iterating For Success: A Case Study in Remote Paired Programming, The Evoluti...
Dynamic APIs: SOA Done Right
Cloud Foundry - An Open Innovation Platform
The dev ops drumbeat reinventing the iron triangle
Oracle WebLogic Server 12.2.1 Do More with Less
ThatConference 2016 - Highly Available Node.js
Cloud native Microservices using Spring Boot
Linux Foundation Japan 2015
The New Possible: How Platform-as-a-Service Changes the Game
Cloud Native Infrastructure Automation
Transforming to Microservices
Accelerate Spring Apps to Cloud at Scale
Accelerate Spring Apps to Cloud at Scale—Discussion with Azure Spring Cloud C...
[2015-11월 정기 세미나] Cloud Native Platform - Pivotal
The Reality of Managing Microservices in Your CD Pipeline
Ad

More from Lari Hotari (7)

PPTX
Microservices - Palveluarkkitehtuurin uusi tuleminen - EMC Forum 2014
PPTX
Performance tuning Grails applications SpringOne 2GX 2014
PPTX
Ratpack and Grails 3 (and Spring Boot) SpringOne 2GX 2014
PPTX
Ratpack and Grails 3 GR8Conf US 2014
PPTX
Performance tuning Grails Applications GR8Conf US 2014
PDF
Performance tuning Grails applications
PDF
Ratpack and Grails 3
Microservices - Palveluarkkitehtuurin uusi tuleminen - EMC Forum 2014
Performance tuning Grails applications SpringOne 2GX 2014
Ratpack and Grails 3 (and Spring Boot) SpringOne 2GX 2014
Ratpack and Grails 3 GR8Conf US 2014
Performance tuning Grails Applications GR8Conf US 2014
Performance tuning Grails applications
Ratpack and Grails 3

Recently uploaded (20)

PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
MYSQL Presentation for SQL database connectivity
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
Encapsulation theory and applications.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Electronic commerce courselecture one. Pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Unlocking AI with Model Context Protocol (MCP)
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Advanced methodologies resolving dimensionality complications for autism neur...
Diabetes mellitus diagnosis method based random forest with bat algorithm
MYSQL Presentation for SQL database connectivity
The AUB Centre for AI in Media Proposal.docx
Per capita expenditure prediction using model stacking based on satellite ima...
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Agricultural_Statistics_at_a_Glance_2022_0.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Review of recent advances in non-invasive hemoglobin estimation
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Empathic Computing: Creating Shared Understanding
Encapsulation theory and applications.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Electronic commerce courselecture one. Pdf
Chapter 3 Spatial Domain Image Processing.pdf

GGX 2014 Lari Hotari Modular Monoliths with Spring Boot and Grails 3

  • 1. Modular Monoliths with Grails 3 and Spring Boot Lari Hotari, Pivotal Software Inc. presentation recording: http://goo.gl/LRlrQK © 2014 Pivotal Software, Inc. All rights reserved. ‹‹#››
  • 2. Pivotal Analytics © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 3. Agenda • Modularity: Why? What? • How to approach the design of Modular Monoliths with Grails 3 and Spring Boot? – current alternatives – challenges and drawbacks – future possibilities? presentation recording: http://goo.gl/LRlrQK © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 4. © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 5. What's the right way? © 2014 Pivotal Software, Inc. All rights reserved. ‹‹#››
  • 6. Microservices? © 2014 Pivotal Software, Inc. All rights reserved. ‹‹#››
  • 7. Velocity is the Killer App Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/ licenses/by-nc/3.0/
  • 8. Conceptual graph of cost of change & time-to-value Cost & time-to-value per additional feature/change connected monolith is cheaper in the beginning cost per change is high, system replacement requires changes too You can plan to switch strategies! Cumulated number of changes / features source: Kent Beck's blog post: To Design or Not To Design? A Third Good Question http://www.threeriversinstitute.org/blog/?p=338 © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 9. Modularity • logical partitioning of the software at design time • separation of concerns • allows complex software to be manageable for the purpose of implementation and maintenance © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 10. The challenge with using microservices architecture In the beginning: • You don't need it. • It will slow you down. Later on: • You need it. • Refactoring is painful. “Because of these issues, adopting a microservice architecture should not be undertaken lightly.” Chris Richardson: Microservices: Decomposing Applications for Deployability and Scalability http://www.infoq.com/articles/microservices-intro © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 11. http://martinfowler.com/bliki/SacrificialArchitecture.html © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 12. What is the problem we are trying to solve? © 2014 Pivotal Software, Inc. All rights reserved. ‹‹#››
  • 13. © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 14. © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 15. Maintainability, not just modularity • modularity • conceptual clarity and consistency • easy to learn and understand from developer's point of view – it's very important that developers understand the story that the elements of the system is telling (DDD blue book) • as developers, we want to feel safe in doing changes to the system (safety net of tdd, etc.), easy to validate changes © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 16. From Reuse to Replaceability • earlier software reuse was one of the main goals • large legacy systems are hard to replace. – stop building large monoliths! © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 17. Coupling and Cohesion • Coupling and cohesion are measures for describing how easy it will be to change the behaviour of some element in a system • Modules are coupled if a change in one forces a change in a the other • A module's cohesion is a measure of whether it's responsibilities form a meaningful unit source: GOOS book For a longer and better explanation, read Kent Beck's blog post on Coupling and Cohesion http://www.threeriversinstitute.org/blog/?p=104 © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 18. Optimal Coupling and Cohesion within the Context • Low coupling between modules ⟹ easier to change • High cohesion within module ⟹ meaningful single responsibility © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 19. Coupling related guidelines • Elements that change of the same reason should be kept together to minimise the ripple effects. • Separate things that change at different rates. © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 20. Other types of coupling • Be aware of behavioural or temporal coupling that is hidden and hard to detect: no static analysis can detect this type of coupling. • Shared mutable state related coupling • coupling via shared database • transactions • RPC • Your system can be extremely "clean" and technically loosely coupled (at design time), but this doesn't really improve the situation in the end when there is tight behavioural or temporal coupling at runtime. => ripple effects, high cost of change © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 21. Brooks: "No silver bullet" • Essential complexity – complexity that you cannot escape • Accidental complexity – we could be adding complexity by bad design © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 22. Modularity of commonly used Spring/Grails application architectures styles © 2014 Pivotal Software, Inc. All rights reserved. ‹‹#››
  • 23. Sources of excess coupling in large Grails/ Spring applications (applies to many others too) • There is a common misconception that shared layers are good for modularity. Usually they aren't. "Vertical slices" should be also used. • see Oliver Gierke's presentation for better explanation https://www.youtube.com/watch?v=tEm0USdF-70 • Accidental architecture. You should have a sound plan to accomplish modularity and also enforce it. See Oliver's blog post: http://olivergierke.de/2013/01/whoops-where-did-my-architecture- go/ • Unnecessary coupling to implementation details in interfaces • DRY at extremes causes coupling which reduces flexibility. • Tests cause coupling too since tests have to be maintained. © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 24. Grails plugins • Grails plugins provide a way to decompose the application to vertical slices at design time. © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 25. Spring modularity related options • Spring Boot applications can be decomposed in separate jar-modules as well. These "plugins" can be reused like Grails plugins. • Spring bean contexts (configured with java config or xml) can be used to encapsulate groups of Spring beans to be packaged and reused as libraries in several applications. • UI resources can be referenced from web jars • DI is providing a way to decouple implementation classes from consumer classes. DI is also used to inject configuration parameters in Spring applications. • Spring Boot Auto-Configuration for activating "starter" modules that are on the classpath. You can build your own "starter"/auto-configuration modules too. © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 26. Grails 3 apps are Spring Boot apps • Since Grails 3 will be based on Spring Boot, the features of Spring Boot are useable in Grails 3 apps too. • Grails 3 apps are Spring Boot apps with extended functionality to bring the developer similar behaviour and features as in previous Grails versions. • Watch Graeme's keynote tomorrow for a demo and more information about Grails 3. © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 27. Presentation Services Persistence © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 28. Account Search Order Presentation Services Persistence © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 29. Stefan Tilkov's Vertical Systems approach a.k.a Self Contained Systems Microservices approach Vertical Systems approach • Very small • 100s • Does one thing only • Separate client • No shared DB • Medium sized • 10s • Small # of related things • Includes UI • No shared DB • You don't need any special frameworks or containers to implement the Self Contained Systems approach today. You usually need SSO and a way to make the UI consistent across the vertical slices. You don't need a portal server to do this. http://www.infoq.com/presentations/modular-ecommerce-website © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 30. Account Presentation Services Persistence Search Order Presentation Services Persistence Presentation Services Persistence © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 31. Gradually migrating to microservices? © 2014 Pivotal Software, Inc. All rights reserved. ‹‹#››
  • 32. Hybrid style - Microservices and Self Contained Systems strategy Account Presentation Services Persistence Search Presentation Services Persistence Order Presentation Services Persistence © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 33. Everything as a microservice Unrealistic in most enterprise environments? © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 34. Microservices? More like client-server μservice A Monolith is now in the browser Single Page App in Browser API Gateway service SAAS Service A SAAS Service B μservice B μservice C μservice D μservice E μservice F © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 35. Do you need true "micro services"? • There might not even be a real requirement for going from self contained systems to "true" microservices. • You might want to keep the core parts of your business as "self contained systems" and add more functionality around these systems as smaller microservices. • In many context, microservices architecture has started to mean this style of architecture. That's why "micro" is not a very meaningful term in this context. • Applying Microservices is more about building "cloud-native" 12-factor applications that can be run on cloud platforms (where servers are cattle and not pets). © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 36. Recommendations • Big monolithic systems cause trouble - don't let any single code base become too large. • Split your system in modules and gradually migrate from a monolith, to vertical slices, then to self contained systems and/or microservices. Refine as you go. • Split the database too. Don't share the database since it usually leads to a monolith. • Build "cloud native" systems and 12-factor apps. Use Spring Cloud and Reactor that contains helpers for this way of building applications. Functional reactive programming with Reactive Streams is a way to handle complexity and reduce coupling in certain use cases. It's not only about scaling to masses. © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 37. • Learn Domain Driven Design and the Bounded Context. • http://martinfowler.com/bliki/BoundedContext.html http://www.slideshare.net/adriancockcroft/dockercon-state-of-the-art-in-microservices/43
  • 38. Strategic design Not all of a large system will be well designed. Some or none will be. -Eric Evans © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 39. Why is Domain Driven Design important? Success developing useful models comes down to three points. 1. Sophisticated domain models are achievable and worth the trouble. 2. They are seldom developed except through an iterative process of refactoring, including close involvement of the domain experts with developers interested in learning about the domain. 3. They may call for sophisticated design skills to implement and to use effectively. source: Eric Evans: Domain Driven Design You can only achieve "bounded contexts" or "vertical slices" with proper design. Microservices are really about building in this style. See Kent Beck's blog article "To Design or Not To Design? A Third Good Question" from 2009, http://www.threeriversinstitute.org/blog/?p=338 gives good insight. © 2014 Pivotal Software, Inc. All rights reserved. ‹#›
  • 40. As a software developer, choose your battles and fight for what actually matters. -Me just know Write software that matters. -Dan North Q&A @lhotari lhotari@pivotal.io © 2014 Pivotal Software, Inc. All rights reserved. ‹‹#››

Editor's Notes

  • #11: “Another challenge with using the microservice architecture is deciding at what point during the lifecycle of the application you should use this architecture. When developing the first version of an application, you often do not have the problems that this architecture solves. Moreover, using an elaborate, distributed architecture will slow down development. Later on, however, when the challenge is how to scale and you need to use functional decomposition, then tangled dependencies might make it difficult to decompose your monolithic application into a set of services.”
  • #24: reason for layering is isolating change and minimizing ripple effects Eric Evans says that comprehension of the design is still higher priority than don't let tdd drive your design - implementation details shouldn't be published to the outside world since it adds coupling and makes it harder to change these details later on.