The slow and steady may win, but the fast and steady dominate. The old saying of faster not always being better may go well in other fields, but not in the IT world of today. Faster is absolutely better. You should by all means try to improve yours or your team’s programming proficiency and accelerate the development speed.
In web programming and website development, I have some suggestions for speeding up your PHP development.
- Maintain a library of commonly used features such as user registration module and file uploading module. This is pretty much the essence of quicker development. Create and reuse things.
- Write your own framework for a series of similar websites. Many websites share large percentage of user experience flow and functionalities. For instance, the Q&A system of Stack Overflow can be used in a lot of other areas too because of its generic nature, that’s why they have decided to make yet another Q&A site about server administration: Server Fault.
- Keep consistency among the database schemes across all applications, for example: 1) always have an ID, 2) always name a table by singular, 3) always name the foreign field the name of the referrenced table, etc. This way, you can much more easily migrate PHP logics across different data models.
- Recognize and take out any site-wide text strings such as common regular expressions (against URLs, emails, etc.), site title or administrator email and define them as PHP constants.
- If possible, write PHP logics as independent of the application data model as possible. Specifics like table names and field names are all to be excluded from your PHP code. Create an extra file dedicated to database structure description / operations or at least encapsulate them in an initiatiable object or array so migration to another data model is as easy as possible.
- If open_basedir directive is left unset, you may consider the convenience of creating a central PHP library for all of your websites that’s located outside of the web accessible directories, providing common modules and interior logic services to all the websites and web applications. This would greatly reduce your development time for future projects but on the other hand, it sort of increases the bonding between different websites, making them harder to customize or transfer away.
- Wrap everything up in a function at least if not in a class. Many’s the time you find yourself writing quite a chunk of code executed sequentially in a page, that’s when you should consider wrapping the chunk up as a function in the same place and immediately call it after the function definition. This may seem out of point at first, but as the program grows, it makes it look clean and easy to read and prevents the whole thing from developing into a bowl of noodles.
That’s apparently never all. Care to share some of your tips in developing more quickly in PHP?
1 thought on “A few suggestions of good practices for accelerating PHP development”
Thanks for great posts
Comments are closed.