Hey,

Today I spotted some new code on gerrit breaking basic dependency rules, making it clear that at least in Wikibase.git, the number if such violations is not going down. It might in fact be increasing. Hence I'll outline the basics here, in the hope people stop introducing these violations.

* Wikibase Repo depends on WikibaseLib
* Wikibase Client depends on WikibaseLib
* Client and Repo do not depend on each other

From this follows:

* Using Repo code in Lib is not allowed
* Using Client code in Lib is not allowed
* Using Client code in Repo is not allowed
* Using Repo code in Client is not allowed

There is no good reason to violate these points. "But", you might say, "there are valid use cases for doing so". And yeah, if you want to follow the Big Ball of Mud design pattern, you'd be right. If you run into a case where at first glance it looks like you need to violate one of these rules, consider that

* your design is very likely flawed in some way - violating these rules is a strong design smell
* the flaw might well be solved by applying inversion of control

Rethinking your design might take some effort and time, esp if you already committed to it by writing a pile of code. Laziness is however not an excuse for creating design problems and ignoring things such as the acyclic dependencies principle. To minimize the amount of work everyone needs to do, including yourself, try to hold these basic rules into account when designing your code. They are not complicated, and the benefit well outweighs the little effort.

I expect people to adhere to these rules when submitting code, and when reviewing. If new violations keep being introduced, we'll have to look at enforcing these things automatically. I do hope we can muster the little discipline to avoid the need for this.

Cheers

--
Jeroen De Dauw
http://www.bn2vs.com
Don't panic. Don't be evil. ~=[,,_,,]:3
--