Extreme Automation
Posted on 28/3/07 by Tim Koschützki
In software development there are many things that can be automatized. Whether it be version control, the build process, deployment to the live site or generating a documentation website from your php comments. Such things, if done manually, can destroy the consistency in your project and will cause miss-feelings within your programming. So why hesitate? Make everything possible automatic!
Everything done automatically
From my experience in a company I worked for I know that when every developer uses the same IDE it can lead to uneasyness.Our lead developer told everybody to install this plugin and this plugin, each with a 2 pages manual on how to do it. At the end of the day, every work station was configured in a slightly different way. This lead to the main application exposing bugs on one work station, but not on the other, resulting in a resident nightmare.
That's only one reason why you should always avoid doing something manually. Human-beings simply can't repeat as well as machines do. Simple. Oh and we also shouldn't expect our colleagues to be able to do it. A batch script can launch the same command ever and ever again - for example a DB backup. If it worked once, then it is likely to work again.
Using Cron Jobs
A very popular tool is cron (or at on Windows systems). With it you can make your server execute certain scripts or php files on a fixed time ever and ever again. For example you could you use it to clean your sessions table in the database every night automatically, writing entries to a separate history file. Here you can find a Quick Introduction to Cron.
Automatic Testing
Using Simpletest and Cron you can easily automatize the testing process of your application and run nightly regression tests.
Generating Sourcecode
It's a best coding practice to generate all sourcecode by tools if you can. Look at our article about CakePHP's source code generator Bake here: The Bake Code Generator.
Automatic Paperstuff
Wouldn't it be nice if all programmers could use their time for programming? Unfortunately this is rarely the case. An email must be answered, contracts must be made, documents must be uploaded to the intranet. Maybe you decide for a shell script to do the dirty work 8well, not the contracts :)). However, you still have to remember to execute the script. Cron is your friend.
Generating Documentation Websites
PHP Documentor is a great tool to generate documentation sites. Simply put php doc tags around your class, methods and functions, run the phpdoc and voila - there you go.
Here is an example:
* This function computes the the sum of two values
*
* @author tim
* @param float first summand
* @param float second summand
* @return float the sum of the two summands
*/
function sum($val1,$val2) {
return round($val1+$val2,2);
}
Whatever you do, generate php documentation site often and, most important of all, automatically.
You can skip to the end and add a comment.
This post is too old. We do not allow comments here anymore in order to fight spam. If you have real feedback or questions for the post, please contact us.