modeling microservices

114
@aahoogendoorn MODELING MICROSERVICES Sander Hoogendoorn ditisagile.nl Mentoring Consulting Training Agile Software architecture Code

Upload: sander-hoogendoorn

Post on 08-Jan-2017

2.538 views

Category:

Software


4 download

TRANSCRIPT

Page 1: Modeling Microservices

@aahoogendoorn

MODELING MICROSERVICESSander Hoogendoornditisagile.nlMentoring ▪ Consulting ▪ Training ▪ Agile ▪ Software architecture ▪ Code

Page 2: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 2@aahoogendoorn

www.ditisagile.nl

Sander Hoogendoorn

Me Dad Mentor, trainer, software architect, programmer Books and +250 articles Keynotes and talks at +150 conferences

Work Owner ditisagile.nl CTO Klaverblad Insurances

Web www.sanderhoogendoorn.com www.smartusecase.com www.speedbird9.com @aahoogendoorn [email protected]

Page 3: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 3@aahoogendoorn

www.ditisagile.nl

Page 4: Modeling Microservices

@aahoogendoorn

MONOLITHS Hard to deliver, even harder to test and impossible to maintain

Page 5: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 5@aahoogendoorn

www.ditisagile.nl

WHO OF YOU HAS A SYSTEM THAT IS TOO BIGAND THAT YOU WOULD RATHER BREAK UP?

Page 6: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 6@aahoogendoorn

www.ditisagile.nl

Monoliths

Advantages A single (layered) architecture

A single technology stack

A single code base maintained by multiple teams

Disadvantages All parts are interconnected

Many other systems are connected to your system

Hard to change, hard to maintain

Long time between releases, thereby increasing risks

Slow innovation

Hard to move to newer technologies

Doesn’t scale very well

Product Account

Order Customer

Products Accounts

Orders Customers

Page 7: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 7@aahoogendoorn

www.ditisagile.nl

Dependencies will kill you

Page 8: Modeling Microservices

@aahoogendoorn

A BRIEF HISTORY OF COMPONENTS AND SERVICES

Page 9: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 9@aahoogendoorn

www.ditisagile.nl

Client server

Page 10: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 10@aahoogendoorn

www.ditisagile.nl

Component based development

Page 11: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 11@aahoogendoorn

www.ditisagile.nl

Service oriented architecture

Page 12: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 12@aahoogendoorn

www.ditisagile.nl

Microservices

Page 13: Modeling Microservices

@aahoogendoorn

MICROSERVICESBeyond the hype?

Page 14: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 14@aahoogendoorn

www.ditisagile.nl

Microservices. Beyond the hype?

Page 15: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 15@aahoogendoorn

www.ditisagile.nl

Gartner hype cycle

Page 16: Modeling Microservices

@aahoogendoorn

MICROSERVICESThe clear benefits

Page 17: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 17@aahoogendoorn

www.ditisagile.nl

BUT FIRST… A DEFINITION

Page 18: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 18@aahoogendoorn

www.ditisagile.nl

In short, the microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API.

These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages

and use different data storage technologies.Martin Fowler

Page 19: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 19@aahoogendoorn

www.ditisagile.nl

In short, the microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API.

These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages

and use different data storage technologies.Martin Fowler

Page 20: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 20@aahoogendoorn

www.ditisagile.nl

Monoliths. Scalability

Product Account

Order Customer

Product Account

Order Customer

Product Account

Order Customer

Page 21: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 21@aahoogendoorn

www.ditisagile.nl

Microservices. Scalability

Product Account

OrderCustomer

Page 22: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 22@aahoogendoorn

www.ditisagile.nl

Microservices. Scalability

Product Account

OrderCustomer

Product

CustomerCustomer Customer

Account Account

Page 23: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 23@aahoogendoorn

www.ditisagile.nl

Microservices. Scalability & containers

Product Account

Order

Product

Customer

Account Account

CustomerCustomer

Page 24: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 24@aahoogendoorn

www.ditisagile.nl

