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 6354199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:32:20+00:00 2026-05-24T22:32:20+00:00

Please let me know if this is inappropriate as formulated (in particular whether Programmers.SE

  • 0

Please let me know if this is inappropriate as formulated (in particular whether Programmers.SE or something would be better for the question.)

Alright. So I’ve got a number of ‘traits’ that I’m currently expressing as interfaces. Let’s call them “updatable” and “destructible”. Expressing them as interfaces has the downside that I can’t share behavior between all “destructible” components; on the other hand, expressing these as abstract classes mean I can’t mix and match without explicitly defining the mixed trait as another abstract class (“UpdateableAndDestructible”) and furthermore this feels like an abuse of the abstract class functionality at that point. It’s probably what I’ll end up doing if there aren’t cleaner ways of handling this, however.

What are my options as far as pure Java solutions to this conundrum? Is it possible for me to describe shared behavior and then mix and match as I see fit without having to explicitly describe every permutation I’ll be using?

  • 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-24T22:32:21+00:00Added an answer on May 24, 2026 at 10:32 pm

    Maybe you could achieve the goal by using a mix of interfaces and default implementations.

    Like:

    public interface Updatable {
      void updated();
    }
    
    public interface Loadable {
      void load();
    }
    
    public class DefaultUpdatable implements Updatable {
     ...
    }
    
    public class DefaultLoadable implements Loadable {
     ...
    }
    
    public class SomeObject implements Updatable, Loadable {
      private final Updatable updatable = new DefaultUpdatable();
      private final Loadable loadable = new DefaultLoadable();
    
      public void load() {
        this.loadable.load();
      }
    
      public void updated() {
        this.updatable.updated();
      }
    }
    

    Still noisy and maybe not as flexible as you would like but maybe a bit cleaner than doing the UpdatableAndDestructable thing.

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

Sidebar

Related Questions

I'm thinking of an approach something like this. Please let me know if this
First time posting, please let me know if this question has already been answered!
Please let me know if this should be on Server Fault... I've got some
Please let me know if this is bad practice or in someway a bad
Please let me know if this has been asked before, I wasn't able to
I found this in an ActionScript class in flex. protected::valueMin Please let me know
Great Mates... I need your help.. please let me know why this code is
(Please let me know if this is completely absurd, that is probably a reason
Please let me know what architecture do VoIP applications use, P2P or Client-Server? Thank
Please let me know why there is lot of white space below the page

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.