These days I’m finding that there are a lot of people ‘writing’ PHP. The problem is quite a lot of these people think they’re qualify as a developer after producing a couple of simple sites.
So I’m going to give some advice on things you can do to improve your skills.
Reading the Right Tutorials
The problem with the internet these days is there is so much information out there that is incorrect or instills bad practice’s. This is rife especiallyÂ amongÂ WordPress tutorials, many of them being out of date and can contain depreciated methods.
Here are some great places to pick you good advice:
- PHP The Right WayÂ – This is probably the best place to learn PHP.
- PHP MasterÂ – Articles of all levels from some great PHP minds.
- Smashing Magazine | CodingÂ – MoreÂ front-endÂ stuff but still has some great articles.
Once you have starting getting a feel for PHP my advice would be to start reading other peoples code. Being able to read both good and bad code will help you with potential employment in the future. I find a lot of businesses that have in-houseÂ developed PHPÂ systems are generally coded by under-skilled developers. So when taking over a project, you can avoid a complete re-write and saving the business money.
Reading good code helps instill and reinforce goodÂ practicesÂ and sometime gives you ideas/improvements to code you may write in the future. And as you advance, looking at frameworks can help with understanding the ‘bigger picture’.
In PHP there are quite a few frameworks available. Some are designed for general purpose applications and others for creating API’s. The problem with these frameworks is if you start using one without a proper understanding of PHP, it can lead to developers becoming dependent on frameworks and not being able to code properly without one.
The best thing to do with a framework, is to go through the code and understand what is going on before using it to create an application.
Here are some great PHP frameworks:
- Fuel PHP – My personalÂ favoriteÂ at the moment. Uses most of the newer PHP 5 features.
- Codeigniter – I used to use this one a few years ago.
- Zend Framework – This is the big daddy.
I have mixed opinions on comments. Some people say “comment everything”, I think this is important when starting out, it helps you get around your code. Once you’ve gained experience, start commenting less and less.Â
At a more advanced level, commenting classes and methods is important to help know how that piece of code fits into the application as a whole. It shouldn’t be a running commentary of each line.
A Few Years Later
So you know about all the nitty gritty about PHP, you are able to write your own framework and can read PHP like it’s english. One thing I have come across with developers at this level is ego!
This can be dangerous from a business point of view. For example, a company has a developer that has created there own framework, not because it was a good businessÂ decisionÂ but because they think they can do better. In-house frameworks generally suffer from common problems:
- Lack of documentation.
- Lack of testing.
- Lack of structure.
Having only one or a few developers work on a custom framework, it can be hard to fit all the points above into a deadline and can be a challenge to convince a non-tech manager why they are required. Using one of the many public frameworks out there you gain the benefits of many developers (at least some more skilled than you) documenting, testing and bug fixing for you.Â
To be successful in your PHP career, developing a commercial sense is essential. Sometime in a commercial environment, things need to be completed quickly and often it is impossible to follow best practices, getting the code workingÂ outweighsÂ the need for best practice’s. You will have to write bad code that gets the job done!
Hitting the right balance can be difficult sometimes, fighting your inner voice, cringing at having to write bad code but learning to ignore it sometimes isÂ invaluable.
Also using a framework will help speed things up allowing you too get on with writing the application.Â
That’s it for now, I hope I haven’t offending anyone and if that is the case, I apologise. I will be writing part 2 in the next few days.
If anyone has any suggestions, please leave a comment.