Hierarchy of utility classes behind a facade?
What practices ex开发者_Go百科ist when it comes to organizing utility classes where some could be subset of others?
As an example, you could have a FileUtil class with methods related to Files and a subset of this class for checking File formats.
A Facade pattern is generally used more as a convenience/organizational construct rather than a hierarchical way of structuring unrelated methods. That is, when you've got several classes which appear to be used in the same manner throughout your code, you make a facade. It's purpose is to support the idiom that you don't repeat yourself (D-R-Y.)
If you've got a bunch of utility classes for various things, I'd keep them as separated as possible. If you've got a few methods which are used together in an identical manner repeated ad nauseum throughout your code, then I'd think about grouping them together in some higher "master" utility. Without seeing or looking at your code this is about the best advice I can give.
精彩评论