<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:51:58 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[JAVA-303] Convert Mongo/DB/DBCollection to interfaces</title>
                <link>https://jira.mongodb.org/browse/JAVA-303</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;There are many testing/mock frameworks which prefer to work with interfaces rather than (abstract) classes.&lt;/p&gt;</description>
                <environment></environment>
        <key id="15213">JAVA-303</key>
            <summary>Convert Mongo/DB/DBCollection to interfaces</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="2">Won&apos;t Fix</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="scotthernandez">Scott Hernandez</reporter>
                        <labels>
                    </labels>
                <created>Tue, 22 Mar 2011 22:07:34 +0000</created>
                <updated>Thu, 6 Apr 2023 18:54:33 +0000</updated>
                            <resolved>Thu, 27 Mar 2014 22:15:52 +0000</resolved>
                                                                    <component>API</component>
                                        <votes>11</votes>
                                    <watches>11</watches>
                                                                                                                <comments>
                            <comment id="525269" author="jeff.yemin" created="Thu, 27 Mar 2014 22:15:52 +0000"  >&lt;p&gt;After much discussion, we&apos;ve decided not to make this change.  I apologize to those who have been waiting for it for a long time, but binary compatibility is extremely important to us and we&apos;re not going to make a change like this that breaks it.&lt;/p&gt;

&lt;p&gt;Instead, we will develop an entirely new API for database/collection/cursor that is defined using interfaces from the start.  Users who need interfaces can migrate to the new API.&lt;/p&gt;</comment>
                            <comment id="416683" author="jeff.yemin" created="Tue, 3 Sep 2013 13:33:42 +0000"  >&lt;p&gt;@Christian, we are exploring design alternatives here.  Can you tell me what would be the implication for your software stack if the driver uses interfaces for DB/DBCollection, and were to add methods to those interfaces in minor releases (which would be quite likely)?&lt;/p&gt;
</comment>
                            <comment id="416615" author="christian.tonhaeuser@navteq.com" created="Tue, 3 Sep 2013 10:35:27 +0000"  >&lt;p&gt;Is this going to happen in 3.0.0?&lt;br/&gt;
Just asking because this is one of the features we&apos;re really waiting for.&lt;br/&gt;
Also, since it&apos;s going to break binary compatibility, I&apos;d expect it to either happen in 3.0.0 or not at all...&lt;/p&gt;</comment>
                            <comment id="266121" author="jeff.yemin" created="Thu, 14 Feb 2013 14:18:11 +0000"  >&lt;p&gt;This is not going to happen until 3.0, as it will break binary compatibility.  &lt;/p&gt;</comment>
                            <comment id="266116" author="christian.tonhaeuser@navteq.com" created="Thu, 14 Feb 2013 14:12:31 +0000"  >&lt;p&gt;I&apos;d also like to have things like DB, DBCollection, DBCursor, ... being Interfaces.&lt;br/&gt;
We make heavy use of AOP in our software stack and being able to easily wrap a proxy around certain MongoDB classes would surely help us a lot.&lt;br/&gt;
(e.g. things like handling MongoExceptions, parsing WriteResults and retrying the operation if necessary, ...)&lt;/p&gt;

&lt;p&gt;For now we built delegates, but that&apos;s a rather big pain.&lt;/p&gt;</comment>
                            <comment id="202773" author="jeff.yemin" created="Fri, 30 Nov 2012 02:24:41 +0000"  >&lt;p&gt;Had to close and re-open to get the resolution out of the wrong state.&lt;/p&gt;</comment>
                            <comment id="201618" author="curtisr7" created="Wed, 28 Nov 2012 22:19:16 +0000"  >&lt;p&gt;Can someone change the resolution to something other than &apos;fixed&apos;? That blocks people from voting.&lt;/p&gt;</comment>
                            <comment id="201587" author="curtisr7" created="Wed, 28 Nov 2012 21:55:07 +0000"  >&lt;p&gt;Any chance that this is going to get completed in the next release?&lt;/p&gt;</comment>
                            <comment id="160023" author="andrew.duncan@192.com" created="Tue, 4 Sep 2012 08:29:36 +0000"  >&lt;p&gt;I tried to vote for it, but I don&apos;t seem to have permission &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;

