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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:20:45+00:00 2026-06-14T20:20:45+00:00

First let me say that I’m not that experienced with OO patterns, practices, clean

  • 0

First let me say that I’m not that experienced with OO patterns, practices, clean code etc.
I’m actually learning all these techniques.

The most loosely coupled way would be to use primitive types for constructing new objects or executing methods but I think it´s not practicable, is this correct?
Because it is more prone to errors. I could give over lets say integers that represent Ids that do simply not exist. If I would use an object I actually know that there is valid data for it otherwise the object would not have been created (exception) or would be in an invalid state which I have to check for.

This article says that it is evil to use concrete objects for this, instead I should hand over their interfaces (as you all know, I guess).
Changes to the concrete type (not the interface) would cause the dependent type to “breakdown”. Is that so in all cases? Is this also true for a closed single project environment?
I would only understand that, if interfaces are – once written – untouchable and never be modified/refactored again.

  • 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-14T20:20:46+00:00Added an answer on June 14, 2026 at 8:20 pm

    You should use everything when needed. Use a primitive only if it makes sense to. Same with concrete types. It’s true that it’s better to be ‘coupled’ to an abstraction however in many cases you won’t have one and you don’t need one. You can extract interfaces from all the objects you’re using but it would be pointless if you don’t have a real reason to do so (polymorphism).

    You have to think. You can start using a concrete type but then you observe that you’d really need an abstraction not really a concrete type ( for example, abstracting the storage is a very common occurence if you know the storage can change). Instead of depending on a Mysql Database object, an object can depend on a Database abstraction (abstract class or an interface) which allows you to switch any implementation (Mysql, MMSql or even a NoSql). However if you’re coding a small app where you’ll use only mysql, just use the concrete type directly.

    There is one more reason you might want to extract interfaces and that is testing. Of course, extract an interface only if the concrete type will be used as a dependency and it has complex enough behavior. If a dependecy is just a simple DTO (Data Transfer Object) you don’t need to abstract it.

    Most of this stuff comes with experience, but a rule of the thumb is start with concrete types then abstract it if needed. If an object already implements an interface that includes the functionality you want use that interface directly .

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

Sidebar

Related Questions

First of all, let me say that I am not a professional coder -
First of all, let me say that I am not looking for a GUI
First of all, let me say that I'm not a guru C++ programmer. I
first of all please let me say that I am quite new to objective
First let me say that this is not about production settings for django -
Ok. First let me say that I just started learning jQuery and I've taken
first of all let me say that I know about dynamic, no PIA, named
First of all let me just say that I am new to nHibernate so
First off, let me say that I am familiar with content_for . It's not
First off, let me say that this is not homework (I am an A-Level

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.