I am trying to convert an ER diagram into a class diagram. Below image is showing that part of my ER diagram and which contains a weak entity call 'Parent'. Therefore when we consider the ER diagram, what happened to the weak entities while designing the Class diagrams? Does this weak entity it create another class or does it is added into one class?

thank you very much.

ER diagram and Weak entity

  • 1
    I don't understand what you are asking. If English is your second language, you need to find someone for whom English is a first language to proofread this for you. Oct 3 '18 at 15:20

Be aware of the object-relational impedance mismatch (like here).Simply converting the ER diagram into a class diagram, and then implementing your system on top of it is not healthy for the application. This approach tends to create very brittle designs, where behaviour is scattered in many unintuitive places and/or contains a lot of duplication (especially with code trying navigate the object model as if it was the relational model).

The steps below describe a (very simplistic) approach to work around the mismatch, but you can find a lot more about this by searching for the impedance mismatch.

  • Start by modelling your objects in terms of the expected behaviour of the system. Here you can use use cases, activity, sequence and state diagrams, if you wish.
  • If necessary, use ORM frameworks to skip the "manual labour" of packing/unpacking data in and out of your database, but don't think of these objects as real objects, think of them as just data structures without behaviour.
  • Finally, create a simple and thin "bridge" layer between your behaviour-centric object model and your data-centric database model (or ORM framework).

This way the application's code can be organised around the observed behaviour, hence allow you to place the code in the most intuitive places.


Refer to the diagram below:

enter image description here

The OrderItem table stores weak entities precisely because an OrderItem has no meaning independent of the Order. Some might argue that an OrderItem does have some meaning on its own; it records that at some time not identified by the record, somebody not identified by the record ordered a certain quantity of a certain product. This information might be of some use on its own, but it is of limited use. For example, as soon as you want to find seasonal or geographical trends in the sales of the item, you need information from the related Order record.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.