java - Which class should do the work? -


i building sales system dissertation , keep debating myself in design, class should doing work?

so these 3 classes;

facility class - class central class coordinator between others , gui

product class - represents details of product

sales class - represents sale of multiple items

when comes selling products, big question is:

"which class should calculate total price". facility class or sales class?

whats best practice?

thanks in advance

my first impulse order these classes responsibility regarding model-view-controller design (because mention gui , interfacing class it).

  • facility - according statement controller, connects gui (view) data (models).
  • product - model class, since holds data , business logic.
  • sale - class connected multiple products , multiple products share same sale, because product can sold more once (this assumption) , sale can include multiple products. model class.

since sale class represents multiple products , interested in (e.g.) sum of individual prices of these products, place store method.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -