In the previous post I refactored the storage mechanism to store a label and a Bookmark object. This step along with the previous one makes me think that the name of the class, BookmarkCollection needs to be changed. At this point I think it should be just Bookmarks. My reasoning is that I use the term collection when I don’t have a good idea of what’s going to be stored in the collection. In this case I know that this collection is only going to store bookmark objects. Hence, the rename to just Bookmarks. For a complete code listing of all the source code after I made this change, click here. (the link takes you to a GotDotNet workspace- the associated release is 3 January, 2005)
The next item I wanted to address is the statement in the test list that says the Bookmarks class should implement the IDictionary interface. Given the current tests and the resulting implementation I am going to change this requirement. I can do this on my own because I am the customer. In real life you would need to consult with the potential users of the class as well as the project architect to insure that this type of change is consistent with the overall direction of the project. The change I want to make is to have the Bookmarks class implement the ICollection<Bookmark> interface instead of IDictionary. My reasoning for this change is a driving need to be as explicit as possible in the interface. Right now the interface that I have implies there is an association between a label and a Uri which we could infer is a Bookmark. I just want to make this explicit by using the Bookmark class as the means. This is a fairly significant change so I will need to figure out a way to do it pieces. The first thing I will need to do is revisit the test list which is where I am headed in the next post.