What is relationship and relational model outside of the database context?

Asked

Viewed 81 times

2

What would be relationship and relational model in the contexts below (removed from here)?

Context 1:

Double-Dispatch

Maniero: I agree and I think [the lack of double-Ispatch support or the view that it is necessary to apply double-Ispatch] one of the biggest problems of the whole mechanism. Sufficient to disqualify the use where it should not.

It’s too abstract an example for me to say, but it’s very common for this problem to arise when you try to model something that doesn’t actually exist, when you try to use OOP where it doesn’t fit, maybe a relationship would be more appropriate.

My perception is that this occurs too much in the use of OOP.

Here comes the problem I talk about, the person is so blind to using OOP for everything she can ignore that has easier ways to solve the problem. The relational model it’s usually easier for people to understand.

EDIT 1: The @prmottajr’s (deleted) answer almost killed the question by citing relationship between entities and remind me that relationship may be referring to associations in the domain model. But the question actually wants to know how the terms apply in the aforementioned contexts, so it takes a little more detail. In the case of the above context, what I don’t have clear is what an association like this would look like in the class diagram and how it would translate into code.

Context 2:

Simple inheritance of implementation

Victor: Inheritance can almost always be replaced by composition. An object in memory is composed of several fields that correspond to other objects (or primitive/built-in values). For example, a class object Veiculo would be represented by a sequence of data placa, proprietário, tipo-de-combustível. An object of the type Carro (subclass of Veiculo) would be represented by placa, proprietário, tipo-de-combustível, cor, modelo, marca. Note that this is almost the equivalent of making the subclass structure Veiculo, cor, modelo, marca. That is, when using composition in the place of inheritance, one arrives at a structure with the same data, but the subclass is more flexible as to what it can encapsulate from the superclass and how.

Maniero: I agree 100%, especially the last sentence of the first paragraph. And this is a relational model and modular and not OO.

EDIT 2: I understood that we are talking about composition, which is a kind of association, and that the word "subclass" that I just blacked out in the above quote would actually be "composition". What I don’t understand is:

a) the example is only illustrative, is not recommending a modeling in which a Car is composed by a Vehicle, is it? (obviously not, I don’t think I should even be asking this, but it’s just to be clear);

b) in OOA&D there is the conceptual class diagram and the project class diagram. When we speak "Car contains Vehicle" we are in the conceptual and when we speak "Car inherits from Vehicle" or "Car consists of Vehicle" we are in the project. When we are in the conceptual it makes sense then the statement that it is a relational model and that this is not OO. Already in the project we are mapping from conceptual to OO and in this case I think it makes no sense to make this statement. Am I correct? In this case I did not understand the impact of this statement, ie the impact of emphasizing "and this is a relational model and not OO".

I also doubt why it’s a modular model, but I think it’s best to leave it to another question so it doesn’t fall outside the scope of this one, unless the answer is simple.

P.S.: I apologize for my writing style being too convoluted, after a while without reading the question I can realize this.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.