&lt;p&gt;This is a thin DAO layer I&apos;m trying to implement, my &quot;domain model&quot; is essentially a series of maps.  I can hold on for version 3, though.&lt;/p&gt;</comment>
                            <comment id="159935" author="jeff.yemin" created="Mon, 3 Sep 2012 16:37:14 +0000"  >&lt;p&gt;It has 0 votes, for one...  &lt;/p&gt;

&lt;p&gt;For now, can you mock at the the DAO layer of your application instead? &lt;/p&gt;

&lt;p&gt;We&apos;ll likely do this in a major release (3.0), as it will break binary compatibility.  &lt;/p&gt;</comment>
                            <comment id="159908" author="andrew.duncan@192.com" created="Mon, 3 Sep 2012 15:47:50 +0000"  >&lt;p&gt;Hi.  Whatever happened to this change?  Trying to efficiently mock DBCollection is killing me.&lt;/p&gt;

&lt;p&gt;Thanks.&lt;/p&gt;</comment>
                            <comment id="28511" author="bsas" created="Sat, 9 Apr 2011 21:23:36 +0000"  >&lt;p&gt;Recreate the PATCH from the 2.5.3 version.&lt;br/&gt;
It is the same thing, but with the newest version of the MongoDB driver source.&lt;br/&gt;
This will probably make the merge easier.&lt;/p&gt;</comment>
                            <comment id="28325" author="bsas" created="Fri, 8 Apr 2011 05:04:18 +0000"  >&lt;p&gt;Because that leads to more code change. I extracted the Interface like I said (MongoInterface) and now Mongo implements it. So, with that, you can already mock.&lt;/p&gt;

&lt;p&gt;The only problem is that there is a lot of places (and backward compatibility) that says: Mongo mongo = new Mongo(...);&lt;br/&gt;
So, now, for mocking, you can say: MongoInterface mongo = new Mongo(); (that&apos;s what I did)&lt;/p&gt;

&lt;p&gt;But DB and DBCollection are interfaces now, and the abstract classes was renamed to DBImpl and DBCollectionImpl.&lt;/p&gt;

&lt;p&gt;I tested all combinations and I think that one is by far that keeps backward compatibility.&lt;/p&gt;

&lt;p&gt;By the way, mocking works perfectly. I tested with Mockito and PowerMock.&lt;/p&gt;</comment>
                            <comment id="28164" author="remonvv" created="Thu, 7 Apr 2011 10:40:39 +0000"  >&lt;p&gt;Why wasn&apos;t Mongo converted to an interface like the rest? This still means you&apos;d have to refactor mongo related code in your applications to use MongoInterface rather than Mongo. Not completely insurmountable but certainly not ideal to require a production code refactor to enable mongo mocking.&lt;/p&gt;</comment>
                            <comment id="26532" author="bsas" created="Wed, 23 Mar 2011 00:37:12 +0000"  >&lt;p&gt;Big refactoring, but simple and easy.&lt;br/&gt;
I didn&apos;t converted the Mongo to an interface. I just created a MongoInterface and extracted the methods.&lt;br/&gt;
But for DB and DBCollection I converted, changing the name of the abstract classes to DBImpl and DBCollectionImpl.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="87063">JAVA-934</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="23870">JAVA-456</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="11399" name="0001-JAVA-303-Convert-Mongo-DB-DBCollection-to-interfaces.patch" size="184430" author="bsas" created="Sat, 9 Apr 2011 21:23:36 +0000"/>
                            <attachment id="11143" name="0001-JAVA-303-Convert-Mongo-DB-DBCollection-to-interfaces.patch" size="184918" author="bsas" created="Wed, 23 Mar 2011 00:38:09 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10012"><![CDATA[Major Change]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrga2n:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>8533</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>