Wikidata/Development/Code Review

From Meta, a Wikimedia project coordination wiki

An external code review was commissioned by Wikimedia Deutschland e.V. which took place in April 2013. The basis for this report was a code review of the Wikibase extension, the code basis behind the Wikidata project. The review was mainly conducted by Qafoo GmbH employee Tobias Schlitt, supported by Jakob Westhoff for JavaScript expertise.

The final report is available here: Wikibase Quality Report Final.pdf

Executive Summary Wikibase Quality Report[edit]

The quality of the Wikibase source code is generally better than in the average PHP project. Especially the derived projects Ask, DataValues and Diff consist of well crafted code. The most pressing identified issues in the PHP code consist of a too high code complexity of multiple code entities. This leads to a decreased maintainability, because complex code is harder to understand by humans and code pieces cannot easily be replaced. As a result, the implementation of new features and the fixing of errors in the affected code take more time and are more error prone. In addition, implementation of automated tests is harder.

For these reasons, a re-factoring of the corresponding code artifacts is recommended. Approaches to achieve this were elaborated as a part of the code review and are discussed within this report. The mentioned issues occur more frequently and to a larger degree in the Wikibase extension itself. They are almost absent in the derived extensions. The overall project infrastructure of the Wikibase project is really good. The utilization of a mixture of unit, integration and front-end tests is commendable. This also applies to the development process, especially to the realized code review process. The source code is extraordinarily well documented. With regard to the test-mixture those observations are true, for the PHP as well as the JavaScript part of the project. Currently the JavaScript implementations only utilize Unit-Testing.

Many of the identified JavaScript problems arise from the usage of jQuery-UI. A lot of functionality needs to be recreated, which can already be found in other modern frameworks. For the needs of the Wikibase project, AngularJS is a good fit.