Monoliths. Persistence

Product Account

Order Customer

Products Accounts

Orders Customers

Page 25: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 25@aahoogendoorn

www.ditisagile.nl

Microservices. Polyglot persistence

Product Account OrderCustomer

MongoDB

Customers

MongoDB

Orders

Active Directory

Accounts

Oracle

Products

Page 26: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 26@aahoogendoorn

www.ditisagile.nl

Microservices. Promises

Products not projects

Scalable

Decentralized governance

Replaceable parts

High performance

Technology independent

Polyglot persistence

Easy to build

Easy to test

Easier deployment than monoliths

ProductAccount

Order

Customer

Page 27: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 27@aahoogendoorn

www.ditisagile.nl

Microservices. But…

What is a microservice exactly?

How small is a microservice?

Requirements in a microservice world

Components or services

Who owns a microservice?

What technologies do you use?

What protocols do you apply?

How to define messages

How to test microservices

How to coordinate when business services run across components?

How to build deployment pipelines?

ProductAccount

Order

Customer

Page 28: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 28@aahoogendoorn

www.ditisagile.nl

Opinions, opinions, opinions

Page 29: Modeling Microservices

@aahoogendoorn

ARE MICROSERVICESA STAIRWAY TO HEAVEN?

Page 30: Modeling Microservices

@aahoogendoorn

OR A HIGHWAY TO HELL?

Page 31: Modeling Microservices

@aahoogendoorn

A REAL WORLD CASE

Page 32: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 32@aahoogendoorn

www.ditisagile.nl

A major insurance company

Page 33: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 33@aahoogendoorn

www.ditisagile.nl

A major insurance company

We have Most functionality on an expensive mainframe

A wide variety of large systems written in Java that are hard to maintain and to test, and that are very hard to replace

Individual systems that cover large areas of functionality, usually coupled to departments

Aging technology

No mobile strategy, allowing for new business or new services to clients, and intermediaries

We need to Get rid of the mainframe

Shorten time-to-market

Lower TCO

Uphold a fully secure systems landscape

Page 34: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 34@aahoogendoorn

www.ditisagile.nl

Where do we come from?

Page 35: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 35@aahoogendoorn

www.ditisagile.nl

Where do we come from?

Page 36: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 36@aahoogendoorn

www.ditisagile.nl

Outsourcing didn’t work

Page 37: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 37@aahoogendoorn

www.ditisagile.nl

Where do we go?

Page 38: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 38@aahoogendoorn

www.ditisagile.nl

FOR THE THINGS WE HAVE TO LEARN BEFORE WE CAN DO THEM, WE LEARN BY DOING THEM

Aristotle

Page 39: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 39@aahoogendoorn

www.ditisagile.nl

MICROSERVICES REQUIRE AN EVOLUTIONARY ARCHITECTURE

Page 40: Modeling Microservices

@aahoogendoorn

START WITH SOME GUIDING PRINCIPLES

Page 41: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 41@aahoogendoorn

www.ditisagile.nl

Questions, questions, questions

Communication architecture. The glueHow do we define interfaces between apps and component? How do we arrange messaging?

How do we glue together rapidly changing apps and component?

Application architectureEnd user facing Different users, different fast evolving needs

Which technology is the best for which purpose?

Component architectureComponents and services are evolving rapidly. How do we decide which components we need? How do we deal with versioning? How do we deal with distributed processes and transactions?

Page 42: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 42@aahoogendoorn

www.ditisagile.nl

Case. Guiding principles

We decided to go from here Client thinks in business processes, so we implement

business processes We move away from the mainframe, to a new systems

landscape, consisting of micro-applications and micro-components

Requirements and documentation are modeled rather than written

Applications implement a single (elementary) business process

Components serve a single purpose and offer services Applications and components all have their own bounded

context – a domain model Applications and components will have an similar internal

software architecture to facilitate ease of maintenance and allow for harvesting re-use

Communication between applications and components will use a simple open protocol - REST

Page 43: Modeling Microservices

