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

  • Home
  • SEARCH
  • 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 1095241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:05:36+00:00 2026-05-17T00:05:36+00:00

A big part of my C++ application uses classes to describe the data model,

  • 0

A big part of my C++ application uses classes to describe the data model, e.g. something like ClassType (which actually emulates reflection in plain C++).

I want to add a new module to my application and it needs to make use of these ClassType’s, but I prefer not to introduce dependencies from my new module on ClassType.

So far I have the following alternatives:

  • Not making it independent and introduce a dependency on ClassType, with the risk of creating more ‘spaghetti’-dependencies in my application (this is my least-preferred solution)
  • Introduce a new class, e.g. IType, and letting my module only depend on IType. ClassType should then inherit from IType.
  • Use strings as identification method, and forcing the users of the new module to convert the ClassType to a string or vice versa where needed.
  • Use GUID’s (or even simple integers) as identification, also requiring conversions between GUID’s and ClassType’s

How far should you try to go when decoupling modules in an application?

  • just introduce an interface and let all the other modules rely on the interface? (like in IType describe above)
  • even decouple it further by using other identifications like strings or GUID’s?

I afraid that by decoupling it too far, the code becomes more unstable and more difficult to debug. I’ve seen one such example in Qt: signals and slots are linked using strings and if you make a typing mistake, the functionality doesn’t work, but it still compiles.

How far should you keep your modules decoupled?

  • 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-17T00:05:36+00:00Added an answer on May 17, 2026 at 12:05 am

    I’ll steer away from thinkng about your reflection, and just look at the dependency ideas.

    Decouple what it’s reasonable to decouple. Coupling implies that if one thing changes so must another. So your NewCode is using ClassType, if some aspects of it change then yuou surely must change NewCode – it can’t be completely decoupled. Which of the following do you want to decouple from?

    1. Semantics, what ClassType does.
    2. Interface, how you call it.
    3. Implementation, how it’s implemented.

    To my eyes the first two are reasonable coupling. But surely an implementation change should not require NewCode to change. So code to Interfaces. We try to keep Interfaces fixed, we tend to extend them rather than change them, keeping them back-compatible if at all possible. Sometimes we use name/value pairs to try to make the interface extensible, and then hit the typo kind of errors you allude to. It’s a trade-off between flexibility and “type-safety”.

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

Sidebar

Related Questions

I'm part of a team that develops a pretty big Swing Java Applet. Most
I am reviewing a big java application to see if there are any performance
i have a big web application running in perl CGI. It's running ok, it's
I'm a big fan of the Jadclipse plugin and I'd really like to upgrade
Big problem. I'm not sure what it was that I did, but it seems
I have a big string (let's call it a CSV file, though it isn't
It's big problem to convert mod_rewrite rules to lighttpd format
What is Big O notation? Do you use it? I missed this university class
Server virtualization is a big thing these days, so I'm tasked at work to
I have a big load of documents, text-files, that I want to search for

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.