开发者

Minimizing the number of DLLs while keeping Composite WPF modular

I've been working on a Composite WPF application and just read some good guidelines on partitioning code into assemblies. The author of the article supports minimizing the number of assemblies where possible.

How do you balance making your Composite WPF application reasonably modular while minimizing the number of assemblies?

For my current project I started off by creating a module for each logical group of functionality, which lead to quite a few (14) smallish assemblies. If I were to refactor this and try to minimize assemblies, I could get it down to 6 while still in keeping with the Composi开发者_运维问答te WPF architecture, but I wonder if I am losing some flexibility... maybe I should remember YAGNI.


Besides YAGNI, remember also the Separation of concerns and the Lazy loading patterns and use them to your benefit. There is no use in having fewer assemblies that bundle a lot more potentially unneeded functionality that belongs to different aspects of your application. Also keep in mind that it's also a lot easier to maintain code that keeps a low coupling, as you may risk inducing bugs by bundling in the same assembly functionality that does not belong together.

You may want to do some usability tests in typical use-scenarios of your application, and see what modules are frequently needed together, rely on each other, or inherit from one another and bundle these in the same assemblies. The modules that have disjoint functionality - making a choice leads to loading one OR another, but never both, should especially be kept in separate assemblies.


Go ahead and divide your code in as much assemblies as you need to keep it easy to understand and to maintain. Later if you discover performance problems in your application, and these are due to an excessive number of assemblies, you can start thinking on joining some of them. Just make sure to have a clear object model design and namespace structure so that you don't lose track of your code regardless of how many assemblies you are using.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