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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:05:33+00:00 2026-05-24T04:05:33+00:00

I am using 2 libraries and I need a class from one of the

  • 0

I am using 2 libraries and I need a class from one of the libraries to have functionality from the other. My first try was to take the source of library A and make the class extend the class from library B. This works kinda fine except alot of fixing etc which don’t make the code all that stable etc and updating one of the libraries became a hell.

like this:

abstract class classA extends classB{
}

Now I also thought about doing something like this:

abstract class newClass extends classB{
    private classA A = new classA();

    public void exampleMethod(){
        A.exampleMethod();
    }
}

Is the second option bad performance-wise? and if it is, how bad?

  • 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-24T04:05:34+00:00Added an answer on May 24, 2026 at 4:05 am

    The extension through delegation form (mixin) is desirable for a variety of reasons here, but the most pertinent is that you are (likely) extending 3rd party library classes in a non-normative manner.

    But this is all guessing since we have no idea what libraries you are talking about. For example, it may be that it is a poorly written library where classA (using your example) really is not supposed to be extended but the author neglected to spec final class classA, etc. If that were the case, then clearly you do not want to extend that class (even if you can).

    All that said, given the fact that you (a) only need shared functionality, (b) do not require polymorphic semantics, the delegated form makes perfect sense.

    Advice regarding performance anxiety: benchmark it.

    And don’t neglect final — JIT is your friend (be nice to it and feed it):

    final private classA A = new classA();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have an issue using the PEAR libraries on Windows from PHP . Pear
I'm developing a SWT/JFace application using the libraries from Eclipse 3.4.1. I encounter the
I'm new to using open source libraries in production code so when it says
I'm trying to utilize a class from the Google Toolbox for Mac libraries, for
I have a number of different clases located in a class library in my
I regularly achieve 100% coverage of libraries using TDD, but not always, and there
I'm coding the menu for an application I'm writing in python, using wxPython libraries
When using 3rd party libraries/components in production projects, are you rigorous about using only
I'm using two different libraries in my project, and both of them supply a
I'm using two commercial libraries that are produced by the same vendor, called VendorLibA

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.