Top 10 PHP Management Tips
In previous article I spoke about performance, this time I will talk about management, and I admit it can be hard to do both at the same time. However it is possible and if you are writing large scale applications such as yahoo or facebook you will need to be quiet organised, however larger you grow more difficult it becomes but that is another story. So!
- Get a good IDE! That is the most important; IDE like NetBeans with PHP support is the best thing since slice of bread. It allows you to comment well, gives you instant documentation.
- Comment, Comment and Comment! I have to admit I forget to do it, but this is crucial for complicated code especially.
- Declare your variables well, I mean well! Don’t write $acs = “this gets variable acs” write something like $stringAcs = (string)”this gets variable acs” , this tells a programmer that this is a string and will always be one, and by saying (string) php doesn’t have to do any guessing it will just simply use that value as a string do the same for (int) and (array) , etc.
- During Development separate everything in to different folders and files, label them, and stamp them and comment them! When it comes to production pack them all in to 1 file. Also make sure that file only contains classes and methods you need.
- Back up , one of the things you have to do like a habit, is that after each day of work before you go home just zip the files up and back them up to external hard drive, being even more safe back them up to 2 different hard drives.
- Use a good architecture and separate your presentation from your logic, there is nothing worst then not knowing where is what.
- Implement plug-in architecture, things that you won’t use for a very long time but you might use for a year or so, just use as a plugin. It is easy this way, as every time you need to update certain module you just simply update it and upload 1 file, and you don’t need to re-upload entire framework.
- Keep a bug log! If there is more then 1 person in the team especially, make sure that any bugs that come through in the emails make sure they are noted. When they are fixed this issue probably won’t be raised, however you always get some people who might mention it, so keep records.
- When writing classes make sure that you are using similar style across all classes, so if you want to create a object at the end. Don’t call one class as $TextBox->ToString() and another class such as $CheckBox->ToCompliled() keep it all similar! Apply same class interface through out!
- I cant get this stressed enough, keep good documentation, and make sure that your team knows how to program in your organisation, train any new staff, as no one is perfect and they will have some dirty habits. It takes time to chage their ways but in the end everyone will benefit.
These are tips from my experience, and I have applied most of them in my organisations and I have to say by doing this you end up with same really nice code and you do make some amazing progress.