2

My presentation has an Array which contain field names and their values. More precisely, each value is an object (like "User" for example) of the Model.

I would like to know if the presentation itself should perform checking on the content of those fields or should it be done by a contained class?

2

Depend of a lot of points.

In a conventional way, the presentation layer should care about how the data is presented on the UI to final users. Just it. We usually have what we call as business layer (BL) and it give some treatments on the data, which has retrieved from the data access layer (DAL) before going to the presentation layer (UI).

Said that, it is not a rule you must follow, but it is a best pratice of the software architecturing;

  • So if I understand, BL and DAL are part of the Model right? – Freddykong Apr 9 '18 at 14:26
  • 1
    They are part of the architecture. The model is about your domain (entities). – Felipe Oriani Apr 9 '18 at 14:29
  • 1
    I enjoy domain driven-design approach. There is a book from Eric Evans which present how to deal with it. Martin Fowler's website is a good one as well. – Felipe Oriani Apr 9 '18 at 14:41
  • 1
    @Freddykong: No, BL is the Model. The business layer defines the domain model. MVP is not exactly an architecture, it's more of an architectural pattern (some would even call it a design pattern) concerned with decoupling the view(s) from the (domain) model. The DAL is not a part of MVP - it's on the "other side" of the BL (that is, it usually exists in the same application, but is outside the scope of the MVP architectural pattern). – Filip Milovanović Apr 9 '18 at 15:24
  • 1
    Also, in MVVM (a variant of the Presentation Model pattern as described by Fowler), there's something called ViewModel - but this is not the same as the (domain) Model described above. A ViewModel is not a part of the domain (BL), but is a part of the presentation - it represents and describes the behavior of the view (and some binding between the controls and the view model is usually involved). Note that you still have a (domain) model in MVVM (it's just not in the name). – Filip Milovanović Apr 9 '18 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.