Random Notes: LAMP/Web development |Tools & Best practices


I was planning to write a post similar to this for very long time. My intension is to help beginners to know the jargons and best practices. Please add your comments and I will update.

Front-end (HTML/CSS/JS)

Tools

PHP

It is a simple language to learn, it was tailored to do so. The same advantage is its curse many do not follow standards. We no longer write simple write and forget scripts, we develop websites and application that are continuously updated/upgraded. You cannot always remember the reason why you wrote the logic that way. So always document the files, use PHPDoc (tutorial).

Coding Standards

Frameworks

Thanks to Rails (Ruby on Rails) it changed the way we use to code. Web developers were porting the features by developing PHP Frameworks and there were many frameworks available now. I prefer/suggest CodeIgniter and Zend Framework for many reasons (I’ll try to explain the reasons in another post). Use CodeIgniter (manual | Tutorial) for every (Small/Medium) project/site you will reap only benefits and use Zend Framework for Enterprise/Large projects.

Optimization: There are many things you can do before thinking about optimizing your script before jumping into caching/profiling it. Follow the simple tips like Link 1, Link 2

Version Control

I have seen people who copy a script from live servers and rename it with date stamp before editing it. There are better alternatives available called version control a great tool developed by the developers for the developers (Wow! Close to the definition of democracy). It helps us to revert back to a particular version in a second. You can analyze the log, archive a version by tagging it. It can help multiple developers to work on the same file. Whatever I have listed are very few benefits you get by using version control. I use SVN for almost all my project and I suggest you to try the same.

Testing

Testing is important to any project though I do not share good relationship with my testers :) (who accepts their faults). Programmers always test only positive/happy flow by default and testers are there to help us on developing the usable project for real time users.

And as a web developer we have more HTML forms to validate user inputs. Rule of thumb, do not trust input from users always validate.

We programmers do test the form we just add validation; however we don’t retest the same sequence of inputs that we have tested before adding an extra validation to the form. There are tools that capture our actions/inputs from the browser and replay the same N times. Tools like iMacros for Firefox are providing many options which can be overridden. This helps you to unit test your frontend. There is a unit testing framework called PHPUnit which helps you to unit test your backend/business logic so future update will not mess the site/application.

I am not aware of tools like iMacros for other browsers. I have used iMacros for testing validations of form and I have not found an occasion where the same fails in other browsers. Other than unit testing you should also test for the following

If you validate your users’ inputs then you are almost made 80% XSS and SQL injections are byproduct of malicious inputs.


Post Comment