Are static inner classes a good idea or poor design?

后端 未结 4 1979
孤独总比滥情好
孤独总比滥情好 2020-12-20 22:38

I\'m find I have several places that having public static inner classes designed that extend \"helper\" classes makes my code a lot more type safe and, in my opinion, readab

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-20 23:04

    The only caveat with using inner classes is making sure you're not repeating yourself all over the place - as in - make sure, when you define an inner class, you're not going to need to use that functionality anywhere else, and, that that functionality is necessarily coupled with the outer class. You don't want to end up with a whole bunch of inner classes that all implement the exact same setOrderyByNameDesc() method.

提交回复
热议问题