Are static inner classes a good idea or poor design?

后端 未结 4 1987
孤独总比滥情好
孤独总比滥情好 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 22:58

    The point in "loose coupling" is to keep the two classes separate so that if there are code changes in your "SearchCriteria" class nothing would have to be change in the other classes. I think that the static inner classes you are talking about could potentially make maintaining code a nightmare. One change in SearchCriteria could send you searching through all of the static classes to figure out which ones are now broken because of the update. Personally, I would stay away from any such inner classes unless it is really needed for some reason.

提交回复
热议问题