71
Escaping DLL Hell

Escaping DLL Hell

Embed Size (px)

Citation preview

Page 1: Escaping DLL Hell

Escaping DLL Hell

Page 2: Escaping DLL Hell

João Bragança//github.com/thefringeninja//the.fringe.ninja/blog@thefringeninja

Page 3: Escaping DLL Hell

eVision SoftwareSafety Software for Oil & GasDen Haag, Netherlands//evision-software.com

Page 4: Escaping DLL Hell

Computing circa 1992●Premium PC

o486 DX2o16 MB Ramo$3-$5k

Page 5: Escaping DLL Hell

Computing circa 1992●Premium PC

o486 DX2o16 MB Ramo$3-$5k

●Windows 3.1

Page 6: Escaping DLL Hell

Computing circa 1992●Premium PC

o486 DX2o16 MB Ramo$3-$5k

●Windows 3.1●Extremely Limited by Today’s Standards

Page 7: Escaping DLL Hell

Computing circa 1992●Premium PC

o486 DX2o16 MB Ramo$3-$5k

●Windows 3.1●Extremely Limited by Today’s Standards●Shared Memory

Page 8: Escaping DLL Hell
Page 9: Escaping DLL Hell

2001 - .NET Framework 1.0●AppDomain

Page 10: Escaping DLL Hell

2001 - .NET Framework 1.0●AppDomain●Global Assembly Cache

Page 11: Escaping DLL Hell

Problems●Pain of Manually Loading Assemblies

Page 12: Escaping DLL Hell

Problems●Pain of Manually Loading Assemblies●Must use Child AppDomain + Marshalling

Page 13: Escaping DLL Hell

Problems●Pain of Manually Loading Assemblies●Must use Child AppDomain + Marshalling●Strong Naming

Page 14: Escaping DLL Hell

Escaping DLL GAC Hell

Page 15: Escaping DLL Hell

2010 - .Net Package Managers●OpenWrap

Page 16: Escaping DLL Hell

2010 - .Net Package Managers●OpenWrap●NuPack

Page 17: Escaping DLL Hell

2010 - .Net Package Managers●OpenWrap●NuPack●NuGet

Page 18: Escaping DLL Hell

Problems●Assembly Binding Redirect - Never Works

Right

Page 19: Escaping DLL Hell
Page 20: Escaping DLL Hell

Problems●Assembly Binding Redirect - Never Works

Right●Requires SemVer be Followed - It Isn’t

Page 21: Escaping DLL Hell

Problems●Assembly Binding Redirect - Never Works

Right●Requires SemVer be Followed - It Isn’t●Strong Naming (again)

Page 22: Escaping DLL Hell

Escaping DLL GAC Nuget Hell

Page 23: Escaping DLL Hell

Escaping DLL GAC Nuget Hell

SHARED DEPENDENCIES

Page 24: Escaping DLL Hell

Solution

Page 25: Escaping DLL Hell

(Some) Upfront Design

Solution

Page 26: Escaping DLL Hell

Service Oriented Architecture

Page 27: Escaping DLL Hell

Service Oriented Architecture●CORBA

Page 28: Escaping DLL Hell

Service Oriented Architecture●CORBA●DCOM

Page 29: Escaping DLL Hell

Service Oriented Architecture●CORBA●DCOM●Web Services (WCF)

Page 30: Escaping DLL Hell

Service Oriented Architecture●CORBA●DCOM●Web Services (WCF)●Micro Services

Page 31: Escaping DLL Hell

Service Oriented Architecture●CORBA●DCOM●Web Services (WCF)●Micro Services●Nano Services

Page 32: Escaping DLL Hell

Service Oriented Architecture●CORBA●DCOM●Web Services (WCF)●Micro Services●Nano Services●Femto Services

Page 33: Escaping DLL Hell

Service Oriented Architecture●CORBA●DCOM●Web Services (WCF)●Micro Services●Nano Services●Femto Services

Page 34: Escaping DLL Hell

Service Oriented Architecture●CORBA●DCOM●Web Services (WCF)●Micro Services●Nano Services●Femto Services

Page 35: Escaping DLL Hell

Service Oriented ArchitectureJust Services.

Page 36: Escaping DLL Hell

Service Oriented Architecture●[A Service is] a logical representation of a

repeatable business activity that has a specified outcome

