开发者

Putting Nested Classes In Separate Files

开发者_如何学PythonI have a file with nested classes, but it's becoming long enough to be unreadable. Is there a way I can break out the nested classes into separate files?


Use the right tools.

Putting Nested Classes In Separate Files


I'm afraid not.
As an alternative, you could consider converting some of them to plain Java classes: although nested classes increase encapsulation, you can certainly create good OO design without them.

My two cents.


Write unit-tests to cover the code you are going to refactor.

Then use refactoring tools, e.g. Eclipse/JDT to extract each class. Run the tests for each refactoring job.

For extra fun, you can do this without the unit tests.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