Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the...

27
Introduction to Spring.NET http://www.springframework.net

Transcript of Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the...

Page 1: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

Introduction to Spring.NET

http://www.springframework.net

Page 2: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

About

• Joeri Torfs- CEO Softelligent- http://www.softelligent.be

• Benny Michielsen- Using Spring.NET for 4 years- http://www.bennymichielsen.be

Page 3: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

Agenda

• Dependency Management

• Dependency Injection

• AOP

• Services

• Much More

Page 4: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

Agenda

• Dependency Management

• Dependency Injection

• AOP

• Services

• Much More

Page 5: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

Dependency Management

Page 6: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

Dependency Management

Page 7: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

Dependency Management

Page 8: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

Dependency Management

• Rigidunknown impact of change

• Fragilecascading changes, new errors

• Not reusabledeveloping from scratch can cost less

• Code Rots

Page 9: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

Dependency Management

Page 10: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

Dependency Management

Page 11: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

Agenda

• Dependency Management

• Dependency Injection

• AOP

• Services

• Much More

Page 12: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

Dependency Injection

Demo !

Page 13: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

Dependency Injection

• Heart of the framework

• Better seperation of concerns

• Less dependencies

• Pluggable applications

Page 14: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

Agenda

• Dependency Management

• Dependency Injection

• AOP

• Services

• Much More

Page 16: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

AOP

Demo !

Page 17: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

AOP

• Crosscutting (recurring) concerns (code across multiple classes) that can not be resolved by moving it up the inheritance tree can be handled by using Aspect-oriented Programming.

• Logging, security, transactions, caching...

Page 18: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

AOP

• Aspect = cross-cutting concern (Advisors / Interceptors)

• Joinpoint = point during execution

• Advice = action on joinpoint (around, before, throws)

• Pointcut = set of joinpoints specifying when advice should be executed

Page 19: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

AOP

• Introduction = introducing new interfaces or fields

• Target = object containing the joinpoint (advised/proxied object)

• AOP Proxy = object with advice

• Weaving = assembling aspects to create AOP Proxy

Page 20: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

AOP

• Several out of the box:LoggingException HandlingCachingTransactionRetry

• Extensible

Page 21: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

Agenda

• Dependency Management

• Dependency Injection

• AOP

• Services

• Much more

Page 22: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

Services

Demo !

Page 23: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

Services

• Encourages POCO classes

• Decide distribution later

• Hosting = configuration

Page 24: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

Agenda

• Dependency Management

• Dependency Injection

• AOP

• Services

• Much More

Page 25: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

Much more

• Web Framework

• Validation

• Data & NHibernate

• Testing

• Messaging

• ...

Page 26: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

Other frameworks

• Castlewww.castleproject.org

• StructureMapstructuremap.sourceforge.net

• Unitywww.codeplex.com/unity

• PostSharpwww.postsharp.org

• ...www.google.com

Page 27: Introduction to Spring - blog.bennymichielsen.be€¦ · Dependency Injection • Heart of the framework • Better seperation of concerns • Less dependencies • Pluggable applications

Q & A