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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:41:51+00:00 2026-06-02T18:41:51+00:00

I find myself agreeing to return an interface instead of a concrete class. The

  • 0

I find myself agreeing to return an interface instead of a concrete class.

The reason is simple, I want loose coupling.

But will there be other implications or trade offs?

  • 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-02T18:41:56+00:00Added an answer on June 2, 2026 at 6:41 pm

    For types like List or ArrayList there shouldn’t be any complication and you should return List promoting code to an interface.

    You will find yourself restricted doing so, had this been from the Concurrency package like CopyOnWriteArrayList and you were using methods like addIfAbsent which is not defined in the List interface.

    So, if you return ArrayList or any concrete implementation for that matter you can use API which are not defined in the contract (List interface), but then you are restricted in changing from a specific implementation to something else (from ArrayList to LinkedList), as everyone using your API will have to change as per your changes. It’s too much to expect I think.

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

Sidebar

Related Questions

I find myself doing this repeatedy. $jq(button).filter(function(){ return this.id.match(/^user_(\d+)_edit$/); }).click(function(){ var matches = this.id.match(/^user_(\d+)_edit$/);
I find myself declaring bunch of class variables and it is really tiring to
I find myself lacking knowledge around the below. Take this class: public class MyClass
I find myself writing code like this when I want to repeat some execution
I find myself creating a significant number of wrapper classes, purely because I want
I find myself doing the following a lot to define return values from ruby
I find myself writing this class often in my python code when I need
I find myself writing delegates occasionally for really simple functions (take no arguments and
I find myself using the ResolveUrl function a lot in my aspx pages but
I frequently find myself having a need to create a class as a container

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.