New Zealand's new Copyright Law presumes 'Guilt Upon Accusation' and will Cut Off Internet Connections without a trial. CreativeFreedom.org.nz is against this unjust law - help us


A Space for All Things .NET Related


Building Composite Applications

By James Hippolite, in , posted: 15-Mar-2007 20:25

Building Composite Applications

Jeremy Boyd

Mindscape

Lots of ground to cover!

New concepts, code!

Look for code, samples and presentation downloads

http://turtle.net.nz/blog/

Jeremy@mindscape.co.nz

Composite Applications

  • The whole is greater than the sum of its parts
  • Composed of a number of discrete and independent pieces, aggregating this functionality through a software interface.
  • Break free from “silo” issues
  • Lower cost of development
  • Consistency

Tradition Applications

  • An encapsulated system providing its own self sufficiency

What’s enabled all this?

  • Services
  • Software over services
    • Lightweight
    • Loosely coupled
    • 3 tier architecture
  • Result: Reuse of software!

Traps to watch for

  • Maturity for integration
    • Must be able to leverage services for direct integration for greatest benefit
  • External Trust
    • External data lives in the cloud
    • Reliance on provider for business operations

Example: Exchange Server 2007 is used by

  • Outlook
  • Outlook Web Access
  • Outlook Voice Access
  • Outlook Mobile

Background Motion

  • Lightweight build: 3 weeks
  • Consumes resources from
    • Flickr
    • Soapbox
    • GeoTagIt
  • Also publishes services and data

Architecture

  • Presentation Layer = ASP.Net 2.0 & AJAX
  • Business Layer = Content Service, controllers & Model
  • Resource Layer = Service Proxies & LINQ to SQL Server

But How?

  • Start with the problem e.g. Provide a community site to provide content for DreamScene
  • Focus on the interface
  • Work out who is already offering functionality
    • Flickr works well for images
    • Soapbox works well for videos

We already had great tools

  • .NET 2.0 and .NET 3.0 Frameworks
  • ASP.Net AJAX
  • Composite Web Block
  • Enterprise Library
  • Don’t forget about 3rd party!
    • RSS Toolkit
    • Lucene.NET
    • 2 way data-binding

Some tips from the Background Motion build

  • WebDataBinder
    • DataBinder.DataBind()
    • DataBinder.Unbind()
  • Microsoft.Practices.EnterpriseLibrary.Validation
    • [RequireValidator]
    • Presenter.Save()


 

Supervising Controller (MVP)

  • View (GET http://site/pages.aspx)
  • Presenter (View is based on the PageBase class which wires it up to the Presenter)
  • Model (View can work with the Model but calls back to Presenter to perform process flow)

  • “Factor the UI into a view and controller where the view handles simple mapping to the underlying model and the controller handles input response and complex view logic.” Martin  Fowlerwww.martinfowler.com
  • Cleanly separates UI process form binding/event logic
  • Improves testability

Dependency Injection

  • Establish a level of abstraction via a public interface, and remove dependency on components by (for example) supplying a plug-in architecture – Wiki
  • Allows for loose coupling
  • Abstraction through interfaces
  • Composite Web Block uses
  • ServiceLocator approach

Service Locators

  • I need an instance of IDataLayer class! (Consumer to Interface)
  • I can ask the ServiceLocator to give me an instance of IDatalayer
  • ServiceLocator holds an instance of Factory <IDataLayer>
  • Factory <IDataLayer> assembles a Concrete class instance
  • Concrete instance is returned to the Consumer
  • Consumer always calls through the IDataLayer interface

So What?

  • Solid foundation leads to flexibility – supports change!
  • Lower development complexity – modularity!
  • Testability of solution
    • More effective integration
    • Shorter cycles
    • Always building working code!

Unit Testing…

·        Create a separate library (project in the solution)

·        NUnit – a free testing framework

·        Define [Test] methods

o       Assert.IsFalse(contribution.ValidationResults.IsValid);

o       (do some work)

o       Assert.IsTrue(contribution.ValidationResults.IsValid);

·        Where might these be useful? 

o       When a field length changes, the Unit Test will fail the Validator.

o       Helps save you a lot of time by capturing these types of failures

Continuous Integration

  • Developer checks in to source control
  • The BuildServer monitors the source control
  • The BuildServer builds the application
  • The BuildServer runs the unit tests
  • The BuildServer notifies whether all tests passed

Resources

  • External from this application
    • Active Directory
    • Web Services
    • Legacy System
  • Contract based consumption
    • Loose coupling
    • Flexibility in plug and play

But how?

  • Windows Communication Foundation
  • The Unified Framework for rapidly building service oriented applications

WCF

·        Building block for building Connected Systems

·        Designed around messages!

·        Full standards/specifications support (WS-* oriented)

·        Provide consistent API regardless of messaging requirement

·        Part of .Net 3.0 Framework

Software + Services

·        ASP.NET AJAX.  The free framework for quickly creating a new generation of more efficient, more interactive and highly personalized Web experiences

·        Building a mash-up using ASP.NET AJAX

·        Web Service can output AJAX (JavaScript)!

AJAX with Services

  • ASP.Net AJAX allows native call
  • Too fast


 

Call to Action

  • Read about Patterns
  • Look at Unit Tests and CI http://ccnet.thoughtworks.com
  • Download the Composite Web Block
    • And the Validation Block
    • And the Enterprise Library
  • Publish services in your enterprise to allow composite applications to flourish!



Tag(s):     


Other related posts:
Teach Yourself Azure in 4 hours
System.BadImageFormatException
Geek Post Monthly Newsletter Volume 2 Issue 10






Add a comment

Please note: comments that are inappropriate or promotional in nature will be deleted. E-mail addresses are not displayed, but you must enter a valid e-mail address to confirm your comments.

Are you a registered Geekzone user? Login to have the fields below automatically filled in for you and to enable links in comments. If you have (or qualify to have) a Geekzone Blog then your comment will be automatically confirmed and shown in this blog post.

Your name:

Your e-mail:

Your webpage:

JamesHip's profile

James Hippolite
Wellington
New Zealand


Welcome to my technical blog. 

Here, I attempt to distill the Microsoft Certified Professional Developer knowledge I have accumulated since first qualifying MCP in 1996.  This blog started on 13 September 2007 as an off-shoot from my mixed up personal blog.  But it took a shot in the arm from Scott Hanselman's talk at TechEd New Zealand 08 "32 Ways To Make Your Blog Suck Less".