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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:12:25+00:00 2026-06-16T05:12:25+00:00

In olden days, you often had a data module that was low level, did

  • 0

In olden days, you often had a data module that was “low level”, did not depend on any other modules, but could be referenced by them, for example to get enums that were used throughout the system.
Now we have object oriented interfaces between modules, with calls and events.
My question is, shouldn’t we still have one place where enums that are used throughout the system are defined, and these enums should be referenced by every interface that needs them?

I have seen software where essentially the same enum is re-defined on each interface, with translation functions for when it is passed on to another module.

So for example, the interface IModule1 might have

enum module1_state
{
    Unknown, 
    NotRunning,
    Running
}

and the interface IModule2 might have

enum module2_state
{
    Unknown,
    NotRunning,
    Running
}

where module 1 for example collects data, module 2 performs some logic, and then passes data further to a 3rd module, e.g. a GUI.

In many cases, the enums would be genuinely different, because for example, the 2nd module can abstract away some information that isn’t needed by the 3rd module, and pass on a simplified version.
But in some cases, they aren’t different, and here it seems wrong to me that the enums are still re-defined on each interface.
An example is an action that is carried out as part of several different use cases. The action is the same, but depending on the use case, several small details are different. An enum carrying details of the use case is passed over an interface to a high level logic module, and then on over another interface to a lower level module. It is redefined on each interface, and therefore must be translated in the high level logic module.

There are some other modules which just translate older, existing interfaces to newer ones, and again, both interfaces have re-defined the same enum.

Can anyone tell me which is best practice?

  • 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-16T05:12:27+00:00Added an answer on June 16, 2026 at 5:12 am

    This is a matter of code organization, modularity and reuse. It might make sense for two modules to reuse a third (think projects in the same solution), but if they’re part of separate bounded contexts (think solutions), they evolve independently and should generally use separate definitions. The mapping that you see should be normal between separate bounded contexts, but the enums should possibly be unified within the same context.

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

Sidebar

Related Questions

i want to process a text file line by line. In the olden days
Im using the following query to target results that are exactly X days older
I'm looking for the function that will take rows older then X days and
I am trying to remove all empty files that are older than 2 days.
I am using Artifactory to support an enterprise multi-module project. Often, we change the
My shell script find all files 90 days older find /var/www/html/zip/data/*/*/*/*/* -type f -mtime
I find it strange that after looking everywhere I don't find any tool to
I need to find directories not older than 30 days and then sort them
I want to find out files that are older than x days ( time
I'm writing a Windows batch file that will purge logs older than 90 days.

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.