User:Lyumn/Opw proposal

Proofread Page Code Refactoring

 * Public URL: https://www.mediawiki.org/wiki/User:Lyumn/Opw_proposal
 * Bugzilla report: (link to the related report at http://bugzilla.wikimedia.org )
 * Announcement: (link to the announcement of your proposal at the wikitech-l mailing list.

Name and contact information
Name: lyumn Email: me@lyumn.net IRC or IM networks/handle(s): lyumn Location: Indiana, USA Typical working hours: 9am to 8pm

Synopsis
In general, there are many reasons for people to do code refactoring. For this project, the purpose of code refactoring is to make the code more friendly to the programers as well as to improve the design pattern of Proofread Page. So that it will be easier to get more contributors involved in Proofread Page extension.

In a previous GSoC project, the editor related code along with part of ProofreadPage class has been refactored. For this project, I will focus on the PHP code for database and index handling.

Database Functions
Database functions(select/update/delete) are mainly located in ProofreadPage class(ProofreadPage.body.php). It would be desirable to introduce new classes to handle these database functions. The functions will be extracted to the new classes carefully.

To clearly define the roles of the database classes, ORMTable approach will be applied to Proofread Page. Preferably, each database query would be encapsulated in a small function, and the functions handling similar topic would be grouped into a new class.

Index
In ProofreadPage.body.php, there are some long functions handling the index page. Some code sections can be extracted and moved into the the classes inside include/index folder, for the purpose of organizing a better code structure.

In ProofreadPage class, Much HTML script is coded into local variables of the functions, which makes those functions look long. I would suggest to make those HTML code out of the functions, probably by putting them into local variables of other related classes. Considering the concept of MVC, it is a good idea pulling the front-end code out of back-end functions.

Other Details
(if else/ switch cases)

Deliverables
Dec. 10th - Jan. 10th (4 weeks)

Build unit tests for database. - 1 week

Study ORMTable and related classes - 1 week

Database classes redesign and documentation - 1 week

Rewrite, extract and move functions - 1 week

Jan. 10th - Feb. 10th (4 weeks)

Test, debug and document database classes - 2 week

Redesign the code structure of index pages - 1 week

Rewrite, extract and move functions - 1 week

Feb. 10th - Mar. 10th (4 weeks)

Test, debug and document the index page - 2 weeks

Polish code and documentation - 2 weeks

About you
I am a 4th year Computer Science student. Further background is included in the application sent to Gnome.