1

I'm currently working on a project for my university and one teacher told me I was wrong to think that there could be classes in a UML class diagram (thinking of it as a design diagram) to which there would be no equivalent in a data model. He then pressured me to provide a counter-example to prove my point but I just couldn't think of one.

I checked a few books I had about UML like "Learning UML 2.0," "Applying UML and Patterns" and UML 2 for dummies, but I couldn't find any information regarding which classes appear on a class diagram. I asked him about implementation classes but he told me that they shouldn't be included in a class diagram. So I'm at a loss here.

I also checked this questions before posting:

Differences between a conceptual UML class diagram and an ERD?

Generate UML from a conceptual data model

how to relate data with function in uml class diagram

But they don't really solve the question I have.

Thanks for any insight you might have.

Community
  • 1
  • 1
Lugaid
  • 520
  • 1
  • 5
  • 9

3 Answers3

5

Both your teacher and you are unnecessarily distracted by the differences between UML and conceptual data modeling (which I take to be tantamount to ER modeling). The real issue you and your teacher are discussing is the difference between analysis and design, regardless of the model used.

A UML model can be created that diagrams the problem as stated or that diagrams the solution as designed. In the first case, implementation classes should be omitted, because they do not pertain to the problem domain. In the second case, they should be included. The first case is analysis. The second case is design.

The same ambiguity exists with regard to ER diagrams. Some people, including myself, use ER models and ER diagrams only to represent the data requirements inherent in the problem itself. This is what is most often meant by "conceptual data modeling". In this framework, the only entities that should appear are entities that have a perceived reality in the subject matter itself, and are not merely constructs inside the database or the application(s). This is analysis.

But there are plenty of other people, perhaps a majority, who use ER diagrams to pictorialize the design of a schema of tables. In this framework, foreign keys are included, and junction tables are elevated to the status of entities, even though they are not subject matter entities. There's nothing inherently wrong in this, so long as the distiction between analysis and design is kept clear.

Unfortunately, the distinction between analysis and design is very often obscured beyond recognition. There are dozens of instances of this right here in SO.

So, if a confusion between analysis and design is allowed to creep into the discussion between you and your teacher, the discussion could end up going in almost any direction.

Walter Mitty
  • 18,205
  • 2
  • 28
  • 58
  • I'm inclined to take this as the answer. However, I'd like to get more insight on Erwin's point of view first. – Lugaid Aug 29 '13 at 14:58
  • 2
    I don't think there's much air space between Erwin's point of view and mine. Both Erwin and I are concerned, in different ways, to make the distinction between describing the problem to be solved and describing the proposed solution. You are free to blur this disctinction, if you choose, and if it helps you to communicate to the client of the project. But if you do blur this disctinction, and you end up with the right solution to the wrong problem, that's your business. Don't blame the tools. – Walter Mitty Aug 31 '13 at 14:02
  • I'm not inclined to blur the distinction, and I understand that diagrams are nothing more than tools. I was just trying to understand why my teacher told me what he did. – Lugaid Sep 02 '13 at 03:29
  • OK, I get it. Your last response clarified for me that the real problem is why the teacher said what he did. I'm going to say that classes in UML play the same role that classes in an Object Model plays. Each object in a class has state and it has behavior. I suppose you could come up with a stateless class, but I've never seen one. State is represented by data. The data that represents state is going to have its counterpart somewhere in the conceptual data model. – Walter Mitty Sep 02 '13 at 15:01
  • One of the questions you covered was how to generate a UML from a conceptual data model. Slightly more relevant is how to generate a conceptual data model from a UML model. That's straightforward. – Walter Mitty Sep 02 '13 at 15:03
2

From my understanding of UML, it does NOT define what should be in a diagram. I found this example in the IBM site: (image did'nt lode, so here is the link: http://www.ibm.com/developerworks/webservices/library/ws-RESTservices/)

enter image description here

Surely, a servlet is not part of a domain model. A UML class diagram us used to model classes, which are entities that have attributes and methods. IMHO, it doesn't matter if they are part of the domain model or are functional classes that support the application. If you need to show them to the customer, they must be there.

vainolo
  • 6,907
  • 4
  • 24
  • 47
  • 1
    The distinction between the domain model and functional classes is important if you are doing analysis rather than design. The distinction between analysis and design is important, no matter which modeling system you use, and no matter which diagramming tool you use. – Walter Mitty Sep 03 '13 at 17:15
2

"one teacher told me I was wrong to think that there could be classes in a UML class diagram (thinking of it as a design diagram) to which there would be no equivalent in a data model. He then pressured me to provide a counter-example to prove my point but I just couldn't think of one."

He is right. In the stage of conceptual analysis/conceptual design, those rectangular boxes in a UML class diagram depict "concepts". And whatever the "concept" happens to be, you can always also draw an E/R diagram around it to illustrate (the nature of) that concept, other concepts that relate to it, and what the nature of those relationships is.

Erwin Smout
  • 18,113
  • 4
  • 33
  • 52
  • I understand what you mean, but when thinking about data modelling, how would classes that have no persistent attribute (like typical implementation classes) play any role in the ER diagram? – Lugaid Aug 29 '13 at 14:57
  • I was talking of __ THE STAGE OF CONCEPTUAL DESIGN __. Do such implementation classes already exist at the stage of conceptual design, in your projects ? – Erwin Smout Aug 29 '13 at 18:13
  • My response was presuming we were only talking of the use of the UML class diagram to document conceptual business models. UML class diagrams can also serve to document other stuff. ER diagrams are typically not drawn when it concerns these "other purposes". But even so, let's say you have a UML class diagram that documents the structure of some implementation (let's say, like the one from IBM below). ... – Erwin Smout Aug 29 '13 at 18:24
  • Transforming that to an equivalent ER diagram, will give you, broadly speaking, a data model __ of your program-local data __ . IOW, it gives you a model of the data structures as used internally in your application. And although that typically isn't done in ER environments, it's still pretty much a valid application of the technique of ER diagramming ! There's nothing technically wrong with doing exactly that, and the "concepts" portrayed in such a schema are exactly the implementation classes that are doing their work when your program is running. – Erwin Smout Aug 29 '13 at 18:28
  • Diagrams are nothing more than that, I get that it's up to me how I use them. I understand that and I think I get your point now and I see where I might have gotten things mixed up. But even if such uses are technically valid, I feel that the blanket statement my teacher told me is invalid. If both diagrams are not being used to represent the same idea, they shouldn't convey the same information necessarily. Thanks! – Lugaid Aug 30 '13 at 16:13