soa guest lecture at diku by dr. rasmus petersen (dec 17 2015)

45
SERVICE ORIENTED ARCHITECTURE WHAT IS IT AND WHAT IS IT GOOD FOR? NETCOMPANY LECTURE SERIES 2015

Upload: rasmus-petersen

Post on 22-Jan-2018

365 views

Category:

Data & Analytics


0 download

TRANSCRIPT

Page 1: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

SERVICE ORIENTED ARCHITECTURE

WHAT IS IT AND WHAT IS IT GOOD FOR?

N E T C O M PA N Y L E C T U R E S E R I E S

2 0 1 5

Page 2: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

R AS M U S R O S E N Q V I S T P E T E R S E N

Page 3: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

(Dr.) Rasmus Rosenqvist Petersen

Consultant

Netcompany since August 2015(Ph.d. fra Syddansk Universitet, og senest 3 år i Cambridge, England)

Sector: Unions software

Technologies: Java/JEE and Microsoft .NET

Page 4: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

• Approx. 700+ consultants

– M.Sc. or Ph.D. typically from DTU, DIKU, ITU, ÅU, AAU, SDU

– Excel academically

• Offices in Copenhagen (HQ), Aarhus, Aalborg, Odense and Warszawa

• We deliver business-critical IT solutions

– Systems integration and SOA

– Portals

– Business applications

– Application and Facility Management

• Our customers include

– Financials Nordea, Saxo Bank, Letpension, PFA pension, FORCA, AP Pension

– Government KOMBIT, SKAT, Økonomistyrelsen, Undervisningsministeriet

– Industry Carlsberg, Dong Energy, Pandora

– Commerce Novozymes, Danmarks Apotekerforening

– Media JP/Politikens Hus, Aller

– Membership organizations IDA, HK, Dansk Erhverv

– Telco Telenor, TDC, Telmore

ABOUT NETCOMPANY

Page 5: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

WHAT I WILL TALK ABOUT

SOA:

• SOA Concepts

• Describing a Service

• Designing Services

Mixing in

• A few cases with questions :-)

Page 6: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

READY?

Page 7: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

S E R V I C E O R I E N T E D A R C H I T E C T U R E

Page 8: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

1

S O A C O N C E P T S

Page 9: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

C o n t r a c t - b a s e d

L o o s e c o u p l i n g

A b s t r a c t i o n Reusabi l i ty

AUTONOMY

D i scoverabi l i ty

S TAT E L E S S N E S S

Page 10: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

T H E H Y P E C Y C L E

Page 11: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

W H A T H A P P E N E D A F T E R 2 0 0 9 ?

Page 12: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

FIRST

SOA isn’t a technology.

Page 13: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

SECOND

SOA isn’t new.

SOA rests on centuries old principles.

…yes, centuries!

Page 14: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)
Page 15: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)
Page 16: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

B U S I N E S S S E R V I C E S

R E C E P T I O N

F I N A N C E

A C C O U N T I N G A R C H I V E

S A L E S

A D M I N I S T R A T I O N

Page 17: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

Business case: University of Copenhagen

• What are the products?

• What are the business services?

• (think in terms of service areas and units)

R E C E P T I O N

F I N A N C E

A C C O U N T I N G A R C H I V E

S A L E S

A D M I N I S T R A T I O N

Page 18: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

B U S I N E S S S E R V I C E S

ADMINISTRATION

SALES

ACCOUNTING

ARCHIVE

FINANCE

RECEPTION

Page 19: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

D E P E N D E N C I E S

SALES ACCOUNTINGOpen Account

Page 20: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

D E P E N D E N C I E S

ADMINISTRATION

SALES

ACCOUNTING

ARCHIVE

FINANCE

RECEPTION

Page 21: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

S E R V I C E D E S I G N P R I N C I P L E S

Page 22: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

S E R V I C E D E S I G N P R I N C I P L E S

S O U N D B U S I N E S S P R I N C I P L E S

Page 23: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

S O A

ADMINISTRATION

SALES

ACCOUNTING

ARCHIVE

FINANCE

RECEPTION

MODEL

Page 24: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

Case:EFI

Whatis EFI?

Page 25: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

Case: EFI

• 1.000.000.000 DKK investment lost

• Accenture: ”The worlds most complex system for tax debt

recovery” – if it had worked.

• No requirements specification (400 out of typically 5000)

• EFI tightly coupled to other system, DMI

• Two suppliers, delivering the two systems, as separate

projects

• Better to deal with two monopolies than one? No!

• SOA was used to tie the two systems together

• Why was that problematic?

http://www.version2.dk/artikel/derfor-gik-det-galt-efi-systemet-412139

Page 26: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

THIRD

SOA isn’t a dogma

Page 27: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

THIRD

SOA isn’t a dogma

Page 28: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

S O A M A N I F E S T O

www.soa-manifesto.org

P R I O R I T I E S

Business value over technical strategy

Strategic goals over project-specific benefits

Intrinsic interoperability over custom integration

Shared services over specific-purpose implementations

Flexibility over optimization

Evolutionary refinement over pursuit of initial perfection

G U I D I N G P R I N C I P L E S

