Our PHP coding ethics
The following rules apply to our way of PHP coding:
- Get the big picture first – before you start coding your classes and functions: create dummy classes and functions, adjust them to each other like building the complete frame for your house. If this is standing and yet returning no PHP error… start bringing life into the functions and classes by going from the top managment processes down to the one- or two-line functions…
- Write comments first – Before you start coding a function or something else which is sequentially doing something… go through the whole process without coding a single line and create a PHP comment for every single step you want to go.
- Build hierarchical SQL queries – when you need to build your queries by yourself: Build them hierarchically! This means, try to have every part of your query occuring only one time in your code… esp. WHERE clauses.
- Thight space for your functions – interfaces are everything in coding: The interfaces between the functions and classes, the interfaces of your objects define how well your application will run and how sensitive towards fault events it is. Make your interfaces as precisious as possible. Design their values as restrict as possible and test this with UnitTests
- Coding is not about how to write your signs and letters and code snippets. It’s about how to avoid every single sign and letter. If you optimize your code on whats really really necessary, you can be sure that you thought about the exact way of “how-it-should-work” and you got rid of unnecessary code which might be a source of bugs and failures.
- as a conclusion of (5): Coding is about thinking. Not about typing code
April 3rd, 2007 by admin