简体   繁体   English

何时使用 gosu 增强功能?

[英]When to use gosu enhancements?

I've seen the usage of gosu enhancements a lot within Guidewire application.我在 Guidewire 应用程序中看到了很多 gosu 增强功能的使用。 However, it seems to me it is being overused.但是,在我看来,它被过度使用了。 Like the following examples:像下面的例子:

  • An entity querying another entity (ie looks to me an entity modeling problem) .一个实体查询另一个实体(即在我看来是一个实体建模问题)
  • An entity calling a webservice (ie its beyond the purpose of the entity) .调用 Web 服务的实体(即它超出了实体的目的)

Are there any recommended use cases when to use enhancements?在使用增强功能时是否有任何推荐的用例?

The recommended approach is that enhancements should be used to extend existing classes with new methods or properties closely related to the original class object.推荐的方法是使用与原始 class object 密切相关的新方法或属性来扩展现有类。

I agree that enhancements seem to be overused, that is probably because its the easy way to add some logic in existing (OOTB) parts of the Guidewire system.我同意增强功能似乎被过度使用,这可能是因为它是在 Guidewire 系统的现有 (OOTB) 部分中添加一些逻辑的简单方法。

Your observations are totally valid.你的观察是完全正确的。 Enhancements should preferably be used for simple calculations where a permanent data model change is not required.增强功能最好用于不需要更改永久数据 model 的简单计算。 Webservice calls and complex queries are recipes for performance issues when used inside an enhancement.在增强中使用 Web 服务调用和复杂查询是导致性能问题的原因。

Enhancements can be used for standard getter/setter operations that could be obtained in a relatively straightforward calculation.增强功能可用于标准的 getter/setter 操作,这些操作可以通过相对简单的计算获得。

Yes, Enhancements are supposed to be used only for straight forward calculations which the business does not want to store in Database tables.是的,增强功能应该仅用于企业不想存储在数据库表中的直接计算。 Instead of using the enhancements, I think its better to have a helper Gosu class Where we shall execute the complex queries and some logical calculations.与其使用增强功能,我认为最好有一个助手 Gosu class 我们将在其中执行复杂的查询和一些逻辑计算。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM