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

Ask A Question

Stats

  • Questions 528k
  • Answers 528k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Even better, you can put the records in a temporary… May 16, 2026 at 11:04 pm
  • Editorial Team
    Editorial Team added an answer I would think that you can only load html, not… May 16, 2026 at 11:04 pm
  • Editorial Team
    Editorial Team added an answer Using Xcode 3.2.4, open the organiser window and navigate to… May 16, 2026 at 11:04 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am developing some basic html pages, i am setting colors of text usimg
I'm developing a web page using django and I want to add some javascript
I'm developing a GTK app, and would like to print some messages over existing
I'm developing a simple site for local student contest. I want to implement some
I am planning to use Maxmind's DAT file to provide some basic geolocation capabilities
Castle Project is full of features, includes some awesome subprojects, and developing with it
OKay, I'm from a PHP background, but I've just been tasked with developing some
I'm developing an InfoPath form for Forms Services . It has these views: View
i'm developing an application that is listening to tcp to get some xml data
I've developing an application in Eclipse 3.6 and am trying to get some simple

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.