Slide 1

Slide 1 text

Erik Stok | Principal Software Developer | [email protected] | 29-11-2018

Slide 2

Slide 2 text

Erik Stok | Principal Software Developer | [email protected] | 2018-11-29

Slide 3

Slide 3 text

Agenda What you can expect ● Our back office system ● Our architecture ● Downsides to a monolith ● Approach to integrating services ● Testing ● Upsides/downsides to services

Slide 4

Slide 4 text

Our own website, built in-house

Slide 5

Slide 5 text

Our own customer service

Slide 6

Slide 6 text

Our own 9 stores

Slide 7

Slide 7 text

Our own stock and logistics

Slide 8

Slide 8 text

Our own delivery service

Slide 9

Slide 9 text

Our own back office, built in-house

Slide 10

Slide 10 text

Architecture Website Database Database Internet Data sync Back office services Back office services Classic back office

Slide 11

Slide 11 text

Architecture Website Database Database Internet Data sync Back office services Back office services Classic back office

Slide 12

Slide 12 text

Architecture Website Database Database Internet Data sync Back office services Back office services Classic back office

Slide 13

Slide 13 text

Monolith setup Back office Database

Slide 14

Slide 14 text

Application framework

Slide 15

Slide 15 text

Application framework Framework Application base Application functionality Generic Application generic Functionality (specific)

Slide 16

Slide 16 text

Monolith setup - business logic Back office Model View Controller Stored procedures Tables Triggers Database

Slide 17

Slide 17 text

Monolith setup - downsides Why move the monolith? ● Business logic in the client is not shared ● Business logic in the server does not scale well ● Events are hard to implement ● Everything is synchronous ● Testing is difficult

Slide 18

Slide 18 text

Making it service oriented Back office Model View Controller Stored procedures Tables Triggers Database Services Logic

Slide 19

Slide 19 text

Services - How to How we make services ● REST ● Discoverable through Swagger ● Feature toggle

Slide 20

Slide 20 text

Integrating a service - Approach 1 Back office View Controller Rest Service Database Model Service class Gateway ClientDataSet DataSet

Slide 21

Slide 21 text

Integrating a service - Approach 2 Back office View Controller Rest Service Database Model Service class Gateway ClientDataSet Repository

Slide 22

Slide 22 text

Integrating a service - Approach 3 Back office View Controller Rest Service Database Model Service class Gateway ClientDataSet

Slide 23

Slide 23 text

Integrating a service - Approach 1 What to build ● Create gateway (using OpenApi) ○ Create Api classes ○ Create gateway class ● Create feature toggle ● Create service class ● Make the model use the service class ○ Set up service class ○ Use service class based on toggle

Slide 24

Slide 24 text

Service upsides - Events Back office Database Services 3rd party system Event

Slide 25

Slide 25 text

Testing

Slide 26

Slide 26 text

Testing - Challenges How to get testing implemented ● REST Service can be tested ● Service class can be tested ● Mapper can be tested ● Repository integration tests ● Gateway integration tests ● Adjusting the framework for dependency injection

Slide 27

Slide 27 text

Downsides to services What are the downsides? ● Development setup becomes less easy ● Breaking contracts/versioning

Slide 28

Slide 28 text

Upsides to services Did we get rid of the downsides of the monolith? ● Business logic in the client can be moved to the service ● Business logic in the server can be moved to the service ● Events can be started from the service ● The service can operate asynchronous ● Testing of business logic is covered in the service

Slide 29

Slide 29 text

Erik Stok | Principal Software Developer | [email protected] | 2018-11-29