B
Bob Jones
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?
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?