5 ms·
I think this seems a pretty insane way of doing it; why not change the default behavior instead of making another driver with a separate name as well as keeping
by ukd1 14y ago
I think this seems a pretty insane way of doing it; why not change the default behavior instead of making another driver with a separate name as well as keeping the old one too?
This is likely to be super confusing to new users; rumours that it's write safe and all the common examples will be fore the old driver...
IMHO they should have altered the defaults; people who require the extra performance will likely be the ones reading the changelogs / docs / these posts and notice.
- msbarnett 14y ago> I think this seems a pretty insane way of doing it; why not change the default behavior instead of making another driver with a separate name as well as keeping the old one too? Because, as they clearly explain in their rationale, that would break compatibility with all of the existing software out there that relies on the current semantics. Thou Shalt Not Break Working Code is the first rule of building software that other software relies on. They're deprecating but retaining the old driver to give people a transition period in which to modify their software instead of kicking them in the teeth immediately or forcing them to hold off on upgrading. That's the mature approach to fixing mistakes that people nonetheless built assumptions around.
- ukd1 14y agoWhat does it break? This new default makes it behave as most users of it would have expected it too when writing their code. IMHO the users who require un-safe writes will be the ones to read this kind of news and notice and could alter it, if needed. I don't think this is true vice versa.
- jamesaguilar 14y agoIf people are relying on the current speed, changing the default to safe would break them.
- mathias_10gen 14y agoOne case that could break by this change is if you relied on insert's old default of being a no-op if an object with the same _id already exists. This can be used to efficiently insert a default document without race conditions. Example at https://github.com/RedBeard0531/Mongurl/blob/master/mongurl.py#L51-57 https://github.com/RedBeard0531/Mongurl/blob/master/mongurl.... That said, it makes sense for this to be opt-in behavior rather than the default.
- MichaelGG 14y agoIf it's properly deprecated, the old constructor should cause a compiler warning with a message explaining the issue. This way, old and new users of the new library will get the message, even if the sample uses the old constructor. At least in languages that support that feature (.NET, Java, C++ with some extensions). A more aggressive approach, used e.g. in the CLR for really serious problems (like the improper HMAC calculation bug, or background threads not aborting in CLR < 2.0) give you a warning and allow you to switch it off via config, so no code change is required, but everyone gets the "fix".