Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The background:

I need to build a desktop application with some operations (CRUD and more) (=winforms), I need to make another application which will re-use some of the functions of the main application (=webforms). I'm using service layer for reusing my functions. The service is calling the functions on the BL layer (correct me if I'm doing this wrong). so my desktop has 4 projects - DAL, BL, UI, WEBSERVICES.

The dilemma (simple but I still need some more experienced opinions):

  1. In my main winform UI - should I call the functions from the BL - bl.getcustomers(), or do it similar to how I call it in the webform, and call the functions from the service - webservices.getcustomers?

  2. Should I create a service for every single function on the BL even if I need some of the functions only in one UI? for example - should I create services for all the CRUD operations, even though I need to re-use only update operation in the webform?


share|improve this question
up vote 2 down vote accepted

If all your service is doing is a pass-through to the business layer, why not just use the business layer? If it's an internal app, then sharing libraries is quick, easy and relatively painless.

If not, then your service should focus on the publically visible operations the service supports. If it makes sense to have two different interfaces for the service (and thus two different contracts for consumers) then do that. The service exists as an encapsulation mechanism for the underlying implementation. Don't violate that.

share|improve this answer
if I understood you correctly than your answer on question 2: create service only for the functions actually reused and not creating services for all the CRUD operations just for consistency. I'm still not sure about question 1: in the desktop app - should I call the functions directly from the BL, or also from the service (like I call the functions from the service in the webform UI)? – BornToCode Sep 13 '12 at 14:06
@BornToCode It's unclear what you're asking. If your desktop app ties into the service (so that they can be deployed/maintained independently) then call the service. If it can get to the data directly, there's less need for the service. See my first paragraph in the reply. – Telastyn Sep 13 '12 at 14:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.