Cloud Ready Design through Application Software Infrastructure

29
‘Cloud Ready’ Design through Application Software Infrastructure Florin Coros

Transcript of Cloud Ready Design through Application Software Infrastructure

Page 1: Cloud Ready Design through Application Software Infrastructure

‘Cloud Ready’ Design through

Application Software Infrastructure

Florin Coros

Page 2: Cloud Ready Design through Application Software Infrastructure

About me

Co-Founder@florincoros

Partner & Co-Founder

blog.iquarc.com/florin

Page 3: Cloud Ready Design through Application Software Infrastructure

Outdated Enterprise Software

3

Enterprise Software

Old Technologies

Costly to maintain

and update

Page 4: Cloud Ready Design through Application Software Infrastructure

Re-Implement on a Modern Architecture

Legacy System

• High costs to update

• Shetty UX

• Outdated functionalities

• Not scalable, not reliable

Modern System

• Accessible everywhere

• Actual technologies

• Good maintainability

4

Page 5: Cloud Ready Design through Application Software Infrastructure

On-Premise or Cloud or Both?

5

Page 6: Cloud Ready Design through Application Software Infrastructure

Build and Operate for On-Premises

Deployable in Azure

Enable a gradual migration into the Cloud

Cloud migration does not require a

rewrite or reengineering

First phase use IaaS

Second phase use PaaS

Quality

Isolation

Separation

Build, Test and

Deploy for

On-Premises

only

Large and

Complex

System

Deployable on

Azure

Use PaaS

6

Page 7: Cloud Ready Design through Application Software Infrastructure

Source code dependencies can only

point inwards

• Nothing in an inner circle can know anything

at all about something in an outer circle

• Abstractions and application concepts are

independent of frameworks

• frameworks are used as tools, not to cram the

system into their limiting constraints

7

http://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html

Separate the core of the app from

the frameworks and the mechanisms

Page 8: Cloud Ready Design through Application Software Infrastructure

What did we already do?

8

DesignEnvision

solutions

Setup rules

and practices

Managing

Complexity

Quality

Change

Separations

Abstraction &

Encapsulation

Explain &

ValidateDiagrams Prototypes

Page 9: Cloud Ready Design through Application Software Infrastructure

Importance of Managing Complexity

when projects do fail for reasons that are primarily

technical, the reason is often

uncontrolled complexity

9

Page 10: Cloud Ready Design through Application Software Infrastructure

Importance of Managing Complexity

Scalability

Availability

Multitenancy

Security

Authorization

Page 11: Cloud Ready Design through Application Software Infrastructure

App Infrastructure Enforces the Architecture

Page 12: Cloud Ready Design through Application Software Infrastructure

Application Infrastructure

Page 13: Cloud Ready Design through Application Software Infrastructure

The Application Foundation

Page 14: Cloud Ready Design through Application Software Infrastructure

Wrongly Built House

Page 15: Cloud Ready Design through Application Software Infrastructure

Different Solutions to the Same Problem

Page 16: Cloud Ready Design through Application Software Infrastructure

Which one is the ONE?

Page 17: Cloud Ready Design through Application Software Infrastructure

App Infrastructure – Primary TOOL to

Control Complexity and Size

Page 18: Cloud Ready Design through Application Software Infrastructure

How to do it?

Invest in Design and App. Infrastructure

Enforce consistency

Enforce structure

Focus on Modularity, Abstraction, Encapsulation

Independent

Modules

Hide the

frameworks

Manage Dependencies

Dependency

Injection

Discoverability

18

Page 19: Cloud Ready Design through Application Software Infrastructure

Good Design vs Bad Design

http://martinfowler.com/bliki/DesignStaminaHypothesis.html

Page 20: Cloud Ready Design through Application Software Infrastructure

iQuarc AppBoot Library

Lightweight library that handles the startup of an application

Implements

Separation of Construction

and Configuration from Use

Modularity

Defines and abstracts a

modular application

Makes the application

independent of the host

process

Dependencies Management

Dependency Injection

Enforces consistency in

declaring dependencies

Encourages good practices

Encourages separation

between data and behavior

20

Page 21: Cloud Ready Design through Application Software Infrastructure

iQuarc AppBoot: Modularity

<<Interface>>

IModule

+ Initialize()

Application

+ Initialize()*

+ Modules[]

