I'm confused about the structure and 'Where to put What?" of a modern and usual web application, more importantly, its business rules & business logic.
By the way, by business logic, I mean the ifs and conditions for doing an operation. (For example a simple condition for signing up is that the email or username couldn't be duplicate)
Say I have an ordinary e-commerce system, and I want to use ASP.NET MVC for it.
So, here I have two primary questions:
-
Where should I write the business logic of that application? If I have a web API, are its methods a good place to write business logic? Or if I don't have a web API, are MVC controllers a good choice? Or should all business rules be in the models? Or even should I have for example a separate class called "FooService" that contains methods which do operations around "Foo" entity? I'm really confused about it...
-
My second question might be weird! But is there even a specific and constant structure? Or is it completely opinion-based?
Aucun commentaire:
Enregistrer un commentaire