Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Conversation

@StanleyGoldman
Copy link
Contributor

As mentioned in #390 (comment)
I changed IRemoteConfigBranchDictionary to implement IDictionary<string,Dictionary<string,ConfigBranch>>

@drguthals
Copy link

Why are you implementing using Dictionary instead of IDictionary? Is using the actual class what allows you to take out all of the implementation methods that you also removed?

@StanleyGoldman
Copy link
Contributor Author

IRemoteConfigBranchDictionary should have never implemented IDictionary<string, IDictionary<string, ConfigBranch>>. Fixing that allowed me to remove a chunk of unused code.

RemoteConfigBranchDictionary inherits Dictionary<string, Dictionary<string, ConfigBranch>> as a result it automatically implements IDictionary<string, Dictionary<string, ConfigBranch>> which is not the same as IDictionary<string, IDictionary<string, ConfigBranch>>.

@shana
Copy link
Member

shana commented Nov 15, 2017

Also, in general we don’t have any custom implementations of IDictionary and other list/collection interfaces, so there’s no advantage in passing interfaces around (tests can use the concrete classes just fine as well). We only pass interfaces around when we need to have them available in GitHub.Api but implement them in GitHub.Unity

Unrelated to Dictionary, just fyi Unity can serialize List<T> so we tend to rely on concrete classes for serializable types.

@StanleyGoldman
Copy link
Contributor Author

RemoteConfigBranchDictionary has functionality that is specific to Unity (i.e. runs in Mono).
Our unit tests cannot use classes that make reference to Unity's libraries. So those classes are usually represented with interfaces and stubbed in unit tests to make other classes testable.

To aid this effort classes in GitHub.Api in particular don't reference the Unity libraries.

@StanleyGoldman
Copy link
Contributor Author

IRemoteConfigBranchDictionary lives in GitHub.Api

Copy link
Contributor

@jcansdale jcansdale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense. I had questions but they're already been answered above. 👍

@StanleyGoldman StanleyGoldman merged commit 743ed7b into master Nov 20, 2017
@StanleyGoldman StanleyGoldman deleted the fixes/remote-config-branch branch November 20, 2017 19:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants