Skip to main content
126 votes

Need Good OOP Design For World and Countries Problem

I wouldn't use any form of inheritance for World and Country. The World is not a Country, and a Country is not the World. Instead, the World is a "bag" which contains many Countries. By "bag" I ...
Simon B's user avatar
  • 9,633
24 votes

ERD: "many" vs "zero or many"/"one or many" crowfoot notation?

The 2 first relations, One and Many, have an unspecified lower bound. So when using them you leave an ambiguity of whether they are mandatory or optional. This ambiguity is useful in modeling, in ...
Christophe's user avatar
  • 78.4k
19 votes

Need Good OOP Design For World and Countries Problem

Here is a thought or two: Are you sure you even need to model the World? Based on your description it doesn't seem to have any effect. Yes it encapsulates your Countries, but if thats all the program ...
Jakob Busk Sørensen's user avatar
12 votes

Need Good OOP Design For World and Countries Problem

I think your first requirement is the most telling: World is a collection of countries The remaining requirements go on to talk about countries, leaders and alliances. There is one thing I'm sure ...
Greg Burghardt's user avatar
8 votes

Need Good OOP Design For World and Countries Problem

Is the world a country ? Your most basic entity is the Country. The World is the aggregation of all the countries (193 member states according to the United Nations). Clearly, World has no president ...
Christophe's user avatar
  • 78.4k
8 votes
Accepted

Many to many relations in Domain Driven Design

Just because you have a many to many relationship at a data or database level, doesn't mean it has to be represented in code. You should model for the relationships you care about or are useful to you....
Ryathal's user avatar
  • 13.5k
7 votes
Accepted

How to show relationships of the component containing the interface definition when using ball/socket notation in a UML Component Diagram?

The goal of a component diagram is not the same than a class diagram. Nor is it an alternative to package diagrams. The focus of component diagrams is on self-standing, replaceable components, and ...
Christophe's user avatar
  • 78.4k
7 votes
Accepted

What is the difference between containment and aggregation relationship in UML?

There is a lot of confusion about the terms, not all definitions you may find will align. Containment means the containing object does not directly expose the contained object. It exposes its own ...
Martin Maat's user avatar
  • 18.4k
7 votes
Accepted

Designing a REST API resource with a non-unique ID, but unique composite ID

There are no hard rules for how to build URLs in REST, only common sense and best practices (here is for example one such guide, out of many). From a REST point of view, it's not important how the ...
Bogdan's user avatar
  • 3,620
6 votes
Accepted

Proper way to associate data to users that are stored in external database?

Your design doesn't change much. You still have the same foreign-key relationship. However, your database can no longer apply any foreign-key constraint. You will have to check the validity of IDs ...
amon's user avatar
  • 135k
5 votes
Accepted

Factory pattern or builder pattern ? which one is suited for reading Finite Element Model data from a text file?

You are trying to solve a data access problem, and it requires a data access solution. First, let's examine your proposed solutions, and why they don't solve the problems you have. The Factory ...
Greg Burghardt's user avatar
5 votes

UML : is it okay to use only Association in a class diagram ?

Here's why this is so confusing: c-sharpcorner.com | Dependency, Generalization, Association, Aggregation, Composition in OOP | Ownership | Lifetime dependency | Association | ...
candied_orange's user avatar
5 votes

ERD: "many" vs "zero or many"/"one or many" crowfoot notation?

I think people just use them just when they don't care enough about being specific. Personally I avoid the first two examples on your list entirely. For your example, I would assume -- from the ...
Darien's user avatar
  • 3,473
5 votes
Accepted

How can I mark one of a 1:n relation as the "default"?

There is usually a joiner table between Company and Address in a many to many relationship. Let's call it Company_Address. Company_Address would have Company_Id and Address_Id with relations to ...
Jon Raynor's user avatar
  • 11.6k
5 votes
Accepted

Looking for a strategy to ensure name of child node stays unique in collection

Uniqueness of those names is a property which is clearly defined only in context of a Pages collection. That is most easiest understood when you think of a Page object changing its "parent" container, ...
Doc Brown's user avatar
  • 209k
5 votes
Accepted

UML Use Case Diagrams Relationship - Required / Optional AND independent

Use-cases are not intended to have any sequencing between them. Use-cases are meant to represent interactions with the system that are of value for the actors (i.e. use cases correspond to goals ...
Christophe's user avatar
  • 78.4k
4 votes
Accepted

How to represent relations between multiple objects without obvious aggregate root

IMHO you should start by getting the model right first. I would not expect a Call to occur in more than one CallQueue at a time, so this is just a 1:M relationship. Moreover, since an Agent can only ...
Doc Brown's user avatar
  • 209k
4 votes
Accepted

Can the has-a relation in OOP become ambiguous or difficult to know?

Typically, when you are introduced to the terms of is-a and has-a, you mostly learn them as opposed to one antoher is-a ≠ has-a ( I borrowed the notation from linguists ). Both terms are used like ...
Thomas Junk's user avatar
  • 9,583
4 votes
Accepted

UML : is it okay to use only Association in a class diagram ?

Yes, of course it's okay. Both aggregation and composition are types of association. So what you create might not have all the detail it could have but it will still be correct. You can always add ...
Frank Puffer's user avatar
  • 6,429
4 votes

UML aggregation: how can the "whole" exist without its "parts"?

Composition means mine! Keep your hands off. Aggregation means look what showed up here. Association means look what I can find. Let's try giving these examples some actual stories. If a car is ...
candied_orange's user avatar
4 votes

UML aggregation: how can the "whole" exist without its "parts"?

Aggregation is defined by UML as a „property that has a shared semantic“ (section 9.5.3): Indicates that the property has shared aggregation semantics. Precise semantics of shared aggregation ...
Christophe's user avatar
  • 78.4k
4 votes
Accepted

Best notation to store/read/compute complex relationships

If you already have users and tasks as entities in a relational schema, I think it makes most sense to store the assignments as entities and relations as well. This is pretty straightforward: each ...
Doc Brown's user avatar
  • 209k
4 votes
Accepted

OOPS Relationship between Soccer Field and Soccer Player

How to represent that a player belongs to a SoccerField? Can I have a reference to the SoccerField in a player? SoccerField field; ----> Is this an acceptable design? Yes, you can have a reference ...
Bart van Ingen Schenau's user avatar
4 votes
Accepted

UML Composition parent association end

The composite pattern does not assume that it's an UML composition (black diamond) in the general case: The UML composition implies ownership, i.e. responsibility for the lifecycle of the composed ...
Christophe's user avatar
  • 78.4k
4 votes

Many-to-many modeling for microservices

In what sane world does the administration of two simple lists - students and courses - get managed by separate teams? Where you have an interface between two databases, you typically have to accept ...
Steve's user avatar
  • 9,022
3 votes

ERD: "many" vs "zero or many"/"one or many" crowfoot notation?

I typically use the -< "many" notation when writing fast on a whiteboard. It's useful there because we're just trying to sketch a general idea. Vagueness is sometimes helpful at this stage. The ...
joshp's user avatar
  • 3,491
3 votes

Database Schema for Pricing Products (packages, promotions, qty based, limited time offer...)

Although its a 3 years old thread, still I'm replying it thinking that it might be helpful to somebody. Table Structure Table_Offer -------- ID FK Name start time end time MandatoryGroup ---...
123456's user avatar
  • 131
3 votes

Best diagram to show relations between several applications

UML deployment diagrams (using only the notation defined in the OMG specification) can contain notes as well as annotations on the associations between nodes. You can add directionality to the ...
Thomas Owens's user avatar
  • 83.3k
3 votes
Accepted

Imposing conditional entity relations

Consider having a Rule table. For each row in a Rule table, you have a row in RuleCondition, a row in RuleAction, and n rows in RuleParameters. RuleCondition describes the conditions for which the ...
Neil's user avatar
  • 22.8k
3 votes

Can we have a ternary relationship together with a recursive one in E-R diagrams

Your model does not correspond to your narrative. It says: A user can create a contest A user can invite another user to a contest. The inviting user doesn't need to be the creator. He/she doesn'...
Christophe's user avatar
  • 78.4k

Only top scored, non community-wiki answers of a minimum length are eligible