Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > BOOK: Professional Enterprise .NET
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 18th, 2010, 10: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
Reply With Quote
  #2 (permalink)  
Old February 18th, 2010, 12:34 PM
elbandit's Avatar
Wrox Author
Points: 569, Level: 8
Points: 569, Level: 8 Points: 569, Level: 8 Points: 569, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2007
Location: Southsea, Portsmouth, Hampshire, United Kingdom.
Posts: 104
Thanks: 11
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 12:35 PM. Reason: wrapped code
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
3-tier architect rajdotnet .NET Framework 1.x 2 November 3rd, 2006 06: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



All times are GMT -4. The time now is 04:41 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.