Respect the social and power structure of the organization. Recognize that SOA ultimately demands change on many

levels. The scope of SOA adoption can vary. Keep efforts manageable and within meaningful boundaries. Products and

standards alone will neither give you SOA nor apply the service orientation paradigm for you. SOA can be realized

through a variety of technologies and standards. Establish a uniform set of enterprise standards and policies …

D E F I N I T I O N

Page 29: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

2

D E S C R I B I N G A S E R V I C E

Page 30: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

...a client who satisfies all the constraints listed is entitled to the benefits. This is the No Hidden Clause rule.The No Hidden Clauses principle does not prevent us from including references, implicit or explicit, to rules not physical part of the contract.

Computer, Vol. 25, No. 10. (1992), pp. 40-51.

A contract is a common agreement with benefits for all participants.

The Beatles’ first contract

A more recent contract

What is a contract?

Page 31: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

A real world example

Domain model from customer

Service description from customer

XML type definition

Java service implementation stub

Page 32: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

Complete vs loose contract

A complete contractParts of the contract differ in degree of detail/specificity. From more to less detail:

• Security model, infrastructure• Input / output complex types• Simpler xml types

• Normal behavior• Restrictions between optional elements• Expected business exceptions• Extreme behavior (e.g. no elements

found)

• Runtime exceptions (e.g. time out, full disk)

• Transactional integrity• Concurrency (even on www)

… is not always a possibilityTherefore, take great care in documenting the decisions made during implementation:

• Record changes, and the motivation for these

• Beware of other usages of type

• Detailed behavior in service description.• Restrictions between optional elements• Reuse exception types across services• Agree on common pattern for services

• Wrap in reusable exception types• Part of system architecture not service• Concurrency (even on www)

Page 33: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

“Contract first” vs “Code first”

• Higher detail level

• Code independent

• Greater Interoperability

• Built in governance

• Less detailed

• Developer oriented

• Easy to get started

• Easy to break contract

WSDL

Code

Code

Code

Page 34: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

Case: contract

• Complete elements? • Looser elements?

University Government

Student graduating

Money

Page 35: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

3

D E S I G N I N G S E R V I C E S

Page 36: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

Domain models and services

• Model your data tables directly from communication formats

• Don’t share physical types between internal and external services. Transformations in one system is easier than changing two systems.

• Loose coupling of systems

• Provide a global logic domain model as part of the contract, but leave external physical communication types flexible.

• Be aware that reuse of types between services is strong coupling

• Remember that services are used together. Output will be used as input by others.

Do’s Don'ts

Page 37: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

Simple and more complex services

Keeping results in memory is a problem with large result sets. Consider streaming services.

Two separate systems for vehicles and license plates and a proxy service for an external system with information about people.

Simple services for Create, Read, Update and Delete, but what about more complex services?

FindVehiclesWithPlateMatching(pattern) {FindPlates(pattern)For each plate

result +=ReadVehicle(VIN)return result;

}

RegisterVechicleToPersonAndAssignPlate(VIN, person) {

UpdateVehicle // ad owner

GetNextAvailablePlate

UpdatePlate // add VIN}

NotifyPoliceAboutExpiredPlates(startDate, endDate) {

GetAllExpiredPlates(startDate, endDate);

Foreach Plate

FindVehicle(VIN)

FindPersion(PersonID)

result += (Vehicle, Plate, Person)}

Issues with concurrency and transactional integrity

“Batch job as service” with join over web service per element and non-domain information (address).

Page 38: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

CRUD, Find or Process service?

• Filtering on fields and values

• Avoid joining over services

• Behavior for not found and large result sets.

Not all services are born alike!

Searching for entities via services

• On create, return assigned id

• Optional/required might differ in create and read.

• Update by sending changes or overwrite whole entity.

• Versioning on update can provide optimistic locking

• Keep old versions on update and delete operations

Create, Read, Update and Delete

• Sequences and available data (order of creation)

• Avoid joining over services

• Consider asynchronous patterns e.g. message queues

• Candidates for BPM

Processes in services

Bulk updates

• Avoid joining over services

• Let update services take a list of elements to update

Page 39: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

MESSAGE EXCHANGE PATTERNS

Consumer

Provider

S Y N C H R O N O U S A S Y N C H R O N O U S

Consumer

Provider

Consumer

Provider

Request/Response Request/Response One-way

Page 40: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

Question: Synchronous vs. asynchronous

• Positives? Negatives?

• Which is better for a service orientedarchitecture?

Consumer

Provider

S Y N C H R O N O U S A S Y N C H R O N O U S

Consumer

Provider

Consumer

Provider

Page 41: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

Synchronous = Poor scalability

Member Portal

CRM Service Pension Service Finance Service

Enterprise Service Bus

1

2 3 4

Wait time of 1 is the sum of 2, 3 and 4 plus ESB time.

Page 42: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

AN EFFECIENT SOA

IS

ASYNCHRONOUS

Page 43: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

S O A

I S H E R E T O

STAY!

Page 44: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

T H A T ’ S A L L !

Page 45: SOA guest lecture at DIKU by Dr. Rasmus Petersen (Dec 17 2015)

Q U E S T I O N S

?