Questions tagged [layers]

Layer (or abstraction level, or a layer of abstraction) is a way of hiding the implementation details of a particular set of functionality.

185 questions
454
votes
12 answers

How accurate is "Business logic should be in a service, not in a model"?

Situation Earlier this evening I gave an answer to a question on StackOverflow. The question: Editing of an existing object should be done in repository layer or in service? For example if I have a User that has debt. I want to change his debt.…
Jeroen Vannevel
  • 5,736
  • 6
  • 18
  • 27
69
votes
4 answers

Uncle Bob's clean architecture - An entity/model class for each layer?

BACKGROUND : I'm trying to use Uncle Bob's clean architecture in my android app. I studied many open source projects that are trying to show the right way to do it, and I found an interesting implementation based on RxAndroid. WHAT I NOTICIED : In…
Rami Jemli
  • 791
  • 1
  • 6
  • 6
66
votes
13 answers

Why is it a good idea for "lower" application layers not to be aware of "higher" ones?

In a typical (well-designed) MVC web app, the database is not aware of the model code, the model code is not aware of the controller code, and the controller code is not aware of the view code. (I imagine you could even start as far down as the…
Jason Swett
  • 1,860
  • 1
  • 16
  • 19
45
votes
6 answers

Do stored procedures violate three-tier separation?

Some colleagues of mine have told me that having business logic in stored procedures in the database violates the three-tier separation architecture, since the database belongs to the data layer whereas stored procedures are business logic. I think…
36
votes
5 answers

Which layer do DDD Repositories belong to?

In his DDD book Evans promotes the idea of layered architecture, and in particular that the business logic should be confined to domain layer and separated from UI/persistence/other concerns. He also introduces Repository pattern as a mean to…
Alexey
  • 1,199
  • 1
  • 9
  • 18
27
votes
2 answers

Does it make sense to use ORM in Android development?

Does it make sense to use an ORM in Android development or is the framework optimized for a tighter coupling between the UI and the DB layer? Background: I've just started with Android development, and my first instinct (coming from a .net…
Heinzi
  • 9,646
  • 3
  • 46
  • 59
18
votes
7 answers

Can it be useful to build an application starting with the GUI?

The trend in application design and development seems to be starting with the "guts": the domain, then data access, then infrastructure, etc. The GUI seems to usually come later in the process. I wonder if it could ever be useful to build the GUI…
Grant Palin
  • 1,721
  • 2
  • 14
  • 28
14
votes
3 answers

Is it problematic to have a dependency between objects of the same layer in a layered software architecture?

Considering a medium-big software with an n-layer architecture and dependency injection, I am comfortable to say that an object belonging to a layer can depend on objects from lower layers but never on objects from higher layers. But I'm not sure…
bracco23
  • 399
  • 1
  • 8
14
votes
1 answer

Onion architecture vs 3 layered architecture

I see only benefits to the onion architecture over the 3 layered architecture where the BL had responsibility to call methods on DAL (or an interface of DAL) to do CRUD. The onion has better separation of concerns, testability, maintainability and…
BornToCode
  • 1,273
  • 2
  • 13
  • 16
13
votes
3 answers

Validation and authorization in layered architecture

I know you are thinking (or maybe yelling), "not another question asking where validation belongs in a layered architecture?!?" Well, yes, but hopefully this will be a little bit of a different take on the subject. I am a firm believer that…
SonOfPirate
  • 2,885
  • 4
  • 25
  • 28
12
votes
2 answers

How is transactionality implemented in DDD applications?

I have been searching and reading recently about DDD and, so far, I think I understood its fundations. If I understood well, the architecture is similar to this: Database <--SQL--> DAO/ORM <--CRUD--> Repository/Aggreagtes <--Business--> **¿?** <--…
Laiv
  • 14,283
  • 1
  • 31
  • 69
12
votes
3 answers

Entity Framework and layer separation

I'm trying to work a bit with Entity Framework and I got a question regarding the separation of layers. I usually use the UI -> BLL -> DAL approach and I'm wondering how to use EF here. My DAL would usually be something like GetPerson(id) { //…
mRf
  • 185
  • 1
  • 2
  • 8
11
votes
4 answers

What layer should contain interactions with external or remote resources which are not strictly data operations?

Assume an application with a layered architecture, i.e. presentation, business/domain/logic, data access: it makes sense to plug access to external APIs in at the data layer if what they do resembles data operations. For instance, a DLL that…
rory.ap
  • 879
  • 1
  • 10
  • 26
10
votes
3 answers

Presentation VS Application layer in DDD

I have trouble drawing a clear line between Presentation and Application layer in Domain Driven Design. Where should Controllers, Views, Layouts, Javascript and CSS files go? Is it in the Application or the Presentation layer? And if they go all…
Matthieu Napoli
  • 615
  • 2
  • 6
  • 13
9
votes
2 answers

GUI, BLL, DAL Organization In A Project

I'm reading about application layers, and want to use this design in my next project (c#, .Net). Some questions: Is the separation of layers done through namespaces? Project.BLL.Whatever, Project.DAL.Whatever Is it more appropriate to separate by…
sooprise
  • 1,065
  • 2
  • 12
  • 17
1
2 3
12 13