@aahoogendoorn

APPLICATIONS

Page 44: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 44@aahoogendoorn

www.ditisagile.nl

Presentation

Process

Domain

Services

Outside world

PagesGrids / Panels, Controls

Use casesFlow

Domain objects, Factories / RepositoriesEnums / Value objects / Tupels / Reference objects

Service gateways, Service clientsInfo objects / Search objects

ComponentsRelations Dossiers Intermediaries Accounts Rates

Page 45: Modeling Microservices

@aahoogendoorn

COMPONENTS

Page 46: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 46@aahoogendoorn

www.ditisagile.nl

Service interface

Process

Domain

Data / Services

Outside world

ResourcesRepresentations

Use casesFlow

Domain objects, Factories / RepositoriesEnums / Value objects / Tupels / Reference objects

Storage gateways, Storage clientsInfo objects / Search objects

StorageRelations Dossiers Intermediaries DB2 MongoDB

Page 47: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 47@aahoogendoorn

www.ditisagile.nl

NOW WHAT DOES ALL THIS HAVE TO DO WITH MODELING?

Page 48: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 48@aahoogendoorn

www.ditisagile.nl

DOING BIG UP-FRONT DESIGN IS DUMBDOING NO DESIGN IS EVEN DUMBER

Dave Thomas

Page 49: Modeling Microservices

@aahoogendoorn

BUSINESS PROCESSES FIRST

Page 50: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 50@aahoogendoorn

www.ditisagile.nl

Different levels of processes (and requirements)

Page 51: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 51@aahoogendoorn

www.ditisagile.nl

A high-level business process

Step 1 Step 2 Step 3 Step 4 Step 5

Page 52: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 52@aahoogendoorn

www.ditisagile.nl

Split into work processes

Step 3.1 Step 3.2 Step 3.3 Step 3.4

Step 3

Page 53: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 53@aahoogendoorn

www.ditisagile.nl

Split into elementary processes - OTOPOP

Step 3.3.1 Step 3.3.2 Step 3.3.3 Step 3.3.4

Step 3.3

Step 3.3.5

Page 54: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 54@aahoogendoorn

www.ditisagile.nl

Smart use cases

Modeling applications

Each elementary process is implemented in a single application

The requirements are modeled using smart use cases

Each application consists of a single sea-level use case and a number of fish-level use cases

Additionally we add the services that are required to implement the applications to the model

Doing so, we can easily do impact mapping on our services

Also, the smart use cases form a strong foundation for integration testing

Page 55: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 55@aahoogendoorn

www.ditisagile.nl

Different levels of use cases

Traditionaluse cases

Smartuse cases

Format Textual Visual

Granularity Different Unified

Estimate Hard Easy

Unit of work Lousy Good

Reuse Incidental Normal

Traceability Possible Normal

Testability Poor Good

Page 56: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 56@aahoogendoorn

www.ditisagile.nl

Smart use cases

Page 57: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 57@aahoogendoorn

www.ditisagile.nl

57Smart use cases

Page 58: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 58@aahoogendoorn

www.ditisagile.nl

Wireframes with use cases

Page 59: Modeling Microservices

@aahoogendoorn

MODULAR DESIGN / DESIGNING MICROSERVICES

Page 60: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 60@aahoogendoorn

www.ditisagile.nl

Single responsibility principle (SRP)

SOLID Single Responsibility Principle

Open Closed Principle

Liskov Substituion Principle

Interface Segregation Principle

Dependency Inversion Principle

Single Responsibility Principle Every module should have responsibility over a single part of the

functionality provided by the software,

That responsibility should be entirely encapsulated by the class

All its services should be narrowly aligned with that responsibility

Therefore Group together things that change together

Separate things that change for different reason

Page 61: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 61@aahoogendoorn

www.ditisagile.nl

Bounded context

Domain driven design The paradigm of designing software based on models

of the underlying domain

The domain model helps the business and the developers to reason about the functionality

A model needs to be unified – internally consistent without contradictions

