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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:08:31+00:00 2026-06-08T03:08:31+00:00

For the sake of an example I have a WAV class which represents WAV

  • 0

For the sake of an example I have a WAV class which represents WAV sound files. For convenience’ sake, I am then required to add a class called WaveformAudioFile which has exactly the same functionality.

Regardless of possible design/style issues, what would be an appropriate way to integrate the new class ? By using an extends (with nothing added), by using a common interface or something else ?

Edit: Thinking of this further, if design was to be considered would there be an alternative to avoid redundant code ? I mean writing interfaces would be tiresome if there are several classes. Some sort of pattern that could be used to init. attributes ?

  • 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-06-08T03:08:32+00:00Added an answer on June 8, 2026 at 3:08 am

    1. From design point of view, if you want your classes to play a specific role, then go for Interface.

    2. If you have behaviors that keeps changing, then its better to encapsulate them in either Abstract class or Interface , then extend or implement it to specify certain functionality.

    //////////////////////////////////////////Edited ://////////////////////////////

    I think you are referring to the DRY principle (Dont Repeat Yourself), according to this principle, its better to keep your Information and Behaviors in Single Sensible Place.

    But what if the Behaviors are different for different classes for the same functionality.

    For eg:

    Consider Painting as a Class with paint() Method.

    Now

    paint() method can have Stroking, gliding, shading etc styles of doing it.

    Then its better to Encapsulate that method into an Abstract class or an Interface.

    public interface Paint{
    
    paintDoIt(String style);
    
    }
    

    Its Not about a tiresome work, but about flexibility and having the capability to make changes without touching too many classes and without breaking the code.

    Only One thing is a Constant in Software Engineering and that is CHANGE.

    So we need to adopt to it.

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

Sidebar

Related Questions

The Ancestor class does, indeed, have a function called (for the sake of example)
I have an array that represents a grid For the sake of this example
I'll simplify this for example sake I have a formula in column B which
So, I have the following object (simplified for sake of example): public class SomeListener
Say you have an object which, for the sake of example, we will call
Ok, so I have a given video source (for the sake of the example,
For simplicities sake, I'll make up a similar example to what I have: Let's
So here is the situation: I have a class. For examples sake: class Author
For the sake of example, I have a table with columns A B C
For example sake, I'll use some dummy code. I have some jQuery setup that

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.