So, what is an ERD? To start, it stands for Entity Relationship Diagram, and it isn't actual programming. An ERD is the first step in setting yourself up for success in Object Oriented Programming (oop). As I began dipping my feet into the oop waters it quickly became clear that having a well organized plan of attack would set me up for success, this is where ERDs came in.
In short, an ERD is a hand drawn diagram that represent relationships between objects in your program. Think of an ERD as an electrician's blueprint of how everything is connected under the hood. Your ERD blueprint will do the same thing. Having the visualization of all of the methods needed for each class you create, and other data needed at initialization will save many head aches later down the road.
ERD's are also important in helping other developers who may not be familiar with your project have an understand of relationships in your database. The best thing for readability is to stick to convention.
These are the notations that you should use in your ERD:
So how does this all look when it's put together?
If we look at this diagram you can see that we have two classes, "User" and "Food". A User can eat many Food objects, and Food objects can be eaten by many User objects. These classes are joined by a "Meal" joiner object, a User eats many Food objects at a Meal.
By using an ERD there is now a clear blueprint as to the data each class initializes with, the methods that will need to run on all of the classes, and the relationships that persist.
Is creating an ERD necessary? Maybe not, but hopefully this post will help you understand why it's important and how it will set you up for success on your next project.
Top comments (3)
@philiphaines , nice article. BTW, is there any chance to talk to you in private?
@yujunz Please feel free to reach out any time. My apologies for being late with a reply, have been busy with some other projects!
@philiphaines what's ur email to contact ?