There are only 3 operations in a web app
-
Upload
simon-smith -
Category
Technology
-
view
48 -
download
0
description
Transcript of There are only 3 operations in a web app
![Page 1: There are only 3 operations in a web app](https://reader036.fdocuments.us/reader036/viewer/2022062710/559706d71a28ab932f8b456a/html5/thumbnails/1.jpg)
There are only 3
operations in a web
application (or maybe 2)
![Page 2: There are only 3 operations in a web app](https://reader036.fdocuments.us/reader036/viewer/2022062710/559706d71a28ab932f8b456a/html5/thumbnails/2.jpg)
Worked on lots of web applications
Seems to be lots of attempts at the same
problems
Typically non-SOLID solutions
History
![Page 3: There are only 3 operations in a web app](https://reader036.fdocuments.us/reader036/viewer/2022062710/559706d71a28ab932f8b456a/html5/thumbnails/3.jpg)
Without SOLID web applications are
Difficult to maintain
Buggy
Difficult to scale
History
![Page 4: There are only 3 operations in a web app](https://reader036.fdocuments.us/reader036/viewer/2022062710/559706d71a28ab932f8b456a/html5/thumbnails/4.jpg)
As any other application
Identify the entities
Identify the operations these entities execute
Back to basics
![Page 5: There are only 3 operations in a web app](https://reader036.fdocuments.us/reader036/viewer/2022062710/559706d71a28ab932f8b456a/html5/thumbnails/5.jpg)
Web applications have lots of entities
Customer … Order … Hotel … Basket … Page
… Section … SubSection … etc.
Back to basics
![Page 6: There are only 3 operations in a web app](https://reader036.fdocuments.us/reader036/viewer/2022062710/559706d71a28ab932f8b456a/html5/thumbnails/6.jpg)
However the stateless nature of the web
plus user expectations lead to …..
Back to basics
![Page 7: There are only 3 operations in a web app](https://reader036.fdocuments.us/reader036/viewer/2022062710/559706d71a28ab932f8b456a/html5/thumbnails/7.jpg)
… A limited number of operations
1. Find 0 or more entities
2. Add a new entity
3. Change an entity
The big idea.
![Page 8: There are only 3 operations in a web app](https://reader036.fdocuments.us/reader036/viewer/2022062710/559706d71a28ab932f8b456a/html5/thumbnails/8.jpg)
… A limited number of operations
1. Find 0 or more entities
2. Add a new entity
3. Change an entity
Sometimes combined into a ‘Crupdate’
The big idea.
![Page 9: There are only 3 operations in a web app](https://reader036.fdocuments.us/reader036/viewer/2022062710/559706d71a28ab932f8b456a/html5/thumbnails/9.jpg)
Sign up? Add item to basket? Log error?
Add new entity
Login? Get Hotel Details? View sale items ?
Find 0 or more entities
Update password?
Change an entity
The big idea.
![Page 10: There are only 3 operations in a web app](https://reader036.fdocuments.us/reader036/viewer/2022062710/559706d71a28ab932f8b456a/html5/thumbnails/10.jpg)
So … can we make a framework that
abstracts away all the common parts of
these operations, allowing us to produce
SOLID software with the minimum of
changes?
The big idea
![Page 11: There are only 3 operations in a web app](https://reader036.fdocuments.us/reader036/viewer/2022062710/559706d71a28ab932f8b456a/html5/thumbnails/11.jpg)
So … can we make a framework that
abstracts away all the common parts of
these operations, allowing us to produce
SOLID software with the minimum of
changes? ….. MAYBE?
The big idea
![Page 12: There are only 3 operations in a web app](https://reader036.fdocuments.us/reader036/viewer/2022062710/559706d71a28ab932f8b456a/html5/thumbnails/12.jpg)
How about creating a suite of “Micro
services” for each entity.
The service contains all the (validation)
business logic for the entity, returning the
results in a consistent way. ….
The big idea.
![Page 13: There are only 3 operations in a web app](https://reader036.fdocuments.us/reader036/viewer/2022062710/559706d71a28ab932f8b456a/html5/thumbnails/13.jpg)
These micro services can only be reached
through a message, making them fully
decoupled from the consuming application.
The big idea.
![Page 14: There are only 3 operations in a web app](https://reader036.fdocuments.us/reader036/viewer/2022062710/559706d71a28ab932f8b456a/html5/thumbnails/14.jpg)
A POCO class whose single responsibility is
to transmit information between the
provider and the producer
The Message
![Page 15: There are only 3 operations in a web app](https://reader036.fdocuments.us/reader036/viewer/2022062710/559706d71a28ab932f8b456a/html5/thumbnails/15.jpg)
![Page 16: There are only 3 operations in a web app](https://reader036.fdocuments.us/reader036/viewer/2022062710/559706d71a28ab932f8b456a/html5/thumbnails/16.jpg)
![Page 17: There are only 3 operations in a web app](https://reader036.fdocuments.us/reader036/viewer/2022062710/559706d71a28ab932f8b456a/html5/thumbnails/17.jpg)
A POCO class whose sole responsibility is to
update the state of the message.
Simple to test.
Simple to read.
Only place for business logic.
The Message Processor
![Page 18: There are only 3 operations in a web app](https://reader036.fdocuments.us/reader036/viewer/2022062710/559706d71a28ab932f8b456a/html5/thumbnails/18.jpg)
![Page 19: There are only 3 operations in a web app](https://reader036.fdocuments.us/reader036/viewer/2022062710/559706d71a28ab932f8b456a/html5/thumbnails/19.jpg)
![Page 20: There are only 3 operations in a web app](https://reader036.fdocuments.us/reader036/viewer/2022062710/559706d71a28ab932f8b456a/html5/thumbnails/20.jpg)
Can be consumed by any .net framework.
As there is no business logic consuming is
simple.
Every message is consumed in the same
way, so consuming code follows a similar,
simple pattern.
Consuming with MVC
![Page 21: There are only 3 operations in a web app](https://reader036.fdocuments.us/reader036/viewer/2022062710/559706d71a28ab932f8b456a/html5/thumbnails/21.jpg)
![Page 22: There are only 3 operations in a web app](https://reader036.fdocuments.us/reader036/viewer/2022062710/559706d71a28ab932f8b456a/html5/thumbnails/22.jpg)
● Normalising code to its common
components reduces repeated code.
● Normalising code to its common
components reduces the amount of code
needed.
● Normalising code to its common
components encourages SOLID software.
Epilogue
![Page 23: There are only 3 operations in a web app](https://reader036.fdocuments.us/reader036/viewer/2022062710/559706d71a28ab932f8b456a/html5/thumbnails/23.jpg)
Questions...