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

Posted on 2005-05-13
Last Modified: 2009-12-16

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 !

Question by:davyberroho
    LVL 23

    Accepted 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.

    Author Comment

    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!

    LVL 23

    Expert Comment


    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.

    Author Comment

    Thanks a lot for your advice !!!

    you definitely earn the 500 points !

    Thanks again!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Article by: Ivo
    Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
    This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now