且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ASP.NET / OOP并在重写方法中向控件添加特定逻辑

更新时间:2023-12-06 10:24:16

你好,


我有只有一个问题;-)什么是公司名称,所以我知道

不适用;-)

-

Milosz


Bob Jones写道:
Howdy,

I have just one question ;-) What''s the company name so i would know where
not to apply ;-)
--
Milosz

"Bob Jones" wrote:

我有一个奇怪的业务需求,我认为实施

在OOP开发方面是不正确的。任何有关

概念的帮助都将非常感激!


我们目前有一个自定义页面对象,它源自基础

页面对象。我们还有一个自定义控件,它来自一个基础

类,它执行自定义绘图并继承自我们自己的
IOurControl接口。

组合中还有一个特殊的缓存层,它根据控件ID从数据库/应用程序中检索对象信息

缓存(这是一个简化的解释)。 br />

我老板眼中最理想的是我们的每个自定义对象都在其OnInit事件中从缓存中检索数据并且

在其OnRender事件中绘制内容,因此我们的自定义页面不会因为
必须相应地迭代自定义控件和触发方法。


虽然我理解他想要这样做的理由,但我相信

应该将数据和设置内容的方法添加到控制IOurControl接口的
和我们的自定义页面对象

应该负责循环其子控件并根据需要调用

这些方法。他的方式要求新的

控件的开发人员必须提前知道放置特定代码的位置或

控件在上下文中使用时不能正常工作我们的

。我也在控件的基础

类中使用抽象方法,但由于每个

控件的实现方式不同,所以看起来毫无意义。


我的老板是实现解决方案的***方式,对于OOP

概念,我的建议是***的方式还是有更好的方法/>
这样做了吗?

I have an odd business requirement and I think that the implementation
is not correct in the terms of OOP development. Any help on the
concepts would be very appreciated!

We currently have a custom Page object which is derived from the base
Page object. We also have custom controls that derive from a base
class that performs custom drawing and inherits from our own
IOurControl interface. There is also a special caching layer in the
mix that retrieves object information from a database/application
cache based on a control id (this is a simplified explanation).

What would be ideal in the eyes of my boss would be that each of our
custom objects retrieves data from the cache on its OnInit event and
draws the content on its OnRender event so our custom page doesn''t
have to iterate the custom controls and fire methods accordingly.

Although I understand his reasoning for wanting to do so, I believe
that the methods for getting data and setting content should be added
to the controls IOurControl interface and that our custom page object
should be responsible for looping its child controls and invoking
those methods as needed. His way requires the developers of new
controls to have to know ahead of time where to place specific code or
the controls won''t function properly when used in context with our
Page. I also entertained using abstract methods in the control''s base
class but since the implementation would be different for each
control, it seemed pointless.

Is my boss'' way the best way to implement the solution as far as OOP
concepts go, is my suggestion the best way or is there a better way of
doing so?


2月27日上午10点08分,Milosz Skalecki [MCAD]

< mily ... @ DONTLIKESPAMwp.plwrote:
On Feb 27, 10:08 am, Milosz Skalecki [MCAD]
<mily...@DONTLIKESPAMwp.plwrote:

你好,


我只有一个问题;-)什么是公司名称,所以我知道

不适用;-)

-

Milosz


" Bob Jones"写道:
Howdy,

I have just one question ;-) What''s the company name so i would know where
not to apply ;-)
--
Milosz

"Bob Jones" wrote:

我有一个奇怪的业务需求,我认为实施

在OOP开发方面是不正确的。任何有关

概念的帮助都将非常感谢!
I have an odd business requirement and I think that the implementation
is not correct in the terms of OOP development. Any help on the
concepts would be very appreciated!


我们目前有一个自定义的Page对象,该对象派生自基础

Page对象。我们还有一个自定义控件,它来自一个基础

类,它执行自定义绘图并继承自我们自己的
IOurControl接口。

组合中还有一个特殊的缓存层,它根据控件ID从数据库/应用程序中检索对象信息

缓存(这是一个简化的解释)。
We currently have a custom Page object which is derived from the base
Page object. We also have custom controls that derive from a base
class that performs custom drawing and inherits from our own
IOurControl interface. There is also a special caching layer in the
mix that retrieves object information from a database/application
cache based on a control id (this is a simplified explanation).


在我老板的眼中,理想的是每个我们的b
自定义对象从中查找数据在其OnInit事件上缓存并且

