Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > BOOK: Professional Enterprise .NET
|
BOOK: Professional Enterprise .NET
This is the forum to discuss the Wrox book Professional Enterprise .NET by Jon Arking, Scott Millett; ISBN: 978-0-470-44761-1
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Enterprise .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 18th, 2010, 11:12 AM
Registered User
 
Join Date: Feb 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Smile architect: needs opinions based on design guidelines .

Hi Scott,

i have posted the question here regards to the following the correct guidelines, would you mind throwing some light on my design please?

http://forums.asp.net/t/1526811.aspx

Thanks
Nisar
 
Old February 18th, 2010, 01:34 PM
elbandit's Avatar
Wrox Author
 
Join Date: May 2007
Posts: 107
Thanks: 10
Thanked 17 Times in 15 Posts
Default

Hi nisarkha,
First off thanks for buying my book http://forums.asp.net/tiny_mce/jscri...iley-smile.gif
Having a look at your code your service class seems a little mixed up. From Fowlers book on Patterns of Enterprise Arch the service layer...

"...defines an application's boundary [Cockburn PloP] and its set of available operations from the perspective of interfacing client layers. It encapsulates the application's business logic, controlling transactions and coor-dinating responses in the implementation of its operations." ~ http://martinfowler.com/eaaCatalog/serviceLayer.html
So I would modify the service layer like so:

Code:
public class EscortService : IEscortService
{
     private IEscortRepository _escortRepository;

     public EscortService(IEscortRepository escortRepository)
    {
         _escortRepository = escortRepository;
     }

     public List<PartialPerson> LoadEscort()  
     {  
        // Could cache the response from the repository 
        // do something else with the list of PartialPerson
        return _escortRepository.LoadEscort();  
     }              
 }
With the modified code you can now unit test the service class, plus the responsiblity of obtainig the respository is now not the concern of the service due to the fact that we are now injecting it into the class via the constructor - dependency injection.

If you were being pragmatic you might not want a service layer at all as its not really giving you anything. However if you wanted to cache the results from the repository or indeed perform some other bit of business logic then the service layer would start becoming useful.

I hope that was of some use. let me know if you have any more questions.
Cheers Scott

Last edited by elbandit; February 18th, 2010 at 01:35 PM.. Reason: wrapped code





Similar Threads
Thread Thread Starter Forum Replies Last Post
3-tier architect rajdotnet .NET Framework 1.x 2 November 3rd, 2006 07:01 PM
Windows based Problem Design Solution Book ricpue BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 September 1st, 2006 07:47 AM
need guidelines for application design madhukp ASP.NET 1.x and 2.0 Application Design 11 May 7th, 2005 02:57 AM
j2ee architect sample papers?? rahulsaxena J2EE 1 September 28th, 2004 01:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.