AppModule1

+ Initialize()

AppModule2

+ Initialize()

• Modular Application Support

• Application modules do not depend on

Frameworks

• Application can be hosted in any .NET process

\iQuarc\AppBoot

Page 22: Cloud Ready Design through Application Software Infrastructure

Application Hosted in Any .NET Process

• The application is not aware of the process it is

hosted in

• The application is isolated from framework specifics

• The host process is not aware of what modules it

hosts

• The host process is isolated from application logic

• Benefits:

• Flexible deployments

o same host can load different modules depending on

configuration

o Flexibility in development and testing

• Framework setup is separated from application setup

22

<<Attribute>>

ServiceAttribute

+ ServiceAttribute()+ServiceAttribute(Type contract)+ ServiceAttribute(Type t, Lifetime lifetime)

Bootstrapper

+Bootstrapper(Assembly[] assemblies)+Run()

Application

+ Initialize()

\iQuarc\AppBoot

Page 23: Cloud Ready Design through Application Software Infrastructure

App Boot: Dependency Injection

<<Attribute>>

ServiceAttribute

+ ServiceAttribute()+ServiceAttribute(Type contract)+ ServiceAttribute(Type t, Lifetime lifetime)

Bootstrapper

+Bootstrapper(Assembly[] assemblies)+Run()

• Makes Programming Against Interfaces the de

facto programming model

• Abstracts and hides the Dependency

Container

• Provides a maintainable mechanism for

declaring services implementation

• Dictates how Dependency Injection is used\iQuarc\AppBoot

Page 24: Cloud Ready Design through Application Software Infrastructure

public IEnumerable<Policy> GetPolicyFromMutation(Mutation mut)

{

var policies = repository.GetEntities<PolicyImage>()

.Where(image => image.MutationId==mut.Id)

.Select(image => new Policy

{

Id = image.PolicyId,

ValidAt = image.Mutation.Date

//..

}).ToList();

// do other calculations / grouping on data

return policies;

}

public void CalculateChanges(ChangeEvent change)

{

using (var uof = repository.CreateUnitOfWork())

{

var policies = uof.GetEntities<PolicyImage>()

.Where(i => i.Status == ImageStatus.Calculating &&

. i.EvendId == change.Id);

foreach (PolicyImage image in policies)

{

image.Ammunt = GetAmmountFor(image, change);

}

uof.SaveChanges();

}

}

Encapsulate Data Access Concerns

<<Interface>>

IRepository

+GetEntities<T>() : IQueriable<T>

<<Interface>>

IUnitOfWork

+SaveChanges()

Database

Repository UnitOfWork

<<Stereotype>><<DTO>>

Plan<<DTO>>

Contract

+CreateUnitOfWork() +GetEntities<T>():IQueriable<T>

\iQuarc\DataAccess

Page 25: Cloud Ready Design through Application Software Infrastructure

Isolate from external libraries

<<static class>>

Log

+LogError()+LogWarining()

Exception Wrappers Decorators

<<Interface>>

API Interfaces

25

Page 26: Cloud Ready Design through Application Software Infrastructure

Application Infrastructure – Shaping to Context

.NET Framework

WF

WCF

WEB API

ASP.NET

Entity Framework

. . . Unity

NServiceBus Log4Net

. . .

Application Infrastructure

Application Functionalities

Page 27: Cloud Ready Design through Application Software Infrastructure

When to do it?

cum

ula

tive

funct

ionalit

y

time

completion

construction

ready

design payoff

Page 28: Cloud Ready Design through Application Software Infrastructure

When to do it?cu

mula

tive

funct

ionalit

y

time

completion

construction

ready

design payoff

time

Arc

Arc

Infr

a

Funct

ionalit

yIn

fra Fu

nct

ionalit

yIn

fra

Funct

ionalit

y

Funct

ionalit

y

Funct

ionalit

y

Funct

ionalit

y

RepositoryImpl

+ GetEntities<T>() : IQueriable()

IRepository IUnitOfWork

+ SaveChanges()

IModule

<<Attribute>>

ServiceAttribute

\iQuarc

Funct

ionalit

y

Page 29: Cloud Ready Design through Application Software Infrastructure

Thank You!

Florin CorosPartner and Co-founder, iQuarc

[email protected]

blog.iquarc.com/florin

@florincoros