Questions tagged [business-logic]
174 questions
147
votes
10 answers
How much business logic should the database implement?
I've worked in some projects where most of the business logic was implemented on the database (mostly through stored procedures). On the other side, I've heard from some fellow programmers that this is a bad practice ("Databases are there to store…

Raphael
- 1,987
- 2
- 16
- 15
77
votes
5 answers
Why put the business logic in the model? What happens when I have multiple types of storage?
I always thought that the business logic has to be in the controller and that the controller, since it is the 'middle' part, stays static and that the model/view have to be capsuled via interfaces. That way you could change the business logic…

Steffen Winkler
- 905
- 1
- 8
- 11
54
votes
6 answers
Business logic: Database vs code
I'm a student of systems engineering, and all my teachers and friends (that actually work in the area) say that it is better to have as much logic as possible implemented in the database (queries, views, triggers, T-SQL, etc.). I think that it's…

Larizza Tueros
- 714
- 1
- 5
- 12
53
votes
3 answers
Where to put business logic in MVC design?
I have created a simple MVC Java application that adds records through data forms to a database.
My app collects data, it also validates it and stores it. This is because the data is being sourced online from different users. the data is mostly…

BriskLabs Pakistan
- 631
- 1
- 6
- 4
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…

Tulains Córdova
- 39,201
- 12
- 97
- 154
35
votes
3 answers
where exactly should python business logic be placed in django
I have just begun to learn Django/Python/Web Development. This problem has been troubling me for a while now.
I am creating an application with multiple templates in Django. I have a views.py which is basically just rendering the responses to the…

adrita
- 355
- 1
- 4
- 7
32
votes
2 answers
What does "business logic" actually mean if not "all non-3rd party code"?
I've heard people talk about business logic a lot at work, and online, and I've read several questions on this site about it, but the term still doesn't make a lot of sense to me. For example, here are some (paraphrased) statements I often…

Ixrec
- 27,621
- 15
- 80
- 87
29
votes
2 answers
How exactly should a CQRS Command be validated and transformed to a domain object?
I have been adapting poor-man's CQRS1 for quite some time now because I love its flexibility to have granular data in one data store, providing great possibilities for analysis and thus increasing business value and when needed another for reads…

Andy
- 10,238
- 4
- 25
- 50
25
votes
4 answers
What exactly is a business rule?
I'm trying to better organize my application architecture, so I've been doing some reading, but I keep running into references to "Business Logic" and "Business Rules". I've never really understood what these actually are. I generally just focus on…

hal
- 396
- 1
- 3
- 9
22
votes
6 answers
When should I use stored procedures?
If I have all my business logic in code and make use of Entity Framework, in what situations (if any) would I be better moving some business logic to a stored procedure, instead of keeping it all in code?
To be clear, I mean in conjunction with the…

Amy Barrett
- 473
- 2
- 5
- 12
22
votes
4 answers
Thick models Vs. Business Logic, Where do you draw the distinction?
Today I got into a heated debate with another developer at my organization about where and how to add methods to database mapped classes. We use sqlalchemy, and a major part of the existing code base in our database models is little more than a bag…

SingleNegationElimination
- 4,657
- 2
- 26
- 22
19
votes
7 answers
Business Objects - Containers or functional?
This is a question I asked a while back on SO, but it may get discussed better here...
Where I work, we've gone back and forth on this subject a number of times and are looking for a sanity check. Here's the question: Should Business Objects be data…

Walter
- 16,158
- 8
- 58
- 95
17
votes
4 answers
What is the difference between business and application logic?
Please note that I asked the same question on stackoverflow but they directed me to ask here.
While I am trying to discerne the difference between the application logic and business logic I have found set of articles but unfortunately there is a…

Mo Haidar
- 507
- 2
- 4
- 9
17
votes
6 answers
What is an example of a computationally impossible business problem?
I have coworker who refuses to accept the reality that Turing machines (and Von Neuman machines by extension) cannot solve their own halting problem stating:
You can do anything with enough time and money.
He also dislikes theoretical problems…

Jesan Fafon
- 281
- 2
- 7
17
votes
6 answers
Representing business rules with exceptions
I know it is expensive but (IMO) I believe it is a very good practice. I'm talking about rules like say, you can't save an Invoice if you are not a sales person... so in that case throwing an exception saying 'your are not authorized' or…

sebagomez
- 432
- 4
- 11