Skip to content

~GSoC2010: Martin Richard's code refactoring

anildash edited this page Mar 26, 2011 · 1 revision

Abstract

The main goal of this proposal is to perform some code refactoring in order to enhance the area of consistency of the application design, user interface and front-end code.

Thread in the mailing list

Note : Actually, I was one hour late to submit my application, I won’t be into gsoc this year !

Tasks

The project is divided is several tasks, described in the following paragraphs.

Document the code

I think that this is the first task to accomplish : write comments for the classes, methods and functions using a php-doc syntax. This long task will help me to understand the application organization, and will help future contributors and plug-ins writers.

Re-writre SQL queries with prepared statement

I will replace the mysql database layer and “classic” mysql_query() with prepared statements using mysqli or PDO.

This point is discussed on the following thread

Write unit, functional and regression tests

Automated tests don’t fully cover all the Thinktank functionalities. I’ll check existing tests, identify non-tested code and write as many tests as possible.

If i’ve some more time…

Template standardization

In order to ease the integration of new plug-ins and new user views, the templates should be standardized and organized.

Most of the code fragments that may be reused into several plug-ins or pages (standardized graphic components such as notices/error messages) will be displayed through helpers.

Javascript codes may be moved into external files, offering a code easier to read and the use the browser cache.

CSS enhancement

Currently, some CSS styles aren’t fully written or sometimes buggy. For instance, there are some margin problems with lists in the configuration views, and message/error styles aren’t defined. The first step of this task is to list and sort needed enhancements into the interface.

Timeline

1. The first step consists in exploring and understanding the code, then write documentation (between 6 weeks and 2 months)
2. Update the code for prepared statements (7 top 10 days)
3. Write unit and functional tests & remove small commented tests (ie echo $var) in the code (1 month)

Clone this wiki locally