Shoud the classes have always have a connectivity in UML? [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
Should the classes always have connectivity in UML? For example, in the following diagram, class Zugriff is not connected to any other classes. It that a valid or correct class diagram in UML?

Yes. You SHOULD but not MUST.
Class diagram is UML structure diagram which shows the structure of the designed system at the level of classes and interfaces, shows their features, constraints, and relationships - associations, generalizations, dependencies, etc.
(from https://www.uml-diagrams.org/class-diagrams-overview.html)
These classes and interfaces should have a type of relationship so that it makes sense to put them together. A typical relationship is a generic (weak) use.

Related

is there a preferable relationship between classes? Why? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
is there really a preferable relationship between classes ? or it depends on the software we have ?
I know that we have is-a and has-a relationships in classes relations but, is there a one relation that is Confident and it most preferable between software-designers.
The only preferred relationship between classes is independence. Because independence means guranteed separation of concerns and freedom to evolve. (Joke)
But unfortunately independence is not very useful: Lots of lonesome classes will only help to solve lots of little isolated problems. If you really want to make something useful, you'll have to relate the right classes. And then, the only thing that matters is what relationship helps you to best address your needs. Sometimes it's inheritance (is-a), sometimes it's composition (has-a). It all depends on the context.
What your "doctor" probably meant was to prefer composition over inheritance. This is a useful advice. But it is a simple rule of thumb: it is not a universal truth.

Which package should an enum, which is a part of a domain entity, be kept in a Java project? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
In my case, I have a java package - domain with JPA entity classes.
One of these entities, say Employee, has an attribute - status. status will always be from the set {ACTIVE, INACTIVE}, hence I have defined an enum - Status.
I know this is a small thing, but I was thinking whether this enum (which has no table mapped in the RDBMS database), be kept in domain package itself, or should it be kept somewhere else so that domain contains only the actual domain classes.
Simple put it depends on your taste.
If this enum is only used for the purpose of defining the status of a single class - in your case Employee then I would put it in a subpackage of domain.
For example:
*.domain.enums (for all enums of that kind)
*.domain.model (for all entity classes)

Java: Inheritance vs Dependancy Injection "Autowired" [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I am using Spring framework usually with the common simple form:
Controller <-> Service <-> Repository
And I usually have a common services that I put inside a CommonService class and make all other serivces extends class.
A developer told me that it is better to inject the CommonClass in each service instead of using inheritance.
My question, Is there one approch better than the other? Do JVM or performance affected by one more than the other?
Update
There is no direct relationship between CommonService and other Services, it is not has-a or is-a relationship, it's like a utility service.
It is the principle of favoring composition over inheritance. If you inherit from a certain class, both are tightly coupled which makes it harder to keep separate things separate.
Unless an there is an is-entity relationship between the two, it is better to model a uses-entity relationship, because this allows for easier changes later on.
Of course it depends on the use case and it is more of a design and architecture question than a performance aspect.

Domain-Driven-Design Entities and Value Objects [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Does every type modeled in DDD have to be either an entity or a value object?
No, in DDD you can modelled the following types of objects:
Domain Event: A domain object that defines an event. Where a domain event is something that happened that domain experts care about.
Service: When an operation does not conceptually belong to any object. Following the natural contours of the problem, you can implement these operations in services.
Repository: methods for retrieving domain objects should delegate to a specialized Repository object such that alternative storage implementations may be easily interchanged.
Factory: methods for creating domain objects should delegate to a specialized Factory object such that alternative implementations may be easily interchanged.

What other classes do I need? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm looking to create an application that will be used to help find a suitable University for prospective students to attend (which is based on various criteria about themselves). The application will be used by prospective students to enter details about themselves and a list of Universities will be displayed based on their profile.
I'm on the design stage (class diagram and etc) and i'm currently thinking of some Java classes I need to produce to do this. So far I've only thought of two...
University class (to hold information about Universities)
Interface class (this the GUI display)
Can someone help suggest what other class that I will need to create this application? You can suggest as many as you like.
Take every noun in your application description. Make it into a class. See if you can write a more detailed description of your app. Use those nouns as classes as well.

Categories