3

I want to create a multitier project with 3 layers (or tiers? what's the difference?)

Now, how should I name each layer (tier) ?

I saw this description on wikipedia:

Wikipedia  Three-tier architecture

But I can not simply name my layers "Presentation tier", "Logic tier" and "Data tier", can I?

That won't be that appropriate in the namespaces.

Any ideas for the naming?

Nagelfar
  • 803
  • 2
  • 8
  • 21

3 Answers3

4

You could name your namespaces like this:

MeOrMyCompany.TheApplication.Data
MeOrMyCompany.TheApplication.Logic
MeOrMyCompany.TheApplication.Presentation

Sometimes it is necessary to add sub namespaces like

MeOrMyCompany.TheApplication.Presentation.Main
MeOrMyCompany.TheApplication.Presentation.Dialogs
MeOrMyCompany.TheApplication.Presentation.Controls
...

It's up to you.

Note that when you create a folder in a project, the folder name will be appended to the namespace automatically. So if you have a project called "MeOrMyCompany.TheApplication", you can add Folders named "Data", "Logic" and "Presentation". Within "Presentation" add subfolders named "Main", "Dialogs", "Controls" or whatever seems appropriate to you.

You can also create separate projects for the three tiers.

Example:

enter image description here

Here a class in the SVG Folder will automatically have the namespace

CySoft.SLVision.Diagrams.Shapes.Svg

namespace CySoft.SLVision.Diagrams.Shapes.Svg
{
    public class SvgLine : LineShape
    {
        private SvgShapeFactory _context;
        ...
    }

    ...
}
Olivier Jacot-Descombes
  • 104,806
  • 13
  • 138
  • 188
2

In a single-application-solution I usually do something like:

<Company name>.<Application name>.<Tier name>

where instead of name you can also use an acronym if it contains spaces or if it is too long.

I use this naming convention for each project/assembly.

My usually present tiers/layers are

DAL - my data access layer (eg EF)

Business - my business logic and entities

Facade - my presentation layer, in which I define application logic

UI - the actual user interface

Maarten
  • 22,527
  • 3
  • 47
  • 68
2

Tier and layer are sometimes used interchangably, but there is a subtle distinction. Tiers are physical and layers are logical. More: What's the difference between "Layers" and "Tiers"?

As for naming, it depends on what kind of project you're working on, and on what type of architecture you're going for.

For example, I've got a web project called Amber. It has these projects:

  • Amber.Logic (logic and data were combined into a single project/layer in this case)
  • Amber.Tests (tests)
  • Amber.Web (presentation)
Community
  • 1
  • 1
Brian MacKay
  • 31,133
  • 17
  • 86
  • 125