本文介绍了你使用什么命名约会的装饰图案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚真的真正地琢磨依赖注入和装饰设计模式的奇迹,并且在整个地方使用它。

I just recently really truly groked dependency injection and the wonder of the Decorator design pattern and am using it all over the place.

尽管如此,我一直困难的一件事是命名我的装饰课程,所以我只想知道别人做什么。你总是附加装饰这个词吗?您是否加入了其装饰的界面名称?他们有自己的命名空间吗?

As wonderful as it is however, one thing that I've been having difficulty with is naming my decorator classes so I would just like to know what others do. Do you always append the word Decorator? Do you incorporate the name of the interface its decorating? Do they get their own namespace?

你们做什么?

推荐答案

我避免使用设计模式名称。我认为这在任何地方都属于文档。在其所做或代表的作用之后命名装饰器类/功能。它装饰或桥接或链接或代理或重新代表的事实没有什么影响。

I avoid using design pattern names. I think this belongs in documentation if anywhere. Name the decorator class/function after what it does or represents. The fact that it decorates or bridges or links or proxies or re-represents is of little consequence.

每当你命名一个字符串,你添加一个字符串后缀吗?听起来像对我的hgrnNotation,这是我尝试和避免的。

Every time you name a string, do you add a String suffix? Sounds like hgrnNotation to me, and that is something I try and avoid.

这篇关于你使用什么命名约会的装饰图案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 11:22