Skip to main content

Questions tagged [business-logic]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
148 votes
10 answers
76k views

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 ...
Raphael's user avatar
  • 1,997
79 votes
5 answers
110k views

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. ...
Steffen Winkler's user avatar
54 votes
3 answers
73k views

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 ...
BriskLabs Pakistan's user avatar
54 votes
6 answers
13k views

Business logic: Database vs code [duplicate]

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, ...
Larizza Tueros's user avatar
45 votes
6 answers
16k views

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 ...
Tulains Córdova's user avatar
35 votes
3 answers
23k views

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 ...
adrita's user avatar
  • 355
32 votes
2 answers
11k views

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 ...
Ixrec's user avatar
  • 27.8k
29 votes
2 answers
14k views

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 ...
Andy's user avatar
  • 10.3k
25 votes
4 answers
25k views

What exactly is a business rule? [duplicate]

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 ...
hal's user avatar
  • 396
22 votes
4 answers
6k views

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 ...
SingleNegationElimination's user avatar
22 votes
6 answers
20k views

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 ...
Amy Barrett's user avatar
19 votes
4 answers
30k views

What is the difference between business and application logic? [closed]

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 ...
Mo Haidar's user avatar
  • 527
19 votes
7 answers
1k views

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. ...
Walter's user avatar
  • 16.1k
17 votes
6 answers
5k views

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 ...
sebagomez's user avatar
  • 432
17 votes
1 answer
35k views

Business logic vs Service layer

I read this answer: https://softwareengineering.stackexchange.com/a/234254/173318 please correct my understanding. Business rules refers to list of steps of business in real world (no codes). ...
Kakashi's user avatar
  • 309
17 votes
3 answers
9k views

Where should business logic sit in microservice architecture?

Still trying to wrap my head around microservice architecture since I'm used to a monolithic approach Suppose we try to build a extremely simplified Uber booking system. To simplify things we let's ...
GantengX's user avatar
  • 303
17 votes
6 answers
3k views

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 ...
Jesan Fafon's user avatar
14 votes
6 answers
5k views

Separating business logic from data tempts me to use instanceof

class Foo { abstract doStuff() {} } class Bar extends Foo { doStuff() { ... } } class Baz extends Foo { doStuff() { ... } } From a functional perspective doStuff does exactly the same ...
Alexandre DUPONCHEL's user avatar
13 votes
3 answers
471 views

Using static type checking to protect against business errors

I'm big a fan of static type checking. It prevents you from making stupid mistakes like this: // java code Adult a = new Adult(); a.setAge("Roger"); //static type checker would complain a.setName(42)...
J-bob's user avatar
  • 299
13 votes
2 answers
661 views

Pair programming business logic with a non-IT person [closed]

Have you had any experience in which a non-IT person works with a programmer during the coding process? It's like pair programming, but one person is a non-IT person that knows a lot about the ...
Tulains Córdova's user avatar
12 votes
3 answers
492 views

How to educate business managers on the complexity of adding new features? [duplicate]

We maintain a web application for a client who demands that new features be added at a breakneck pace. We've done our best to keep up with their demands, and as a result the code base has grown ...
Derrick Miller's user avatar
12 votes
4 answers
14k views

Business Objects within a Data Access Layer

So I've been creating a data access layer via TDD and have approached somewhat of a concern. I'd rather not start down the wrong path, so I figured I'd ask you guys to see if my thoughts were in line ...
user avatar
11 votes
2 answers
3k views

Should I use "Business logic" term when speaking about non-business application?

Suppose there is a part of program that does not deal with initialisation, input, output. It just specifies what should be done, what is allowed or not. I use the term "Business logic" for this. But ...
Vi0's user avatar
  • 374
11 votes
6 answers
13k views

Separation of retrieving data and business objects between DAL and BLL Layers

I did some research before posting this question. Among other questions or post, one of those is provided below. I could not get a clear mind how to determine.. Business Objects within a Data Access ...
ShamirDaj's user avatar
  • 111
11 votes
3 answers
3k views

Entity Framework and avoiding the Anemic Domain Model

In our business logic we occasionally have methods defined something like this: User.ResetCourse(Course courseToReset) The problem is that both User and Course are Entity Framework proxy objects. ...
Calin Leafshade's user avatar
10 votes
4 answers
6k views

Does business logic really belong on the server?

A typical stack for a web application is a database, a server with server-side code, and a user with a browser with HTML/CSS/JavaScript. Before extensive AJAX, MVC in which the controller was the ...
Joe's user avatar
  • 481
10 votes
5 answers
1k views

Presentation Layer Accessing Business Logic

I've been reading a lot of material lately about DDD (business entity objects) and other common patterns in n-tiered(layered) architecture. One thing I have issue with is, most articles, blogs, ...
HardCode's user avatar
  • 634
10 votes
3 answers
8k views

How acceptable is to keep business logic outside entities (in separate service classes)?

We were taught that objects are self contained things with data and behaviour and therefore they should have methods that act on their attributes. But there are several situations when this coupling ...
TomR's user avatar
  • 1,003
9 votes
3 answers
1k views

What is the object-oriented thought process? [closed]

I've been studying OOP in conjunction with Zend's MVC implementation for the past few months. I'm pretty new to programming, generally, but I feel strongly that I should learn things the 'right' way, ...
user avatar
8 votes
6 answers
414 views

How to improve my trade

