Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-148

Factory methods vs constructors

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • 0.11
    • 1.0
    • None
    • None

    Description

      Currently, many classes in the C# driver have both public constructors and factory (Create) methods, with different functionality (i.e. factory method usually caches thread-safe objects like MongoServer and MongoDatabase). I wonder if constructors should not be public to promote use of factory methods (since subclassing such types isn't practical, the constructors should become private and said types should be sealed)?

      Attachments

        Activity

          People

            robert@mongodb.com Robert Stam
            onyxmaster Aristarkh Zagorodnikov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: