If I develop an application, I'll often use a project structure like this:


For each layer I'll create two assemblies. One for the interfaces and one for the implementation itself. In the layer "CrossCutting" is everything like logging, entities, configuration... If the project is really big, I'll separate each component in the "CrossCutting" layer into a separate assembly. In the application layer, there's my console/ui/web project.

This project structure can be applied easy on bigger projects. But for small project I think that this is oversized. So, after some time searching with google, I found a simple structure for smaller projects.

Domain (or BusinessObjects)
Utilities (or Helpers)

My problem with this structure is, I've no Idea what these layers represent. Can someone explain me these layers?


Three-tier architecture Wikipedia article already explains two of them:

  • Data access layer (DAL) is what contains the logic directly bound to the data. For instance, if your application uses Oracle database and later, you migrate to MongoDB, the data access layer is the only layer you are expected to rewrite.

    The goal of this layer is to abstract the access to the underlying data source for the business layer. For instance, it may load data from multiple tables and aggregate it before presenting a convenient to use result to the business layer. Another example is that the DAL can manage concurrency control, that is check that an entity changed by somebody else while a user was changing it.

  • Business layer (BL) is what (usually) contains the most important part of your application: the actual business logic, the reason why this application exists in the first place.

    For instance, you'll find here the accounting rules or rules processor if you deal with an application for accountants, or the actual calculus if you deal with scientific application.

Three-tier architecture also contains a third layer:

  • Presentation layer (PL), the one which deals with presenting the information to the user (in a case of an end-user application) or the caller (in a case of a web service), and, inversely, processing (which also means sanitizing) the input.

As for the other layers listed in your question:

  • Core contains the framework developed specifically for your project. For example, if you're writing a web application, you may extend the existent web framework with functionality you'll need in this specific project, such as a fancy URL rewriting or the part which loads application configuration.

  • Services is like DAL, but for different services. For instance, if you are using Google APIs, you may put all the logic which makes the actual calls to Google servers in this layer.

    Similarly to the DAL, it makes it possible to switch easily between the service providers; for instance, switch from Google Maps API to Bing Maps API.

  • Utilities contains the utility methods. Make sure you read this and that to understand why utility methods should be avoided if you care about OOP.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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