Re: [Cppcms-users] Why a single view per content class?
Brought to you by:
artyom-beilis
From: Joerg S. <jo...@br...> - 2015-05-06 09:03:51
|
On Wed, May 06, 2015 at 12:56:09AM -0600, Erasmo Aguilera wrote: > "As a rule of thumb we name them the same way as the corresponding content > classes." > > According to this statement, one should have a single view per model > (content) class. No, it just means that such a correspondence is typical. > However this does not fit well to the concept of view, as its primary intent > is to potentially provide several representations of the same model. For > example, one might want a Create, Edit and Read view of a same model of > class Employee. I would still have a separate content class for each view. Note that you can use inheritance or membership to factor out common entries. The advantage of separate classes is you get a certain degree of type safety. Joerg |