什么,在一个实用程序库包括: [英] What to include in a Utility Library

查看:127
本文介绍了什么,在一个实用程序库包括:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过在我带越来越多的项目中,我发现,我常常重复的项目中许多常见任务的项目,客户端到客户端。所以,我已经开始组建一个实用库中,这往往因项目重复这些通用元素的集合。

到目前为止,我有工具来调整图像,数据导出网格到Excel,发送电子邮件,并更换切分的消息。

如果你正在构建/使用.NET工具类库,什么类型的过程,你会看到有帮助?你会想象什么名称空间/组?

更新

我说的是一个实际的类库,分为命名空间来组织常见的元素。

解决方案
  1. 我不会写了一个名为通用或工具或杂项或者......你的想法库。相反,我倒是有一个叫库目录下,并有每个功能区的下一个独立的库。例如,我可能有库/跟踪,库/ UI,库/网,库/网页的C ++项目。对于C#,我有库/ Acme.Trace,库/ Acme.Windows.Forms,库/ Acme.Net等(假设你的顶级命名空间/家公司被称为尖端)。
  2. YAGNI。不要去写code,你的可能的需要。
  3. 请不要扔东西到一个共享库,直到你已经用他们的两个或两个以上的项目。

With more and more projects under my belt I find that I am often repeating many common tasks from project to project, client to client. So I have started to assemble a "utility" library, a collection of these common elements that are often repeated from project to project.

So far I have utilities to resize images, export data grids to excel, send e-mails, and replace tokenized messages.

If you were building/using a .NET utility class library, what types of processes would you see as helpful? What namespaces/groups would you envision?

Update

I am talking about an actual class library, separated into namespaces to group common elements.

解决方案

  1. I wouldn't write a library called 'Common' or 'Utilities' or 'Misc' or... You get the idea. Instead, I'd have a directory called 'Lib', and have each area of functionality in a separate library under that. For example, I might have Lib/Trace, Lib/UI, Lib/Net, Lib/Web for a C++ project. For C#, I'd have Lib/Acme.Trace, Lib/Acme.Windows.Forms, Lib/Acme.Net, etc. (assuming your top-level namespace/company is called 'Acme').
  2. YAGNI. Don't go writing code that you might need.
  3. Don't throw things into a shared library until you've used them in two or more projects.

这篇关于什么,在一个实用程序库包括:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