关闭。这个问题是opinion-based .它目前不接受答案。
想改善这个问题吗?更新问题,以便可以通过 editing this post 用事实和引文回答问题.
3年前关闭。
Improve this question
我最近遇到了一个术语' God object ’,这被描述为‘反模式’。我听说过糟糕的编码实践,但我从未听过这样描述它们。
所以我前往维基百科了解更多,我发现有一个反模式叫做 'Ravioli code'它被描述为“以许多小型且(理想情况下)松散耦合的软件组件为特征”。
我很困惑 - 为什么这是一件坏事?
最佳答案
意大利面:
Spaghetti code is a pejorative term for source code
馄饨:
Ravioli code is a type of computer program structure, characterized by a number of small and (ideally) loosely-coupled software components. The term is in comparison with spaghetti code, comparing program structure to pasta;
这是在比较它们。这并不是说这是一种反模式。
但我同意。文章令人困惑。问题不在于馄饨类比,而在于维基百科文章结构本身。它开始称意大利面是一种不好的做法,然后说一些例子,然后说一些关于 Ravioli 代码的事情。
编辑:他们改进了这篇文章。是一种反模式,因为
While generally desirable from a coupling and cohesion perspective, overzealous separation and encapsulation of code can bloat call stacks and make navigation through the code for maintenance purposes more difficult.
关于anti-patterns - 馄饨代码 - 为什么是反模式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2052017/