What is Software Architecture… Architectural Styles PV260 Software Quality 1 Ondřej “Ondra” Krajíček ondrej.krajicek@ysoft.com @OndrejKrajicek Architectural Styles Architectural Styles • Tiered Architecture • Hexagonal Architecture • Onion Architecture • Object Oriented Architecture • Service Oriented Architecture • Microservices Which one is the best one? • Consistency • Cohesion • Coupling • Clarity Cost of Change (a ff ected by technical debt) How can we measure technical debt? Principles over Patterns. Consistency Module, Data, Service, Interaction Dependencies. Coupling https://www.javatpoint.com/software-engineering-coupling-and-cohesion Well-Designed or Leaking Abstractions. Cohesion https://www.javatpoint.com/software-engineering-coupling-and-cohesion Everyone understands why, how and what to do. System deteriorates slower and technical debt does not grow quickly. Clarity Replaceable Architecture Wait, what? Osaka Castle Giza Pyramids • Built to last: hundreds and thousands of years. • Built to survive natural disasters, especially earthquakes (shinbashira). • Both have very different architecture. • You cannot replace one with the other. • Why would you? Replaceable as in Having rather low Cost of Change How to decrease Cost of Change? 2-Tier Architecture • Original Client / Server • Business Logic is implemented on the client, server or both. • What are the issues? 3-Tier Architecture • Decouple presentation from business logic. Business logic is isolated from client and server. • Business layer often historically hosted in application servers with obscure technologies (j2ee, Microsoft ASP, PHP, ColdFusion, etc.). • How is it di ff erent from 2-Tier? https://en.wikipedia.org/wiki/Multitier_architecture#/media/File:Overview_of_a_three-tier_application_vectorVersion.svg Onion Architecture • Built on the observation that most / all interfaces are alike. • Outer layers depend on inner layers. • Inner layers must not depend on outer layers. • Enforces Inversion of Control. • How is it di ff erent from N-Tier? Hexagonal Architecture • Ports and Adapters Architecture • Sometimes Onion and Hexagonal are viewed as the same. • Hexagonal Architecture is more explicit and structured. • Recommended reading:
 https://herbertograca.com/2017/11/16/ explicit-architecture-01-ddd-hexagonal- onion-clean-cqrs-how-i-put-it-all-together/ The Clean Architecture • Onion + Screaming Architecture. • Independent of Frameworks. • Testable: all parts and as a whole. • Independent of Interfaces. • Independent of the data store / database / object persistence. • Independent of any external impact. Microservices also known as the current silver bullet. https://www.cgl.ucsf.edu/Outreach/pc204/NoSilverBullet.html Organization structure determines system architecture / design. https://medium.com/@learnstu ff .io/conways-law-in-software- dev-3aa6324ead52 As the systems get larger, complexity grows quickly and systems become unmanageable. http://www.laputan.org/mud/mud.html#BigBallOfMud https://medium.com/raa-labs/part-1-domain-driven-design-like-a-pro-f9e78d081f10 • Split system in a set of loosely coupled, cohesive services. • Each service does only one thing and does it well. • Each service is represented only by its API. • Each service has its own data. Microservices https://medium.com/hashmapinc/the-what-why-and-how-of-a-microservices-architecture-4179579423a9 What are the challenges of Microservices? Compensating for high decentralisation. Patterns are emerging. API Gateway Pattern Thank you NETFLIX! https://microservices.io/patterns/apigateway.html Key Takeaways Architectural style is a choice driven by stakeholder values. Everyone talks about microservices, yet that does not make it the silver bullet.