Bounded context The bounded context is a central pattern in domain

driven design

When you model larger domains, it becomes progressively harder to create this single unified model

So, instead of creating a single unified model, you create several, all valid within their bounded context

Page 62: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 62@aahoogendoorn

www.ditisagile.nl

The single unified domain model

Product

Vendor

StockOrder

Client

Delivery

Payment

Page 63: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 63@aahoogendoorn

www.ditisagile.nl

Bounded contexts

Product

Vendor

StockOrder

Client

Delivery

Payment

Product

Page 64: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 64@aahoogendoorn

www.ditisagile.nl

Bounded contexts

Modeling Modeled in a (single) domain model

Model contains entities, domain objects

Usually evolves around a single main entity (aggregate root)

Services Interrogate the bounded context

Resources usually follow the aggregate root

Services post and put representations

Representations are mapped to the bounded context

Validation Representations can be validated before being mapped

Bounded context can be validated as a whole e.g. before storing

Business rules

Properties and property types

Product

Vendor

Stock

Page 65: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 65@aahoogendoorn

www.ditisagile.nl

Properties and property types

Basic types string, integer, date, datetime Include nullable wrapping

Enumerations Set up at design time, unchangeable at run-time Genders, Categories

Value objects No specific instances Isbn, Email, Url, Money

References (code tables) Changeable at run-time, such as contract types

Associations To cached entities such as Country, Nationality To first level citizens such as Customer, Product

Page 66: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 66@aahoogendoorn

www.ditisagile.nl

66

Every application,worker and componenthas its own bounded context

Page 67: Modeling Microservices

@aahoogendoorn

AND THE REST ISCOMMUNICATION (OVER HTTP)

Page 68: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 68@aahoogendoorn

www.ditisagile.nl

HTTP RETURN CODES CHEAT SHEET1**. Hold on

2**. Here you go 3**. Go away

4**. You fucked up 5**. I fucked up

Page 69: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 69@aahoogendoorn

www.ditisagile.nl

HTTP GET

GET

Retrieve whatever information is identified by the request URI in the form of an entity

The entity is usually a single or a list of objects (of the type provided by the service, often JSON, or XML)

GET is safe (retrieval only) and idempotent

Unfortunately there are many ways of creating GET requests (see examples below)

Returns 200 (found), possibly 400 (bad request) or 404 (not found)

Examples

Get an entire collectionlocalhost:8080/countries

Find objects in the collectionlocalhost:8080/countries?name=“stan”

Find an object in the collection by IDlocalhost:8080/countries/38

Find a sub-object in the collection by IDlocalhost:8080/countries/38/capital

Find object in the collection by ISOlocalhost:8080/countries?isocode=“GRC”

Find object in the collection by ISOlocalhost:8080/countries/isocode/GRC

Find object in the collection by ISOlocalhost:8080/countries/GRC

Page 70: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 70@aahoogendoorn

www.ditisagile.nl

HTTP POST

POST

Request that the server accepts the entity enclosed in the request as a new subordinate of the resource identified by the request URI

The posted entity is subordinate to that URI in the same way that a file is subordinate to a directory containing it

Returns the location header for the new resource, possibly with created entity in the body

Returns 201 (created), possibly 500 (server error)

Examples

Post to the collection (with entity in body)localhost:8080/countries

Returning location headerlocalhost:8080/countries/38

Page 71: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 71@aahoogendoorn

www.ditisagile.nl

HTTP PUT

PUT

Requests that the enclosed entity is stored under the supplied request URI

If the request URI refers to an existing resource, the enclosed entity is an modified version of the resource

POST identifies the resource that will handle the enclosed entity

PUT identifies the entity enclosed with the request

Returns 200 or 204 (when resource is modified), possibly 201 (if a resource is created), possibly 500 (server error)

Examples

Put with ID (with entity in body)localhost:8080/countries/38

Update capital (with entity in body)localhost:8080/countries/38/capital

Page 72: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 72@aahoogendoorn

www.ditisagile.nl

