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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:11:51+00:00 2026-05-29T08:11:51+00:00

I have class MasterData whose instances contain some general information about all possible gadgets.

  • 0

I have class MasterData whose instances contain some general information about all possible gadgets.

I have another class CustomerData whose instances contain:

  • some specific information about a subset of those gadgets, as provided to us by a customer
  • the link from each gadget to the same gadget in MasterData

CustomerData constructor takes as parameters:

  • a file provided by the customer
  • a Python module that I wrote for each customer that contains various details about the customer file, in the form of module-level variables; e.g., it says which customer field contains the product identifier; etc.

The linking was as simple as getting the appropriate ID from the customer file and looking it up in the appropriate field of the master data. The names of the fields that contained the relevant IDs (customer and master) were provided, among other things, in the customer module. The actual linking was performed in the CustomerData constructor.

Everything worked fine until we came up with new, much more complicated, matching rules. Each matching rule is only applicable to a specific customer, so I thought to put all the possible matching rules in the per-customer module, and then let the application select which rule it wanted to use. But unfortunately, the new matching rules require operating on the master data, and a module is naturally a “passive” object which does not even have a link to the master data.

Should I create global functions in the modules that take the master data instance and the customer record as a parameter, and return the master data record?

Or should I place matching rules elsewhere?

  • 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-29T08:11:53+00:00Added an answer on May 29, 2026 at 8:11 am

    Should I create global functions in the modules that take the master data instance and the customer record as a parameter, and return the master data record?

    Generally.

    a Python module that I wrote for each customer that contains various details about the customer file, in the form of module-level variables; e.g., it says which customer field contains the product identifier; etc.

    This shouldn’t really be a module. That’s not wrong. But it can be confusing.

    Consider changing things so that you have something like this.

    class AbstractCustomerData( object ):
       """Generic features common to all customer data."""
    

    Then. Each customer has a module which has

    from the_master_copy import AbstractCustomerData
    
    class ThisCustomerData( AbstractCustomerData ):
        """All the various kinds of overrides and whatnot."""
        def the_matching_rule( self, master_data_object_or_collection_or_whatever ):
            """This customer's override."""
    

    In this way, you can use your ThisCustomerData instances in the customer module. The module’s not an argument to anything; the module contains the customer’s code.

    The customer’s installation of your application then looks like this

    import generic_stuff
    from customer_module import ThisCustomerData, other_feature, yet_more
    

    Now you can build the customer’s specific instance of the application from the generic_stuff plus the customer’s specific overrides imported from the customer’s extension module.

    This has the advantage of allowing much, much more freedom, since you’re not limited to plugging a module into a class. You’re using module to contain a class definition which can now do anything.

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

Sidebar

Related Questions

I have some XML which I would like to serialize into a class. <MasterData>
I have class that extends BroadcastReceiver and gets all new sms. When I get
I have class Person { @OneToMany(cascade = CascadeType.ALL) @JoinTable(name = person_countries, joinColumns = {
Is possible create (register) a new class in runtime using delphi. I have a
I have class that uses hibernate, I have included all required jars to classpath
I have class A that has some primitive attributes and also member of type
I have class and properties in there. Some properties can be marked attribute (it's
I have class with all the methods static and final. How do I mock
I have class method that returns a list of employees that I can iterate
I have: class MyClass extends MyClass2 implements Serializable { //... } In MyClass2 is

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.