JanZerebecki added a comment.

> When things have a conceptual dependency, it is not bad design to have a code 
> dependency there as well.


As far as I understand that, it argues for tight coupling (i.e. 
Sites::getSingleton() where the URL is used). Arguing for loose coupling might 
read like this:

"When things have a conceptual dependency they should share an interface and 
the dependency should be injected. The origin of dependency, and the 
implementation should have a code dependency on the interface, not on each 
other."

> Relying on global state like that for conveniance is what MediaWiki is doing 
> all over the place, with horrible results for testability and modularity.




> so there is no state (global or local) involved and you can indeed use static 
> code if you like


State was here referring to names that are in scope. Static code is global, you 
can not replace a call to Sites::getSingleton() with a call to a mock without 
changing the global named Sites. Thus using static code makes it harder to test 
units in isolation, where the dependencies are replaced with mocks.


TASK DETAIL
  https://phabricator.wikimedia.org/T118860

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: JanZerebecki
Cc: mkroetzsch, adrianheine, hoo, thiemowmde, aude, Jonas, JanZerebecki, 
JeroenDeDauw, Aklapper, StudiesWorld, daniel, Wikidata-bugs, Mbch331



_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to