HTTP DELETE

DELETE

Requests that the resource identified by the request URI is deleted.

Returns 200 or 204 (when resource is deleted), possibly 500 (server error)

Examples

Deletelocalhost:8080/countries/38

Page 73: Modeling Microservices

@aahoogendoorn

MODELING RESOURCES

Page 74: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 74@aahoogendoorn

www.ditisagile.nl

Modeling resources

Root resources (component)/qa

/questionnaires

GET

Questionnaire

Id, Name, Description

/qa

GET the collection, but only limited to this representation (but with locations likely)/qa/questionnaires

/questionnaires

GET

/{id}Questionnaire

Id, Name, Description

Question

Type, Name, Description

Answer

Name, Value

GET a single item from the collection, but with representation/qa/questionnaires/334532

Page 75: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 75@aahoogendoorn

www.ditisagile.nl

75Resource model

Page 76: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 76@aahoogendoorn

www.ditisagile.nl

76Service use cases

Page 77: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 77@aahoogendoorn

www.ditisagile.nl

77Component bounded context

Page 78: Modeling Microservices

@aahoogendoorn

TESTING MICROSERVICES

Page 79: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 79@aahoogendoorn

www.ditisagile.nl

A service development lifecycle

Code Developer Test Test Integration Test Acceptance Test LivePrepare & Design

Page 80: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 80@aahoogendoorn

www.ditisagile.nl

What to test

Code Developer Test Test Integration Test Acceptance Test LivePrepare & Design

DevelopersUnit tests

DevelopersQ & A

TestersScenario’s & API’s

TestersScenario’s & API’s

Product ownerProduct

Page 81: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 81@aahoogendoorn

www.ditisagile.nl

Even though you might have brilliant testers

Page 82: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 82@aahoogendoorn

www.ditisagile.nl

… please automate your tests

Code Developer Test Test Integration Test Acceptance Test LivePrepare & Design

DevelopersUnit tests

DevelopersQ & A

TestersScenario’s & API’s

TestersScenario’s & API’s

Product ownerProduct

Page 83: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 83@aahoogendoorn

www.ditisagile.nl

Developer Q&A Sonarqube

Page 84: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 84@aahoogendoorn

www.ditisagile.nl

Developer Q&A Sonarqube

Page 85: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 85@aahoogendoorn

www.ditisagile.nl

Developer Q&A Sonar

Page 86: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 86@aahoogendoorn

www.ditisagile.nl

Presentation

Process

Domain

Services

Outside world

PagesGrids / Panels, Controls

Use casesFlow

Domain objects, Factories / RepositoriesEnums / Value objects / Tupels / Reference objects

Service gateways, Service clientsInfo objects / Search objects

ComponentsRelations Dossiers Intermediaries Accounts Rates

Integration testsBDD & Selenium

Unit tests

Unit tests

Unit tests

Page 87: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 87@aahoogendoorn

www.ditisagile.nl

Service interface

Process

Domain

Data / Services

Outside world

ResourcesRepresentations

Use casesFlow

Domain objects, Factories / RepositoriesEnums / Value objects / Tupels / Reference objects

Storage gateways, Storage clientsInfo objects / Search objects

StorageRelations Dossiers Intermediaries DB2 MongoDB

Integration testsUsing BDD

Unit tests

Unit tests

Unit tests

Page 88: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 88@aahoogendoorn

www.ditisagile.nl

WHAT ABOUT BEING INDEPENDENTLY DEPLOYABLE?

Page 89: Modeling Microservices

@aahoogendoorn

DEPLOYING MICROSERVICESContinuous integration, build pipelines and continuous delivery

Page 90: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 90@aahoogendoorn

www.ditisagile.nl

A typical build pipeline

Code Developer Test Test Integration Test Acceptance Test LivePrepare & Design

Page 91: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 91@aahoogendoorn

www.ditisagile.nl

ProductionAcceptanceIntegrationTestDevelopment

A typical build pipeline

Code Developer Test Test Integration Test Acceptance Test LivePrepare & Design

