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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:45:18+00:00 2026-05-13T16:45:18+00:00

I am developing some basic utility objects in javascript. These are things like: spinner

  • 0

I am developing some basic utility objects in javascript. These are things like:

spinner {
// generates a spinner
}

dialog {
// generates a dialog
}

wysiwyg {
// generates a wysiwyg editable
}

etc.

Once I have amassed a collection of basic utility objects, I would like to create more specific, complex objects for working on different sets of data. For example, an object to edit a list of records.

I am wondering: What is the best way to incorporate the functionality of my utility objects, into my more complex, specialized objects?

Multiple inheritance? For example, an object editList which is created from the parents dialog and spinner, and then augmented? Or is it better design practice to generate new instances of my utility objects inside of my more complex objects?

Thanks in advance for your help.

  • 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-13T16:45:18+00:00Added an answer on May 13, 2026 at 4:45 pm

    Multiple inheritance is almost never the right answer. What you want to use is composition. For example, if you have a complex UI panel that can have a couple of different dialogs and a wysiwig, you can do something like

    function myPanel(width, height) {
      this.saveDialog = new dialog('Save', ...);
      this.loadDialog = new dialog('Load', ...);
      this.editPanel = new wysywig(width, height);
    
      . . .
      var me = this;
      // Add a Save button to trigger the save dialog;
      this.saveButton = new button("Save", function() { me.saveDialog.display(); });
      this.addButton(saveButton);
    }
    

    Since your more complex object is probably not actually a spinner, or a dialog, but rather a component that uses them all in some way, composition is the proper paradigm here.

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

Sidebar

Related Questions

I am using a custom font on the website i'm developing and some basic
I'm currently developing some things in Python and I have a question about variables
I am developing some basic html pages, i am setting colors of text usimg
I'm currently developing the basic version of an iOS app. At some point in
Lately I have been thinking about developing some basic android app. Its only due
(sorry for my bad english) I'm developing a basic chrome extension that make some
I am developing some application in Linux .This Linux is a virtual machine running
I'm currently developing some computer-vision application for blind people. Now we decided to move
I am developing some SWIG-generated Java bindings for a C library. The library contains
I am developing some REST API's which are returning data in json format. ASP.net

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.