Anybody can write code and with a few months of programming experience, everybody can write 'applications'. Getting them to work is easy, but making them scalable and maintainable requires more work. Based on my experience in web development I've come up with these conclusions:
1. 20 lines rule
Always try to write briefly and to minimize the general code amount. If you have 20 lines limit for your functions, as a result you will have something readeable and easier to understand and maintain.
2. Document your code, comment your functions
Write what you'd want to see if you were reading the code
According to that common principle your comments should look similar to this example:
/*
* This function check if $param1 and $param2 are numbers and if they are
* - multiplies them and returns the results
* The function was created to make multiplying in the application easier.
*/
function foo($param1, $param2)
{
$test = $param1 * $param2;
return $test;
}
Very often good documentation is critical when you need to edit existing or add new features to the application. If you look around and read about project documentation in general you will notice, that the recommended method for documenting applications is using tools like Doxygen, but I think that in addition we must add documentation that is more human friendly.
3. Write human friendly code
It is always a good practice to write applications according to the principle "From humans for humans". If you feel that writing function a_c() {} instead of writing function access_check(){} will bring you to the world of 'rapid and 'agile' development there is a big chance that possibly you are wrong. In short term you will write faster, but the 'rapid' aura will disappear when you close the file or return to the code next week or month later.
4. Use understandable application structure
Application structure and architecture is something significant not only for web programming, but for programming in general. Always try to separate your application in layers. In web programming they are many different ways to separate logic from presentation, but standards for the industry are the n-tier and MVC architecture. I am not saying, that they are the easiest ones, but at least they are recognizable.
5. Learn new language
Learning new language is always good way to expand your programming knowledge and naturaly
expand your code quality. If you want to know what are the most used programming languages in the moment, check the TIOBE index. If you are web developer and you haven't yet tried Ruby, or Python , now is the time.
6. Learn new framework
if learning new programming language is too much for you, or you don't have enough time, try something smaller - learn new framework in the language you already now. If you are Ruby developer, Ruby on Rails is great framework and everybody likes it, but Merb and Ramaze are great frameworks too. For the PHP guys - there are so many quality frameworks out there to choose from.
7. Think, think, think, write
That one is my favourite. When I write web applications I spend lots of time thinking about application scalability, performance and reusability of the components. In long term that makes sense, because we never know how big our application will become when we write the first line of code.
Should we use Object-Relational Mapping tools? Using your framework for real applications - things to consider


