What is the design of the best class: calling pages by calling a class and a BLL page or calling BLL class?

If I have an object, say a custom class, say the First and Last Name properties, then the best way to populate it:

  • PAGE instantiates the class, and PAGE invokes the business layer for the popualte class. (In this case, the class is essentially a data container).

or

  1. The class itself not only has properties, but also has a method for invoking a business layer, fills itself, and returns itself to the page.
+3
source share
7 answers

I would go for the first. I think it is cleaner, and so your custom class can stand on its own, even if the business layer changes.

, MVC.

+5

, . - , ? ?

, , DAO/DTO. № 1 (DTO), . № 2 (DAO) - , , .

, , - №3, -, -, . , , ( , -).

, , , .

+3

. .

+2

factory abstract factory, - , . :

- ​​ , , . , . , , firstname lastname , , save().

-, , . -, , . , - / .

+1

-, reloadData(). -, - .

0

, . , . .

0

How about if the object has a .Save () method that calls the Business.Save () method?

Perhaps this stirs him too much.

0
source

Source: https://habr.com/ru/post/1710793/


All Articles