DEV Community

Discussion on: It's wrong to treat "Draft" mode as a state on the way to "Final"

Collapse
 
binarypatrick profile image
BinaryPatrick

As someone who just created a mass messaging app, I wish I had separated them in the architecture. It was my first attempt at this kind of app. Definitely lessons learned.

Collapse
 
hagailuger profile image
Hagai Luger

Thanks!
Can you elaborate more on what you did at the end?

Collapse
 
binarypatrick profile image
BinaryPatrick

In it's current state, they both sit in the same table, along with templates too. Only an enum differentiates them. The product still has time to change but it's so late in the project it may remain that way forever.

Ultimately I don't think having them all in one table is so bad it needs to be changed, but if I went back in time I probably would split finalized from all others.

As the project was filled in, I found myself writing more and more exception logic for final. That's a code smell for sure. Because it's not split in the data layer, it has to be done in business logic.

Consider though that doing anything has considerations. And perhaps if it was separated, there would be other issues. The code would certainly have repetition. Storing them all in one table is very DRY, if nothing else.