Identify and remove core driver antipatterns (e.g. instance_variable_set in Mongo::Cluster)

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Unknown
    • 2.25.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Fully Compatible
    • Ruby Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Description:
      Audit the Ruby driver for structural antipatterns that make the code brittle or surprising, such as Mongo::Cluster.create mutating its argument via instance_variable_set, and other uses of instance_variable_set or similar meta-programming shortcuts. Replace these with clearer, encapsulated designs (e.g., proper initializers, explicit accessors, small helper objects) that preserve behavior while improving maintainability and testability.

      Acceptance Criteria:

      • All uses of instance_variable_set and similar meta-programming APIs in the driver are cataloged.
      • For each site, either:
        • The pattern is replaced with a clearer, encapsulated alternative, or
        • It is explicitly documented and constrained (e.g., a single well-justified internal helper).
      • No behavior regressions in CI, and code in Mongo::Cluster (and other core types) reads as straightforward OO Ruby.

            Assignee:
            Jamis Buck
            Reporter:
            Jib Adegunloye
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: