Are empty abstract classes a bad practice, and why?

后端 未结 11 2026
南方客
南方客 2021-01-02 01:17

We have several empty abstract class in our codebase. I find that ugly. But besides this very stupid reason (ugliness), should I refactor it (into empty interface e.g.) ?

11条回答
  •  孤独总比滥情好
    2021-01-02 02:00

    While I don't get what will be in the table that the empty class is mapped to, if the class serves some purpose, well, keep it, until you have an opportunity to refactor some.

    What I would definitely do is: write a comment about why this class exists in the file. One big reason for clean and "beautiful" code is to not make other developers think. A comment can help with that, even if the code is not as pretty as it could be.

提交回复
热议问题