Aesthetics and the Beauty of an Architecture
-
Upload
tom-scott -
Category
Technology
-
view
289 -
download
2
description
Transcript of Aesthetics and the Beauty of an Architecture
![Page 1: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/1.jpg)
Aesthetics & the Beauty of an Architecture
Tom Scott @tomwscott
Adventures in CQRS & Event Sourcing
![Page 2: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/2.jpg)
What’s in it for you?
• Understanding of CQRS & Event Sourcing in the wild
• The mistakes we made…
• … the lessons we learnt …
• … and why we’re still happy!
rob.knight
![Page 3: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/3.jpg)
art 1 |ɑːt| noun 1 [ mass noun ] the expression or application of human creative skill and imagination, typically in a visual form such as painting or sculpture, producing works to be appreciated primarily for their beauty or emotional power
![Page 4: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/4.jpg)
art 1 |ɑːt| noun 1 [ mass noun ] the expression or application of human creative skill and imagination, typically in a visual form such as painting or sculpture, producing works to be appreciated primarily for their beauty or emotional power
![Page 5: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/5.jpg)
Aesthetics
![Page 6: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/6.jpg)
Scott’s Purely Arbitrary Criteria, Etceteras
For Evaluating Beautiful Architectures
Etceteras
Aesthetics
#SPACE_FEBA
![Page 7: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/7.jpg)
Fully Operational
![Page 8: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/8.jpg)
Simplicityecherries
![Page 9: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/9.jpg)
Commitmentjustageek
![Page 10: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/10.jpg)
Deferring Commitmentjustageek
![Page 12: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/12.jpg)
Discipline & Consistency
![Page 13: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/13.jpg)
Serendipity
kathryn_rotondo
![Page 14: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/14.jpg)
• Fully Operational
• Simplicity
• Deferred Commitment
• Metaphor
• Discipline
• Serendipity
#SPACE_FEBA
![Page 15: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/15.jpg)
Price Comparison
!"
####
$
$
% $
$
&
££
![Page 16: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/16.jpg)
The evolution of a system
'
%
|
Presentation
Application
Database
)*+
![Page 17: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/17.jpg)
The Solution
archer10
![Page 18: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/18.jpg)
Architectural Goals
• Structured
• Horizontal Scalability
• Availability & Reliability
• Visibility / Monitorability
• Flexibility & Replaceability
archer10
![Page 19: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/19.jpg)
The Mandate!
• Service Oriented Architecture
• Domain Driven Design
• Micro-Services
• Continuous Delivery
• Oh and one more thing!
archer10
![Page 20: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/20.jpg)
Domain Driven Design
• Entity
• Value Object
• Aggregate
• Service
• Repository
• Factory
• Bounded Context
archer10
![Page 21: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/21.jpg)
Domain Driven Design
archer10
• Entity
• Value Object
• Aggregate
• Service
• Repository
• Factory
• Bounded Context
![Page 22: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/22.jpg)
%
'
Service Oriented Architecture
% % ''
![Page 23: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/23.jpg)
% '
Understand your Domain
!
####Home
JourneyPanel Quote
Engine
% % ''
"
Risk Enquiry Provider Quote
![Page 24: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/24.jpg)
The End??
![Page 25: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/25.jpg)
Just one more thing…http://m.cdn.blog.hu/ke/kedvessigmund/image/columbo.jpg
![Page 26: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/26.jpg)
CQRS & Event Sourcing
• CQRS or “Why do we use the same schema for reads and writes?”
• Event Sourcing or “Why do we allow ORMs to dictate our object model?”
archer10
![Page 27: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/27.jpg)
CQRS
![Page 28: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/28.jpg)
Command Query Responsibility Segregation
,
, ,
, ,write
}read
}
![Page 29: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/29.jpg)
UPDATE Address SET number = 10, street = ‘Downing Street’, city = ‘London’, postcode = ‘SW1A 2AA’ WHERE _id = ‘590b9902’
{ “_id” : “590b9902”, “event” : “PolicySpecified”, “data” : { “type” : “ContentsInsurance”, “excess” : 750 } }
{ “_id” : “590b9902”, “event” : “AddressModified”, “data” : { “number” : 10, “street” : “Downing Street”, “city” : “London”, “postcode” : “SW1A 2AA” } }
Use SQL?
-
,./
%
/
/ / / / /
![Page 30: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/30.jpg)
public class Customer : AggregateRoot { private readonly Guid id; ! private Address currentAddress; // Business Logic public void ChangeAddress(Address newAddress) { if (newAddress.IsValid()) { Raise(new AddressModified(id, newAddress)); } } ! // State Transition public void Apply(AddressModified @event) { currentAddress = @event.Address; } !! ...... !! // Business Logic public void SpecifyCommunicationPreferences(CommunicationPrefs preferences) { Raise(new CommunicationPreferencesSpecified(id, preferences));
Event Sourcing (C#)
![Page 31: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/31.jpg)
Eventual Consistency
% '
!
-
,.
/ / / / /
POST /risk/new GET /risk/590b9902:v1
/
HTTP/1.1 302 !Location: /risk/590b9902:v1
0
![Page 32: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/32.jpg)
What we ended up with:% '-
% '-
% '-
% '-
% '-
# # # # # # # # # #
)* +
1
2 % '-
2% '-
2
![Page 33: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/33.jpg)
The Conclusion
tim_norris
![Page 34: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/34.jpg)
Fully Operational
Simple
Commitment
Metaphor
Discipline
Serendipity
3 +?
3?3
![Page 35: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/35.jpg)
The Power!
public class Customer : AggregateRoot { private readonly Guid id; ! private Address currentAddress; ! public void ChangeAddress(Address newAddress) { Raise(new AddressModified(id, newAddress)); } ! public void Apply(AddressModified @event) { currentAddress = @event.Address; } }
![Page 36: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/36.jpg)
The Power! public class Customer : AggregateRoot { private readonly Guid id; ! private Address currentAddress; ! public void ChangeAddress(Address newAddress) { if (currentAddress.IsSignificantlyDifferentFrom(newAddress)) { Raise(new CustomerMoved(id, newAddress)); } else { Raise(new AddressModified(id, newAddress)); } } ! public void Apply(CustomerMoved @event) { currentAddress = @event.Address; } ! public void Apply(AddressModified @event) { currentAddress = @event.Address; } }
![Page 37: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/37.jpg)
The Flexibility!
var connection = rabbit.createConnection({ url: ‘amqp://localhost:5672' }) !connection.on('ready', function () { console.info('Connected'); exchange = connection.exchange('SOURCE:Exchange', { 'type': 'topic', durable: true }, function () { var queue = connection.queue('PROJECTION:Map', { durable: false, exclusive: true }, function () { console.info("Joined Queue"); queue.subscribe(function (message, headers, deliveryInfo) { var policyDetails = JSON.parse(message.data.toString()); io.sockets.emit('postcode', policyDetails.Address.Postcode); }); queue.bind(exchange.name, 'AddressDetailsSpecified'); }); queue.on('queueBindOk', function () { console.info('Bound queue to exchange'); }); }); !});
![Page 38: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/38.jpg)
Is it a silver bullet?
![Page 39: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/39.jpg)
rob.knight
Lessons Learnt
• Prefer simpler communication protocols
• Messaging == Push == Transient,
• HTTP == Pull == Permanent
• Difficult to evolve Domain Events
• Events as the system contract
![Page 40: Aesthetics and the Beauty of an Architecture](https://reader034.fdocuments.in/reader034/viewer/2022051513/5468945baf7959d8018b5f5d/html5/thumbnails/40.jpg)
Thank You!!
Tom Scott @tomwscott