Best practice for near reuse of model components?
Posted
by Chris Knight
on Stack Overflow
See other posts from Stack Overflow
or by Chris Knight
Published on 2010-04-30T11:31:53Z
Indexed on
2010/04/30
11:37 UTC
Read the original article
Hit count: 208
I have a requirement to use a Fund
model in my code. It will contain a fund name and fund code. In the interest of reuse I've poked around the package containing the other models used and found an existing Fund
model. However the issue here is that, in addition to fund name and code, it also contains an amount. Amount isn't directly relevant in my context. So, do I:
1) Use the existing Fund
model as is, ignoring the setters/getters for fund amount.
2) Put a FundDescription
interface onto the existing Fund
model for accessing only the information I'm interested in.
3) Make a FundDescription
base class from which the existing Fund
model could now extend
4) Create a whole new seperate model since the two are slightly contextually different
© Stack Overflow or respective owner