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

  • SEARCH
  • Home
  • 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 7593707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:14:12+00:00 2026-05-30T21:14:12+00:00

I had a long class which I couldn’t split up because I need all

  • 0

I had a long class which I couldn’t split up because I need all the fields in one database table (Google AppEngine + Objectify). I’m already using embedded classes wherever possible. The class consists mostly of getters and setters plus the logic behind them.

In order to get functional chunks I decided to use repeated inheritance. Now it looks like this:

  • MyStoredModel extends
  • AbstractSettingsModel extends
  • AbstractHierarchyModel (dealing with parent/child objects) extends
  • AbstractInformationModel (holds title, description, …) extends
  • …..
  • AbstractModel

It’s easier to see what every class is doing and I’d also say it’s easier to test. The downside is the “inheritance chain”.

Is that considered bad behavior? What are be better ways to make the class smaller?

  • 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-30T21:14:13+00:00Added an answer on May 30, 2026 at 9:14 pm

    I’d think about using composition for these. So the model consists of Settings, Hierarchy, Information objects.

    It does mean you have to include all the setter/getters on the top-level object, which would then delegate to the respective setters/getters in each of those component classes, but at least you can isolate all the handling of them into separate classes without the complexity of an inheritance hierarchy. And it also means those component classes are now free to inherit from anything they like.

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

Sidebar

Related Questions

One thing with which I have long had problems, within the CakePHP framework, is
I long thought that in C, all variables had to be declared at the
Not too long ago, I had a problem which required me to set WinDbg.exe
I have a class that has some long running methods, in which they do
In my android app I had one class doing the following functions: storing data
Assume I have a Class Foo which has many internal variables, only one constructor
I've long had a desire for an STLish container that I could place into
I've had this long term issue in not quite understanding how to implement a
A long time ago I had an apple ][ . I remember the command
A long time ago I had the following directory structure in my SVN repository

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.