Fulgurio

Make a better web

  • B.A.-BA of developer : the config file

    May be you will find that this post is a little bit stupid, but I’ve been confronted several times with this kind of mistake, and I think it’s interesting to explain why it is a mistake.

    Usually in yours developments, you have to store informations which are different in each environment. For example, informations access to the database in a production environment will be need to be different from the development environment.
    This information is stored in the source code, and must be ABSOLUTELY grouped in a single file.

    Why? Imagine that each developers put in its own code his own parameters. This works fine on development environment, but not on the other environments. One must look at the parameters in the code and modify it to make it work on its environment. In short, we can spend time there.

    Worse, when deploying the website, you will probably not be the person who will deploy the website. The third person will be advised of the location of each parameter. Ok, the deployment takes place only one time, but what about evolution ? One might be lead to deliveran evolution, and during deployment, not possible to make the site offline for the setting of new files.

    The majority of tools (if not all) uses a configuration file where you find all these parameters. So just edit a single file for the site is functional in a new environment, like config.php.

    So please, use one single file to put all parameters of your project ! Thinks for the other guy who will use your code !

    Further, the best is to have a parameter file for production and a second file for development environement,and to have a script that loads the correct file depending on the environment. That way, no cold sweats in the crash of all files. This will be the subject of next post.

  • Book for PHP developers

    Today I will talk about a book that I highly recommend for PHP developers who want to improve the way they work. Some things should not (hopefully) be unknown to you, but asimple reminder does not hurt.
    For information, it is by reading this book that I got the idea to create a wiki for webmasters, as the book refers to tools that have evolved, and others have appeared. Hence the interest to have an up to date, in the form of a wiki.

    This book, published by Packt, is labeled Expert PHP5 Tools, written by Dirk Merkel. As thename suggests, Dirk describes the tools to be used in PHP development.

    I’m not going to copy / paste all chapters name, but generally, they are tools that all developers must use today. I still can not understand how some developers can work with notepad for object language, or without versioning tools like SVN or GIT.

    Here, no development board (actually, a bit, talking about  PHP_CodeSniffer), just toolslike eclipse and phpDocumentor, with their quality and their settings.

    This is a book that I recommend to everyone, it reads quickly. For project managers, this is the kind of gift to give your developers 😉