What names do you find yourself prepending/appendi

2019-01-29 19:30发布

Which nouns do you find yourself putting regularly at the end of your classes?

For example, I have a habit of sticking Info onto classes that pass information around but don't do a great deal:

  • ImportInfo
  • SiteInfo

Or for Coordinating classes:

  • UserManager
  • SecurityManager

I end up using Builder quite often for string related classes, even if it barely does any building:

  • TemplateBuilder
  • HtmlBuilder

And of course the timeless Helper/Utility class:

  • PhraseHelper
  • NumberUtility
  • FileHelper

Have you got any good, by which I mean concise and descriptive, nouns or words you regularly use to denote the class' main role?

This question is aimed at the .NET world, but can extend to Java, C++, Python and so on.

14条回答
贼婆χ
2楼-- · 2019-01-29 19:39

Tests for unit test classes

查看更多
Root(大扎)
3楼-- · 2019-01-29 19:40
  • Factory
  • Helper
  • Utils
  • Job
  • Entity
查看更多
forever°为你锁心
4楼-- · 2019-01-29 19:43

On occasion I use

Target

As in

  • UploadTarget
  • ProcessingTarget

I don't think I had before Silverlight / WPF but I now also use

Converter

As in:

  • CurrentTimeDisplayConverter
  • TimeDeltaConverter
查看更多
干净又极端
5楼-- · 2019-01-29 19:43

I am often using :

  • Protocol (Specific protocol implementation)
  • Manager (Class managing the process)
  • Emulator (Emulate something...)
查看更多
时光不老,我们不散
6楼-- · 2019-01-29 19:44

I use Provider and Helper a lot.

查看更多
闹够了就滚
7楼-- · 2019-01-29 19:44

I append pattern name at the end if i follow one (i.e. FooRepository).
Trying to avoid -Helper, -Manager, -Utils.

查看更多
登录 后发表回答