Slide

advertisement
.Select(new Framework())
General Purpose Frameworks
Enterprise Library, Spring.Net, Castle,
NakedObjects, ADF, SubSonic, …
Single goaled frameworks – verticals
Single goaled frameworks – architectural
Dependency injection: ObjectBuilder, Unity, Castle
Windsor, (MEF)
User interface: Silverlight, ASP.NET MVC,
WPF, ASP.NET Ajax, Spring MVC
Logging: Log4Net, Logging Block, Common.Logging
Process: UI Process Application Block, WF
Exception handling: Exception Handling Block
Domain: Entity Framework, NHibernate, NEO
Apect orientation: PostSharp, SetPoint
Search: Lucene.net, NLucene
Data: Entity Framework, Hibernate, Castle
ActiveRecord, CSLA
Portals: DotNetNuke, Umbraco, Orchard CMS
Services: WCF, WCF RIA
.Select(new Framework())
.Discuss(new List<AntiPattern>)
What if the author of our
favorite framework suddenly
stops developing it?
What if we require additional
features that aren’t covered by
our framework?
And what if the new version of
our framework is implemented
totally different?
What if we decide that another
framework might be better
than the one we’re using now?
What if the framework contains bugs?
A framework
developer
An application
developer
Here’s … beta!
.Select(new Framework())
.Discuss(new List<AntiPattern>)
.Discuss(new List<Pattern>)
Dependencies
 Using frameworks is simply good, gringo
 However, be very aware of dependencies
Minimize dependencies
 Frameworks reflect software architecture, not
vice versa




Define your own layer supertypes
Apply dependency injecton / extensibility
Apply additional patterns
Many more patterns, some very basic, will
increase minimizing dependencies
Pages
UserControls
Panels
Presentation
Process
Use cases
Workflow
Domain
Domain objects / Entities
Factories / Repositories
Enums / Value objects / Smart references
[Mapping]
Service gateways
Service locators
[Mapping]
Data / Services
Peoplesoft
Outside world
SAP
BizTalk
Java
Databases
Services / ESB
What’s a layer supertype Ollie?
 Acts as a supertype for all types in its layer
 All types inherit from the layer supertype
Well Stan, it’s characteristics are
 Name expresses common behaviour
 Forces common features on all inherited types
 Ideal starting point for services
 Initially the layer supertype is empty
 Reserve layer supertype for future additions
 Extension methods don’t (always) help, you know
.Select(new Framework())
.Discuss(new List<AntiPattern>)
.Discuss(new List<Pattern>)
.ShowSome(Code)
What is the matter
Mister Fawlty?
The problem Manual, is that
 I want to use constants in my application
 But I want to define them in my framework and
extend them in my application
 Enumeration won’t do – there’s no inheritance
[PrincipalPermission(SecurityAction.Demand, Role = "Teller")]
Descriptor
Defines a restricted but
application specific extendible list
of definitions
Useful when
 Enums can not be inherited
 Framework defines enumeration types that need
to be extended in application code
 Define layer supertype using reflection
 Pre-define frequently used instances
[PrincipalPermission(SecurityAction.Demand, Roles.Teller)]
What do you think it is?
Create true separation between definition and
implementation, so that the two can vary
independently and can be replaced easily
Looks like a typical case of dependency injection to me
So …
 Call functionality without having to know
 Single topic services
the actual implementation
 Implement replaceable services
 Apply implementations in different contexts
 Plug-in services at run-time
 Single or multiple implemenations need to be
handled, which differs dependant on context, like
with Windows API, logging or error handling
 Unit testing
Did you know that there are different
types of this dependency injection?
Yeah, sure. There’s
Arggh…
 Constructor injection
 Property (setter) injection
 And even manual injection
 Extending MEF style?
Who cares doc?
Yes, XML will hurt you too!
Definition
 The manager-provider pattern creates a simple facade for a (set of)
interfaced implementation(s)
In practice
 Facade holding one or a collection of instances of a particular
interface
 Methods to call methods from interface
 At run-time, using dependency injection, actual implementation are
injected
Useful when
 Generic services need to be called, which may have different
implementations
 Manager prevents having to loop through each of a list of
implementation
 Flexibility to add or remove implementation without change the
application code
Dependencies
 Using frameworks is simply good, gringo
 However, be very aware of dependencies
Minimize dependencies
 Frameworks reflect software architecture, not
vice versa




Define your own layer supertypes
Apply dependency injecton / extensibility
Apply additional patterns
Many more patterns, some very basic, will
increase minimizing dependencies
.Select(new Framework())
.Discuss(new List<AntiPattern>)
.Discuss(new List<Pattern>)
.ShowSome(Code)
.HaveFun();
www.microsoft.com/teched
www.microsoft.com/learning
http://microsoft.com/technet
http://microsoft.com/msdn
Sign up for Tech·Ed 2011 and save $500
starting June 8 – June 31st
http://northamerica.msteched.com/registration
You can also register at the
North America 2011 kiosk located at registration
Join us in Atlanta next year
Download