SCJP, SCWCD, SCBCD, SCEA 5
Examples of components are EJB, servlets, JSP, major POJO, and important Managers, Controllers...
Sun Certified Developer for the Java 2 Platform
Sun Certified Enterprise Architect for the Java Platform, Enterprise Edition 5
When talking about "interfaces" in component diagrams, you should not interpret the word "interface" only in the strict sense of a Java language interface definition
SCJP, SCWCD, SCBCD, SCEA 5
SCJP, SCWCD, SCBCD, SCEA 5
And, in the case of a backing bean, you are correct in that the backing bean is declared in the faces-config.xml, referenced by a logical name, and used via the expression language. As a result there's no real dependency on its type so you could swap it for another that exposes the same functionality
Dependencies can then be expressed more succinctly as dependencies between subsystems.
this is not good type of dependency
SCJP, SCWCD, SCBCD, SCEA 5
Rob Rider wrote:
In this case dependencies between these subsystems will be like "presentation subsystem uses everything from domain subsystem", this is not good type of dependency . Of course, there is a solution - create numerious DTOs in Services or Presentation, but in this particular design these DTOs will duplicate domain objects. Could you please suggest another approach?
SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
And I don't see how DTO would be a solution
SCJP, SCWCD, SCBCD, SCEA 5
Jonathan Aotearoa wrote:
And I don't see how DTO would be a solution
I was talking about DTOs, for want of a better term, in the context of adding a layer of abstraction between a volatile domain model and the presentation tier. But as I said you can also achieve the same degree of abstraction using Interfaces. If your domain model changes you simply implement a set of adapters to wrap your domain objects.
SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
I don't get why you think it's not *good type of dependency*?
What criteria do you use to judge what is "good type", and what is "bad type"?
If use DTO, we need to add attribute in ModelA, and add in DTO and change View. How does that help?
But as I said you can also achieve the same degree of abstraction using Interfaces.
Rob Rider wrote:
I don't get why you think it's not *good type of dependency*?
What criteria do you use to judge what is "good type", and what is "bad type"?
I have in mind that such type of dependency violates component concept as "A physical, replaceable part of a system that packages implementation and
conforms to and provides the realization of a set of interfaces". In this case tightly coupled subsystems are not replaceble and do not provide the realization of a set of interfaces.
A component can always be considered an autonomous unit within a system or subsystem. It has one or more provided and/or required interfaces
Rob Rider wrote:
If use DTO, we need to add attribute in ModelA, and add in DTO and change View. How does that help?
If we talking about single attribute then there is no problem to be solved via DTO. But if we have a set of large and complex domain objects and tens of use cases it will be very unsafe and inconvenient for presentation level to operate directly the domain objects. Each use case should operate a particular subset of domain functionality and this subset may be collected and delivered to presentation level via DTOs. In my small design this approach is not necessary, but may be used for domain isolation.
SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
Where do you get that description?
And a tightly coupled subsystems are replaceable, why not? It can be replaced with other component thats provide the same functionality.
First I think we shouldn't use term DTO, because what we are discussing is not DTO, let's call it Value Objects [DDD].
I'm not sure what you mean by unsafe? View should do only display, how displaying is unsafe?
Regarding, inconvenient why do you need to care? It's the job of View layer after all. If it contains reuseable part, you can create a UIRenderUtil class and put complex logic in that class for View layer to call.
You know, using Value Object is tight coupling than using domain model. If you have 10 Views, each view displays the same models differently, what should we do? Create 10 Services that return 10 different Value Objects for different View? We should put presentation logic in each view instead. How to render? how to display? Those are responsibility of View.
SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
Yup, yup, yup. Tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
|