I'm currently working on making a Reddit clone and I'm in the design process at the moment. I'm trying to wrap my head around OOD, UML, and the relational schema.
So, a user can make two types of posts: link post and text post. Both types of posts have similar attributes like title, which subreddit to post to, and date created. So, for my OOD, I want to have a Post parent class that has these attributes, but also can't be instantiated, so I decided to make it an abstract class and create the two sub classes, TextPost and LinkPost, extend from the parent.
So when it comes to the database tables, how do I model this correctly? Do I have a post table that has these attributes then just join the subclasses when I need them?
For instance, if I wanted to get all text posts, I'd have something like:
"select * from posts inner join text posts on post.id = textpost.id"
which means I'd have all posts stored in a post table along with the different types of posts in their respective tables?
Should I not have a post table since it's an abstract class in my OOD?
So I'm really hung up on how to design my DB when I have an abstract class in my OOD. I'd really appreciate it if someone could clear my confusion.
Thank you for your time.