I'm designing a system at the moment using MVC (with Laravel, if that matters) and I'm trying to decide how best to architect a part of it.
An an analogy, you could look at it like this:
There's blog posts, and each blog post can have three different types of comments. Each type of comment is completely different from the other, and it viewed on a separate page.
So for example, let's say one comment type is
plain text. There would be a plain text page where all the plain text comments for that blog could be viewed, edited, created, etc.
There's another another type of comment type called
And so on.
My first instinct was to try and shoe-horn all these different types of comments into one CommentController with a Comment Model, and then read the CommentType and process them appropriately, saving them into the corresponding table for that CommentType, showing the right form for that CommentType, etc.
But would it be better practice to have a different CommentController and Model for each type? I.e. PlainTextCommentController/PlainTextComment Model, and TwitterCommentController/TwitterComment Model?
Part of me feels that's bad practice, because it seems so inefficient, but I can't deny it would improve readability of the code.
Maybe it doesn't need to be optimized to cleverly use one Controller, trying to give it responsibility for every comment type. Maybe it just would be better to split everything out, cleanly and clearly?
Would it not be bad practice to do that?