Page 92: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 92@aahoogendoorn

www.ditisagile.nl

Build pipelines in Jenkins

Page 93: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 93@aahoogendoorn

www.ditisagile.nl

Microservices. Building a deployment pipeline

Code Developer Test Test Acceptance Test Acceptance Live

Code Developer Test Test Acceptance Test Acceptance Live

Code Developer Test Test Acceptance Test Acceptance Live

Code Developer Test Test Acceptance Test Acceptance Live

Page 94: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 94@aahoogendoorn

www.ditisagile.nl

Microservices. Pipeline hell?

Code v.2 Developer Test v.2 Test v.2 Acceptance Test v.2 Acceptance v.2

Code Developer Test Test Acceptance Test Acceptance Live

Test v.2 Acceptance Test v.2 Acceptance v.2 Live v.2

Developer Test Test Acceptance Test Acceptance Live

Code v.3 Developer Test v.3

Live

Code v.2

Page 95: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 95@aahoogendoorn

www.ditisagile.nl

Dealing with breaking changes

Customer

v1

App1 App2

Customer

v1

App1 App2

v2

Customer

v1

App1 App2

v2

Customer

App1 App2

v2

Page 96: Modeling Microservices

@aahoogendoorn

DO WE REALLY NEED PROJECTS?From projects to releases to continuous delivery

Page 97: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 97@aahoogendoorn

www.ditisagile.nl

Do we really need projects?

Page 98: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 98@aahoogendoorn

www.ditisagile.nl

Planning?

Page 99: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 99@aahoogendoorn

www.ditisagile.nl

Or roadmap?

Page 100: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 100@aahoogendoorn

www.ditisagile.nl

Minimal viable product

Page 101: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 101@aahoogendoorn

www.ditisagile.nl

Maintenance

From projects to continuous delivery?

Project

MaintenanceMVP

MaintenanceContinuous delivery

Page 102: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 102@aahoogendoorn

www.ditisagile.nl

Moving towards DevOps is not easy

Page 103: Modeling Microservices

@aahoogendoorn

Page 104: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 104@aahoogendoorn

www.ditisagile.nl

WORDLY WISDOM TEACHES US THAT IT IS BETTER FOR REPUTATION TO FAIL CONVENTIONALLY THAN TO SUCCEED UNCONVENTIONALLY

John Maynard Keynes

Page 105: Modeling Microservices

@aahoogendoorn

SOME LAST THOUGHTS

Page 106: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 106@aahoogendoorn

www.ditisagile.nl

Microservices are not for everyone

What are we going to benefit from the most?

Polyglot persistence?

Being able to multiple stacks?

Independentlydeployable?

Enforcemodular design?

ContinuousDelivery?

Page 107: Modeling Microservices

@aahoogendoorn10

7SCALING AGILE FROM THE GROUND UP

©2015 ditisagile.nl. All Rights Reserved

Work from roadmaps

Page 108: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 108@aahoogendoorn

www.ditisagile.nl

Minimal viable product

Page 109: Modeling Microservices

@aahoogendoorn

ALLOW THE TEAM TO LEARN CONTINUOUSLY…

Page 110: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 110@aahoogendoorn

www.ditisagile.nl

Will it work?

Page 111: Modeling Microservices

MICROSERVICES? STAIRWAY TO HEAVEN OR HIGHWAY TO HELL?©2015 ditisagile.nl. All Rights Reserved 111@aahoogendoorn

www.ditisagile.nl

The hockey stick model

Page 112: Modeling Microservices

@aahoogendoorn

… AND HAVE FUN

Page 113: Modeling Microservices

@aahoogendoorn

THIS IS AGILE

www.createspace.com/4747266

Password: agilescrum

Discount code: KGNWKKWG

Page 114: Modeling Microservices

@aahoogendoorn

www.sanderhoogendoorn.comwww.smartusecase.comwww.speedbird9.com

[email protected]

@aahoogendoorn

REFERENCES AND QUESTIONS