• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 250
  • Last Modified:

Creation of N-TIER MODEL (and use of webservices)


I've build an N-Tier Model and would like to know if I'm going the right way... (it's the first time I'm building such model)

My N-Tier Model actually looks like this :

Windows Forms
Windows User Controls
Business Workflow
Business Logic
Data Factory
Data Access
Common Class

Explanation :

Content of the following layers :

Windows Forms (exe): only forms (user interface);
                                 The windows forms layer has access to the Win User Controls, Business Workflow and Common class.

Windows User Controls (dll) : own and external usercontrols or dlls;
                                           The windows User controls layer has access to the Business Workflow and Common class.

Business Workflow (dll): workflow of 'business logic'-functions;
                                   The business workflow layer has access to the business logic and  Common class.

Business Logic (dll): functions like : build tree, fill grid, calculate, ...;
                             The business logic layer has access to the data factory and common class.

Data Factory (dll): functions that will execute queries to the database. (ex. fill user information, get list of customers,...);
                           The data factory layer has access to the data acces and common class.

Data Access (dll): functions : create connection with database, destruct connection, execute queries with or without results;
                          The data access layer has access to the common class.

Common class : global functions : write to log, format sql queries, format datetime,... .
                        The common class layer has access to nothing.

I also want to use webservices. Do I've to use 1 or several webservices? Which layer will be located in which webservice?

Maybe I only have to use 2 webservices :

Webservice 1 contains :
     * the business workflow layer;
     * the business logic layer;
     * the common class layer.

Webservice 2 contains :
     * the data factory layer;
     * the data access layer.

Thanks a lot for your help !

  • 2
  • 2
1 Solution

Web services are nifty pieces of code that let you do a lot of stuff.  If it were me, I'd create some web services that are very generic and operate on the business level (not business tier of your program).

Here's what I mean....

I would use Web Services for the following:
   Connecting to a database
   passing data
   encrypting/decrypting data
   running/distributing reports
   handling/sending email

These are all functions that can be used by *any* program.   Personally I would not use web services to handle business logic or any kind of application specific process.  I would use web services only for non-application specific processes.  That way, you can have a very secure/hardened server that would hold all of the critical/sensitive information (like database access accounts and passwords).  This is how I would use web services.  

That is not to say that web services can't be used for business logic or be specific to a single applicaiton.  I just find web services are more useful for handling global (to your business) functionality.

In every web service that I've seen or designed, the web service was very light weight but handled lots of traffic.  Where as the business logic was housed in standard class structures.  They were much more robust, but optimized for one particular application.
davyberrohoAuthor Commented:
I think you're right !

I will only use the webservice for the data access and data factory layer... The other layers are too 'application'-specific and cannot be re-used by other application.

What do you think of my model. Does it look right or am I going the wrong direction?

Thanks a lot for your advice!


So far so good...

If you write your program corectly, you should be able run a winForm app and webForm app at the same time using the exact same dlls.

That is:

WinForm                     WebForm
      \                                 /
  WinControl           WebControls
             \                 /
             Business Logic
               Data Factory

In short, your Business layer should contain DataSets or strings, etc.  Not TextBoxes, or Panels or anything that is specific to either Windows controls or web controls.
davyberrohoAuthor Commented:
Thanks a lot for your advice !!!

you definitely earn the 500 points !

Thanks again!

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now