Refactoring: SQL Executor, Column's Structure Manipulation
Short description: The goal of this project is to refactor the SQL executor and Column's structure manipulation code. To improve the readability, reduce the complexity, and to improve the maintainability I am suggesting to refactor the SQL executor and Column's structure manipulation code using better approaches. The code will be refactored according to various code refactoring techniques mainly focusing on componentization and extract method.
Supun Chathuranga Nakandala
Country : Sri Lanka
Time Zone : UTC+05:30
University of Moratuwa, Sri Lanka
Email / IRC / Jabber
Email : firstname.lastname@example.org
WWW / Blog
Blog : scnakandala.blogspot.com
The goal of this project is to refactor the SQL executor and Column's structure manipulation code. To improve the readability, reduce the complexity, and to improve the maintainability I am suggesting to refactor the SQL executor and Column's structure manipulation code using better approaches. The code will be refactored according to various code refactoring techniques mainly focusing on componentization and extract method. And also I am planning to add some of the essential "todo functionality" to the code
Benefits to the users
This project is basically a code refactoring project. Therefore it doesn't improve the functionality or add new features. Therefore the benifits will be not for the users of the software but rather for the developers themselves. After completing this project
- The code base will be more readable and easily understandable
- It will be easy to fix bugs and encounter new bugs
- The structure of the code will be uniform over all the parts of the code base
- Reusability of the code will be increased
- It will be easy to add new features and change exisitng features without breaking the exisitng code and without much effort
In this summer I propose the refactoring of following sections of the phpMyAdmin. This refactoring project idea is proposed by Marc Delisle.
- SQL Executor
The sql.php is a very large script and is also one of the central components in phpMyAdmin. As it is large it is hard to read and maintain. It needs refactoring and better integration with other scripts calling it. So I am suggesting to do the following changes.
Add a new script called sql.lib.php - This scripts will contain functions to do the tasks which are now done by the sql.php such as generating html strings for drop down lists, query results, error, checking for privileges before executing the query, handling bookmarks etc. In sql.php it will simply call these functions. By doing this we can make the logic of the sql executor clean, clear and concise.
Transfer the parse and analyze of the sql query to the sql parser - Currently the sql.php is parsing the sql query to accomplish certain tasks. I am suggesting to transfer that functionality to the parser in order to separate the concerns.
- Column's Structure Manipulation
This code area is responsible for manipulating the table structure in phpMyAdmin. In this project I am planning to refactor tbl_create.php, tbl_structure.php, tbl_addfield.php, libraries/tbl_properties.inc and tbl_indexes.php.In general all these files has the issue of HTML code mixed with PHP code. So the HTML code should be separated out and put into separate functions. I am suggesting to create library scripts with functions to generate these html strings so that they can be called from the table structure manipulation scripts.
After the completion of this project the SQL executor and Column's structure manipulation code
- A new class called sql.lib.php will be created which contains the functionality to cater the required functionality when executing a sql query.
- sql.php will not contain html tags but calls the functions in sql.lib.php to generate the required html strings.
- Parsing and analyzing of the sql query will be transferred to the parser.
- Table structure manipulation scripts will not have html tags but call library functions to create the required html strings.
This is the rough project timeline
|May 27 th – June 2 nd||Read the documentation and getting familiar with code area|
|June 3 rd – June 9 th||Identify the potential areas that can be refactored|
|June 10 th – June 16 th||Identify the potential areas that can be refactored|
|June 17 th – June 23 rd||Start refactoring sql.php|
|June 24 th – June 30 th||Refactoring sql.php|
|July 1 st – July 7 th||Refactoring sql.php|
|July 8 th – July 14 th||Refactoring sql.php|
|July 15 th – July 21 st||Refactoring sql.php|
|July 22 nd – July 29 th||Complete refactoring sql.php|
|July 30 th – August 5 th||Start refactoring libraries/tbl_properties.inc.php|
|August 6 th – August 12 th||Complete refactoring libraries/tbl_properties.inc.php|
|August 13 th – August 19 th||Start refactoring tbl_structure.php|
|August 20 th – August 26 th||Complete refactoring tbl_structure.php|
|August 27 th – September 2 nd||Refactoring tbl_create.php|
|September 3 rd – September 9 th||Refactoring tbl_addfield.php|
|September 10 th – September 16 th||Refactoring tbl_indexes.php|
More than 40 hours per week
I am an open source enthusiast. My motivation of taking part in GSoC is to get the chance to actively participate in a prominent open source project.
I’m Supun Nakandala, a third year Computer Science & Engineering undergraduate from Faculty of Engineering, University of Moratuwa, Sri Lanka. I am an open source enthusiast and I use many of them (including phpMyAdmin) for academic purposes and for personal use. It has been my dream to actively contribute to a prominent open source project. I have taken courses in Object Oriented Programming, Object Oriented Software Development, Data Structures and Algorithms, Database Management Systems, Software Engineering etc in my university curriculum.
Open source contributions
My open source contributions can be found here. https://github.com/scnakandala
https://github.com/phpmyadmin/phpmyadmin/pull/195 (phpMyAdmin Contest-3)
New Selenium Tests
Favorite phpMyAdmin feature
My favorite phpMyAdmin fetaure is the AJAX based visually-driven relation definer.
It would be better if we can add the functionality of an AJAX file uploader to phpMyAdmin.