I'm currently working as a software developer and studying for a software engineering degree (the former whilst not doing the latter). I'm confident in my ability to do my job competently, but I feel ...
Andy Hunt's user avatar
  • 6,046
8 votes
3 answers
3k views

Should access logic go in controllers?

I want to know if all the logic related to permissions and access control belongs to controllers (Application logic) or models (Business logic). Currently I have a controller that does something like ...
IAmJulianAcosta's user avatar
8 votes
2 answers
2k views

How much logic can be put into a command? Or differently: What kind of logic is command pattern for?

I have been using the command pattern for quite some time but I'm never really sure how much logic I can actually put in the Execute method. My current implementation of the command pattern looks ...
t3chb0t's user avatar
  • 2,534
8 votes
2 answers
2k views

What layer to introduce human readable error messages?

One of the things that I have never been happy with on any project I have worked on over the years and have really not been able to resolve myself is exactly at what tier in an application should ...
MrLane's user avatar
  • 629
8 votes
1 answer
6k views

Project structure: where to put business logic

First of all, I'm not asking where does business logic belong. This has been asked before and most answers I've read agree in that it belongs in the model: Where to put business logic in MVC design? ...
Mister Smith's user avatar
  • 2,977
8 votes
1 answer
7k views

Hooking up a Business Layer and Repository using Unit of Work Pattern

My question is similar to this one on Stack Overflow: What is the correct way to use Unit of Work/Repositories within the business layer? Scenario: .Net solution IRepository used to retrieve objects ...
glosrob's user avatar
  • 245
7 votes
4 answers
19k views

The best possible way to implement Business Rules in PHP

I'm planning to write an e-commerce app using PHP & MySQL with lots & lots of custom rules. Say for example, I want to have a rule like "Give Customer X, a 10% a discount for Product Y if he ...
Mithun John Jacob's user avatar
7 votes
5 answers
4k views

How to tackle complex business rule and logic?

I have a domain expert to work with, but he would throws a lot of details to me verbally. The business logics are complex, business rules change often, the business process is long and multi-ending / ...
Henry's user avatar
  • 289
7 votes
6 answers
2k views

Desktop to Web - How to deal with user-interactive workflows

I start a new project this summer, consisting in developing a web version of a proprietary desktop ERP. The main goal of my company is to be able to propose a web version of its ERP, with all ...
OlivierH's user avatar
  • 129
7 votes
4 answers
6k views

How should UI layer pass user input to BL layer?

I'm building an n-tier application, I have UI, BL, DAL & Entities (built from POCO) projects. (All projects have a reference to the Entities). My question is - how should I pass user input from ...
BornToCode's user avatar
  • 1,273
7 votes
1 answer
3k views

Domain Objects and How they Access the Database

Suppose I have the following class: public class Course { // data public string Name { get; } public List<Student> Students {get;} //... // logic public int ...
Husain's user avatar
  • 309
6 votes
3 answers
776 views

Is it good practice to put service business logic based on audit trail?

Our application creates audit trails in response to system actions and user actions. Our business logic depends on these audit trails to find out which user performed what action. Is it good practice ...
Durgaprasad Budhwani's user avatar
6 votes
2 answers
3k views

Should Extensions methods be used for Business logic

In C# we have Extension methods. Extension methods enable you to add methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type. ...
user avatar
6 votes
1 answer
432 views

Should data model logic live in database schema?

(Apologies if some of my terminology is off, I have not seen much on this subject and am using be best terms I could come up with) Should data model logic live in the database schema? I am making a ...
Entith's user avatar
  • 338
6 votes
3 answers
6k views

Onion architecture: layer placement of business logic

Where should the business logic for a project that utilizes Onion Architecture be placed? In my case, it's a C#-based project, utilizing Web API and possibly a MVC UI for the presentation. But ...
Adam Plocher's user avatar
6 votes
2 answers
4k views

How to structure business layer logic (app with much complicated business layer logic, calculations etc.)

We are developing a.NET web application that uses WebApi. We have separate layers: UI (HTML, CSS, js etc.) ApiController - receives input DTOs from the UI and calls the appropriate endpoint in the ...
renathy's user avatar
  • 177
5 votes
4 answers
7k views

Separation of application logic and domain logic in Clean Architecture

I'm struggling with the separation of logic between entities and interactors or Use Cases. If I design the entities with DDD principles, each entity would have methods corresponding to use cases, ...
FedericoG's user avatar
5 votes
2 answers
5k views

Is it a good practice to burn business logic into Enums?

Let's have a simplified business logic like this: public enum BusinessLogic { STAGE_ONE(true, false, false), STAGE_TWO(true, true, false), STAGE_THREE(false, false, true); private final ...
CsBalazsHungary's user avatar
5 votes
4 answers
17k views

Entirely separate business logic layer from MVC

We are currently refactoring our controller methods in ASP.NET MVC application. At the beginning we've separated data access layer (our goal was to remove LINQ from controllers entirely). Now we are ...
hugerth's user avatar
  • 65
5 votes
2 answers
638 views

How to clean up a business logic class that does too many things without injecting a ton of classes into it?

Let's say we have business logic to perform in an MVC framework after a user submits a form: class BusinessLogic: def sendDataTo3rdPartyApi(self): # do stuff def validateResponse(self)...
Robert Calove's user avatar
5 votes
2 answers
2k views

How to keep track of growing catalog of business rules?

Building my last application, everbody started to lose control over the increasing complexity of business rules, which would be added every week - most of all the app owners themselves. In the end, we ...
Hans's user avatar
  • 416