在其OnRender事件上绘制内容,因此我们的自定义页面不会
必须相应地迭代自定义控件和触发方法。
What would be ideal in the eyes of my boss would be that each of our
custom objects retrieves data from the cache on its OnInit event and
draws the content on its OnRender event so our custom page doesn''t
have to iterate the custom controls and fire methods accordingly.


虽然我理解他想要这样做的理由,但我相信

获取数据和设置内容的方法应该添加

到控件IOurControl接口,我们的自定义页面对象

应该负责循环其子控件并调用

这些方法如所须。他的方式要求新的

控件的开发人员必须提前知道放置特定代码的位置或

控件在上下文中使用时不能正常工作我们的

。我也在控件的基础

类中使用抽象方法进行娱乐,但由于每个

控件的实现方式不同,所以看起来毫无意义。
Although I understand his reasoning for wanting to do so, I believe
that the methods for getting data and setting content should be added
to the controls IOurControl interface and that our custom page object
should be responsible for looping its child controls and invoking
those methods as needed. His way requires the developers of new
controls to have to know ahead of time where to place specific code or
the controls won''t function properly when used in context with our
Page. I also entertained using abstract methods in the control''s base
class but since the implementation would be different for each
control, it seemed pointless.


我的老板是实现解决方案的***方式,对于OOP

概念去,是我的建议***的方法或是否有更好的方式

这样做? - 隐藏引用的文字 -
Is my boss'' way the best way to implement the solution as far as OOP
concepts go, is my suggestion the best way or is there a better way of
doing so?- Hide quoted text -



- 显示引用的文字 -


- Show quoted text -



Milosz,


相信我,我可以欣赏幽默,但你或其他任何人都可以

为这个问题提供了有意义的答案?我想对此事有一个

外界意见。


= o)

Milosz,

Trust me, I can appreciate the humor, but can you or anyone else
provide a meaningful answer to the question? I would like to have an
outside opinion on the matter.

=o)

>

2月27日上午9:31,Bob Jones < goodold ... @ gmail.comwrote:
On Feb 27, 9:31 am, "Bob Jones" <goodold...@gmail.comwrote:

我有一个奇怪的业务需求,我认为实施

不正确在OOP开发方面。任何有关

概念的帮助都将非常感激!


我们目前有一个自定义页面对象,它源自基础

页面对象。我们还有一个自定义控件,它来自一个基础

类,它执行自定义绘图并继承自我们自己的
IOurControl接口。

组合中还有一个特殊的缓存层,它根据控件ID从数据库/应用程序中检索对象信息

缓存(这是一个简化的解释)。 br />

我老板眼中最理想的是我们的每个自定义对象都在其OnInit事件中从缓存中检索数据并且

在其OnRender事件中绘制内容,因此我们的自定义页面不会因为
必须相应地迭代自定义控件和触发方法。


虽然我理解他想要这样做的理由,但我相信

应该将数据和设置内容的方法添加到控制IOurControl接口的
和我们的自定义页面对象

应该负责循环其子控件并根据需要调用

这些方法。他的方式要求新的

控件的开发人员必须提前知道放置特定代码的位置或

控件在上下文中使用时不能正常工作我们的

。我也在控件的基础

类中使用抽象方法,但由于每个

控件的实现方式不同,所以看起来毫无意义。


我的老板是实现解决方案的***方式,对于OOP

概念,我的建议是***的方式还是有更好的方法/>
这样做?
I have an odd business requirement and I think that the implementation
is not correct in the terms of OOP development. Any help on the
concepts would be very appreciated!

We currently have a custom Page object which is derived from the base
Page object. We also have custom controls that derive from a base
class that performs custom drawing and inherits from our own
IOurControl interface. There is also a special caching layer in the
mix that retrieves object information from a database/application
cache based on a control id (this is a simplified explanation).

What would be ideal in the eyes of my boss would be that each of our
custom objects retrieves data from the cache on its OnInit event and
draws the content on its OnRender event so our custom page doesn''t
have to iterate the custom controls and fire methods accordingly.

Although I understand his reasoning for wanting to do so, I believe
that the methods for getting data and setting content should be added
to the controls IOurControl interface and that our custom page object
should be responsible for looping its child controls and invoking
those methods as needed. His way requires the developers of new
controls to have to know ahead of time where to place specific code or
the controls won''t function properly when used in context with our
Page. I also entertained using abstract methods in the control''s base
class but since the implementation would be different for each
control, it seemed pointless.

Is my boss'' way the best way to implement the solution as far as OOP
concepts go, is my suggestion the best way or is there a better way of
doing so?



只需交叉发布此消息

Just cross-posting this message