Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 161351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:11:52+00:00 2026-05-11T11:11:52+00:00

My question is more of an architectural nature, less involved with the actual implementation.

  • 0

My question is more of an architectural nature, less involved with the actual implementation.

I have build an API based on WCF, but can’t really decide on how to separate the PL from the BL. I have made my service thin, so that it holds only a minimum of implementation, something like:

public TagItemResponse TagItem(TagItemRequest request) {    return (new ItemTagRequestProcessor()).GetResponse(request); } 

Than of course the first question arises, in what layer do the RequestProcessors belong? I think it would be wrong to call them a facade, but at the same time, they have nothing to do with presentation. As for now, i decided that they nevertheless belong in the PL. The processor methods take my DTO’s (DataContracts) as input, validate the request message (base class), authenticate (base class) and eventually return a single DTO response, like so:

protected override void Process(TagItemRequest request, TagItemResponse response, Host host) {     var profile = ProfileFacade.GetProfile(host, request.Profile);     var item = ItemFacade.GetItemId(host, request.Item);     var tags = new List<Tag>();      foreach (var name in request.Tags)     {         var tag = TagFacade.GetTag(profile, name);         ItemFacade.TagItem(item, tag);         tags.Add(tag);     }      ItemFacade.UntagItem(item, tags); } 

Now I ask myself, why do i need the facade classes 1:1 related to my business objects. For example i have a HostFacade that acts as a layer between the hostDAO and the processors. It, however, holds very little logic, it merely handles the DAO calls.

public static Host GetHost(HostDTO dto) {    return HostDAO.GetHostByCredentials(dto.Username, dto.Password); } 

Question: I might as well merge the processors and the facades, right?

I’ve read many articles/books on the subject, but i still can’t settle on the ‘right’ way to go and tend to chose a different approach every time i face the issue. I wonder if a right approach even exists.

I’ve found f.ex. the doFactory example, where they talked to the DAO classes right from within the service implementation. I don’t really like that, as most ServiceContract methods share some logic, and thus lend themselves well for use with shared base classes.

I’ve also found other examples where only the facades are called from within the services, but that seems to work well only for very fine-grained messages. My messages are ‘fat’ and composite in order to reduce the number of calls to the service as much as possible. My extra processing layer seems the be my real problem.

Probably there is no single answer as to how to correctly layer a WCF service, but hopefully there are some of you out there with an opinion that will either conform my instincts or shed some new light on the subject for me.

Thanx!

Geoffrey

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T11:11:52+00:00Added an answer on May 11, 2026 at 11:11 am

    First, I assume that by PL you mean presentation layer, not persistence layer?

    When implementing a layered application design, the main question should always be: can I replace the implementation of a lower layer without impacting the implementation of the layer(s) above.

    This is usually best illustrated by the persistence layer. If you switch from SQL Server 2008 to MySQL for example, the persistence layer changes (of course). But are changes in the business layer also necessary? For example, does the business layer catch SqlException instances that are only thrown by SqlClient? In a good design, the business layer needs no changes at all.

    The same principle should apply to the separation between business layer and presentation layer.

    In your example, I would say that the ItemTagRequestProcessor should not be in the presentation layer. First, it has nothing to do with presentation, second, the implementation of processing a request is not a concern for the presentation layer. Compare it with a web application, presenting a TagItemResponse to a client is the concern of the web (presentation) layer. Retrieving an instance of TagItemResponse is the concern of a layer below the presentation layer.

    Deciding whether to have a facade between your business layer and persistence layer is difficult. I usually do not implement a facade because it adds an extra (usually unnecessary) layer of indirection. Besides, I do not see a problem in calling persistence layer methods directly from business layer methods. If only you take the same principle into account: can you change the persistence layer implementation without affecting the business layer implementation.

    Kind regards,

    Ronald Wildenberg

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 74k
  • Answers 74k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Did my predecessor know something I didn't, or am I… May 11, 2026 at 2:18 pm
  • added an answer For free for 30 days (then $30) you can give… May 11, 2026 at 2:18 pm
  • added an answer Take a look at this jabbar library for .NET: http://code.google.com/p/jabber-net/… May 11, 2026 at 2:18 pm

Related Questions

Perhaps my question is similar in nature to this one: Do you use design
Using a web service is often an excellent architectural approach. And, with the advent
When I first heard about StackOverflow, and heard that it was being built in
My company is currently in the process of creating a large multi-tier software package

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.