1
Where I put the code that does not concern the business rule, but is a necessity for the presentation to the user, such as filling out combobox, dataTables, texboxAutoComplit...?
details:
Currently working in layers (Presentation, application, Domain, data...) we try to model as close as possible to the business rule using ubiquá language, separating delimited contexts, creating aggregates, entities, objects... full DDD package, however when it comes to developing the Presentation we end up "dirty" some interfaces with methods to meet the demand of display frameworks. For these queries we are referencing the date to Presentation however still does not get good enough.
It’s Web, Mobile, Desktop?
– Gabriel Coletta
all in fact hehehe, is a Presentation for each user interface, in some projects can have only one in others a 5, depends a lot....
– João Rafael Colombo
For me still confused the idea of, for example, filling up combobox, you say how I will say what will be inserted inside the combobox?
– Gabriel Coletta
Let me try it another way: You have a product, it has behaviors, attributes, domino services, services and CRUD standard repository, here comes the horizon, the need to implement a datatable for the fornt end. For this you will need some 3 methods; these methods have nothing to do with the business/ behavior of the Product, so where do they put? along with the CRUD methods "soiling" the behavior? or elsewhere (I do not know where) to stay separate?.... Understood? :)
– João Rafael Colombo
You mention the need for 3 methods...just to understand your situation: what would be the purpose of them?
– Caiuby Freitas
would be like: fetch the product according to what the dataTablepede api(https://datatables.net/); or fetch a list with the description and id for popular in the combobox; or a paged list for presentation; or qqr similar thing that you need only for the end user but that has nothing to do with the business...
– João Rafael Colombo
For paging I see no problem, I believe there should always be pagination in the queries, but an optional pagination(
skip
andlimit
, which can be zero and then the method does not page the result). As for the list with description and id, for me this is the responsibility of the Presentation layer, it will get the Product as it is, and it will map your view model. The same applies to how the product will be displayed by Datatable, is a view model, and it is up to the Presentation to adapt the product to your display needs.– L. Albano