Learning PHP: A blueprint to become a better programmer

Feb 14, 14 • MiscellaneousNo CommentsRead More »

My previous post outlined a blueprint for learning the basics of PHP. This post will build on that by detailing roughly the steps that are required to turn yourself from a PHP rookie to an industry ready PHP developer. It’s assumed that, by reading this, you’re capable of building web applications in PHP (be it from scratch or on top of a pre-existing framework). This post will outline how to build applications elegantly, to the point where it’d be difficult for anybody to criticise your work. Let’s begin.

Kicking bad habits

The biggest tell of an inexperienced programmer is the sheer ugliness of their code. Whether it be poor or inconsistent indentation, variable declarations, reliance on global variables, use of goto statements, lack of commenting, program logic or security vulnerabilities, the tells are there. It’s at this point in your development you really need to focus on the quality of your code by kicking your bad habits. Here are a couple of great resources you should gradually read through:

Try out a range of PHP frameworks

Writing your own code is great, particularly as a learning tool. Rather than turning to Google or a textbook to find the solution for a particular scenario, writing your own code allows you to tackle the problem head on, and is great as an educational means for furthering your early development. However, when you reach the point in your development where the advantages to be gained from coding from scratch pale in comparison to its disadvantages, it’s time to move on. One of the most effective means of accomplishing this is to start using a framework to drastically reduce the development time for any given project.

What are PHP frameworks?

PHP frameworks streamline the development process, taking advantage of the rapid application development (RAD) methodology. When utilized properly, frameworks cut down on the development time of an application, reduce the amount of repetitive coding that would otherwise be required by developers, enforce strong coding standards and lead to a more stable and robust application.

I won’t go in to a detailed analysis of PHP frameworks in this post (there’s just too much content to cover), however I would recommend reading this discussion of PHP frameworks from the guys over at noupe. It should provide a basic analysis of PHP frameworks.

What framework should I use?

There are many great frameworks out there. Rather than downloading and only using the one, I recommend you give a range of different frameworks a go. There are some that might be better suited to your development style, some that are more suited to different types of projects or some you just prefer using. Having been exposed to most of the major PHP frameworks, I’m a strong proponent of Yii, and I’d highly recommend you give it a go at some point.

3rd Party Libraries

Continuing the focus towards code reusability, there is often no need to reinvent the wheel unless there is an inherent flaw in an existing codebase or required functionality that is missing. Too many times I’ve seen developers spend days and often weeks on a particular subproject, when there is already great open source libraries out there that are more often better and more feature-enriched than what the developer could otherwise create in that short period of time. Do your research before jumping in to the code. Planning is the most important stage of any project.

Version control

One of my biggest qualms are developers who don’t properly utilize version control. The advantages of version control are just too one-sided to not take advantage of. To name a few:


Provided your repository exists in multiple locations (be it a central server or a distributed series of repos), it provides a means of safe storage and back up of your code. If one repository is corrupted or accidentally deleted, you can simply pull back down from another.

Working collaboratively

Multiple people are able to collaboratively work on one codebase from a range of different locations. If you’re new to programming, you’ve probably either programmed alone or, if you have programmed in a team, worked off the one set of code, or manually integrated changes from another developer. Version control streamlines this process to the point where working collaboratively is easy. You’re  able to work on the one codebase remotely and push and pull changes from other developers and merge them in to your local repo.

Peer review

Open source has gained a lot of momentum in recent years as the go-to form of  development. Other than permitting collaboration from developers all over the world, it also allows them to peer review your code and provide feedback. The more skilled developers who review your code and provide feedback, the better your code will eventually become.

Industry standard

The proper use of version control is one of the most basic pre-requisites when applying for development work in the industry. If you’ve never used version control and aren’t able to talk comfortably about it with other developers, you’re going to be in for a rough time. I’d go so far as to mention that when applying for a developer role, the topic of version control almost always comes up in the interview stage. Make sure you know it and are able to hold your own.


Comments are closed.