开发者

When should layers be implemented as separate units of deployment?

开发者 https://www.devze.com 2023-02-11 09:05 出处:网络
When designing an application, at what point sho开发者_运维技巧uld the various layers (such as Presentation, Business Logic, and Data Access) be separated into different assemblies?Mainly you\'ll be d

When designing an application, at what point sho开发者_运维技巧uld the various layers (such as Presentation, Business Logic, and Data Access) be separated into different assemblies?


Mainly you'll be distirbuting classes in different libraries if you want to provide your product in a way you can choose some final user wouldn't have access to the entire project's classes.

Think in a client-server application. Why you would want to distribute server classes to your customer if you've a cloud computing scenario? You'd prefer to distribute presentation and service client classes, packaged in server-independent assemblies. That's a good security practice too.

Another good point to separate in assemblies is to avoid to load a large assembly to an application domain (AppDomain). For example, if the usage of your program doesn't require image processing overtime, but maybe, a single operation per day would need to require imaging classes, you're saving processing time - when loading a large assembly to application domain - and memory because your application doesn't require an assembly that has all and, at the end of the day, your application has fewer memory usage.

In the arquitectural point of view, separating in assemblies would enforce good practices, thanks to the fact you'll be aware of not mixing layers because, for example, you shouldn't require business assemblies in your presentation assembly, so, no one has access to business logic directly from the user interface.

Finally, in terms of deployment, you save time as you can update a modular application with specific assemblies, easing the upload process or auto-update process, because download times are reduced, saving network traffic.


Personally I like splitting my layers right at the begging of my project, not necessary into different assemblies but different folders.

I would then move the different layers into different assemblies when I require the use of a layer in a different project.

Once the layers are in different assemblies you need to worry about versioning and the sorts which can be quite cumbersome.

0

精彩评论

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