Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 759119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:33:31+00:00 2026-05-14T15:33:31+00:00

I have a requirement to use a Fund model in my code. It will

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T15:33:32+00:00Added an answer on May 14, 2026 at 3:33 pm

    Option 1 could confuse a person that reads the code, and could tempt someone who doesn’t understand your code fully, to use those setters/getters due to some misunderstanding. The other options sort of forces him to understand your code better.

    Option 2 Sort of second-place-solution but to me it wouldn’t make perfect sense logically.

    Option 3 It is the cleanest and most logical way of solving the problem among those listed, and I would say that that qualifies as close to best practice in this case.

    Option 4 This sounds unnecessary! 🙂

    Option 5 (NEW! The one I’d go for 🙂 Have a member variable of type FundDescriptor in the Fund model.

    Whenever faced with this kind of design decisions I usually try to avoid thinking “what would be the most efficient solution” or “what would be the solution requiring least code”, but instead think of what would look most logical to for a person that reads the code for the first time.

    Think of the “extends” construct as an “is-a” relation, and read it out loud. If it makes sense and is logical, go for it. How does, “a Fund is a FundDescriptor” sound to you? If it sounds like “hmm.. that doesn’t make sense”, then I’d go for option 5, otherwise I would go for option 3.

    Have a look at the accepted answer at

    Inheritance vs. Aggregation

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.