In which components you should put your complex business logic?

In which components you should put your complex business logic?

In a traditional, multi-layered architecture, front-end side of the application occupies two of them: presentation and a part of business logic layer. Components, which are the primary construction blocks in Angular 2, make up the presentation tier, while services pertain to the business-logic one.

Which part of MVC does business logic?

Model part
A1: Business Logic goes to Model part in MVC . Role of Model is to contain data and business logic. Controller on the other hand is responsible to receive user input and decide what to do. A2: A Business Rule is part of Business Logic .

Where should I put business logic?

The business logic should be placed in the model, and we should be aiming for fat models and skinny controllers. As a start point, we should start from the controller logic. For example: on update, your controller should direct your code to the method/service that delivers your changes to the model.

Why is SQL not a good place for business logic?

SQL is a horrible choice when it comes to encoding the business rules of your system. It isn’t flexible enough and we can’t rely on it to express any more or less complex domain model because it lacks the ability to create proper abstractions. And that is the single most important reason why we shouldn’t use it as a place for business logic.

Where do you Put your business logic in stored procedures?

So you should put all your business logic in stored procedures? No, personally I believe that you should only put in the code that must be run locally to where your data is. When you do put logic in your stored procedures then it should have unit tests (tSQLt really helps here).

Which is a good use case for SQL?

Data processing should occur in the more suitable place – our application code: The other use case for SQL is read-only SELECT queries. Even with the advent of LINQ providers in C# and type providers in F#, it is sometimes hard to write a query of comparable performance in the application code.

Which is better stored procedure or SQL code?

Stored procedures are great for speed if you are quickly iterating over DB rows, as it saves the travel-time and costs of shipping the data from the DB to the software over the wire; however there are some truly horrific disadvantages. 1) Difficult/Expensive to code.