Page 37: Escaping DLL Hell

Service Oriented Architecture●[A Service is] a logical representation of a

repeatable business activity that has a specified outcome

●Is self-contained

Page 38: Escaping DLL Hell

Service Oriented Architecture●[A Service is] a logical representation of a

repeatable business activity that has a specified outcome

●Is self-contained●May be composed of other services

Page 39: Escaping DLL Hell

Service Oriented Architecture●[A Service is] a logical representation of a

repeatable business activity that has a specified outcome

●Is self-contained●May be composed of other services●Is a “black box” to consumers of the service

Page 40: Escaping DLL Hell

Service Oriented Architecture●[A Service is] a logical representation of a

repeatable business activity that has a specified outcome

●Is self-contained●May be composed of other services●Is a “black box” to consumers of the service●These are just fancy words for “a function.”

Page 41: Escaping DLL Hell

Service Oriented Architecturepublic delegate Task<decimal> GetAccountBalance(string accountNumber)

Page 42: Escaping DLL Hell

Service Oriented Architecture●Use these functions for inter-component

communication

Page 43: Escaping DLL Hell

Service Oriented Architecture●Use these functions for inter-component

communication●Keep boundaries crisp

Page 44: Escaping DLL Hell

Onion Architecture

Solution

Page 45: Escaping DLL Hell

Onion Architecture

Page 46: Escaping DLL Hell

Onion Architecture●Center Takes No Dependencies

Page 47: Escaping DLL Hell

Onion Architecture●Center Takes No Dependencies●Ports and Adapters

Page 48: Escaping DLL Hell

Onion Architecture●Center Takes No Dependencies●Ports and Adapters●Dependencies Point Inwards

Page 49: Escaping DLL Hell

Onion Architecture●Center Takes No Dependencies●Ports and Adapters●Dependencies Point Inwards●Keep Implementations on the Outside

oDatabaseoHttp

Page 50: Escaping DLL Hell

OWIN

Solution

Page 51: Escaping DLL Hell

OWIN●The only dependency is on mscorlib.

Page 52: Escaping DLL Hell

OWINAppFunc:

Func<IDictionary<string, object>, Task>

MidFunc:Func<AppFunc, AppFunc>

Page 53: Escaping DLL Hell

OWIN●The only dependency is on mscorlib●Reduces Δ between production and

development

Page 54: Escaping DLL Hell

OWIN●The only dependency is on mscorlib.●Reduces Δ between production and

development●Fast integration tests - possible to test entire

pipeline in memory

Page 55: Escaping DLL Hell

ILMerge / ILRepack

Solution

Page 56: Escaping DLL Hell

ILMerge / ILRepack●Merges multiple assemblies into one

Page 57: Escaping DLL Hell

ILMerge / ILRepack●Merges multiple assemblies into one●Internalization

Page 58: Escaping DLL Hell

ILMerge / ILRepack●Merges multiple assemblies into one●Internalization●Virtually eliminates shared dependency

problem

Page 59: Escaping DLL Hell

Source Packages

Solution

Page 60: Escaping DLL Hell

Source Packages●SimpleJson

Page 61: Escaping DLL Hell

Source Packages●SimpleJson●LibLog

Page 62: Escaping DLL Hell
Page 63: Escaping DLL Hell

Source Packages●SimpleJson●LibLog●netfx-Guard

Page 64: Escaping DLL Hell

Putting it Together

Solution

Page 65: Escaping DLL Hell

Putting it Together

Sales

Page 66: Escaping DLL Hell

Putting it Together

Sales Ware-house

Page 67: Escaping DLL Hell

Putting it Together

Sales Ware-house

GetInventoryCountFunc<string, Task<int>>

IsItemAvailableFunc<string, int, Task<bool>>

Page 68: Escaping DLL Hell

Putting it Together

Sales Ware-house

GetInventoryCountFunc<string, string,

Task<int>>

IsItemAvailableFunc<string, int, Task<bool>>

Page 69: Escaping DLL Hell

Questions?

Page 70: Escaping DLL Hell

Resources●//github.com/gluck/il-repack●//owin.org●//github.com/damianh/LimitsMiddleware●//github.com/damianh/LibLog

Page 71: Escaping DLL Hell

João Bragança//github.com/thefringeninja//the.fringe.ninja/blog@thefringeninja