c# - Which part of mvc design pattern represents the business logic? -
i little confused definition of business logic in programming because used develop without paying attention of these terminologies want developer.
while reading in wiki definition of business logic have read following definition:
in computer software, business logic or domain logic part of program encodes real-world business rules determine how data can created, displayed, stored, , changed.
and in website have read following definition example:
business logic portion of enterprise system determines how data is: transformed and/or calculated. example, business logic determines how tax total calculated invoice line items. routed people or software systems, aka workflow.
so wondering part of mvc represents business logic, controller or model or part in mvc?
i know controller responsible sending commands model responsible applying rules of business?
for example let's take above example of tax:
suppose got invoice data form in view, data directed controller tax calculated, calculate in controller or ask of external class compute or compute in model before updating database?
could example appreciated.
you can put tax calculation logic in controller, you're better off putting in model more loosely coupled. reasonable want calculate tax on lots of pages, don't put in lots of controllers, put in model can re-used.
if hear talking "fat" controllers vs "thin" controllers, they're talking about. devs advocate having little code in controllers (making them "thin") , acting relay/orchestrator off model.
i think term model
bit confusing though because in service oriented architecture (and functional languages matter), stress trying have "dumb" objects don't have functionality , refer dumb objects "models". when comes mvc, "model" refers business model, incorporates dumb objects hold values , services work on top of them.
Comments
Post a Comment