I am a native PHP developer, and have been for about a year or so. I love PHP and it was very easy for me to learn, but I have developed some bad habits along the way due to never having a formal education in programming. It’s pretty easy to get the job done in PHP without writing the best code.
I am looking to work more with another language; not because I don’t like PHP but because I want a clean slate to learn programming fundamentals. I am looking to stay with web development, so Ruby or Python seem to be where I’m leaning, though I am open to other suggestions. The more important question is, how do I approach learning this new language to really become a good programmer rather than a guy that can “get the job done”?
1
The best introduction to programming professionalism that I know of is a book called The Pragmatic Programmer. It discusses various aspects of software development, and is useful to learn what you don’t know. It’s also small and easy to digest compared to a more complete (hur hur hur) book like Code Complete.
For web development, your next step is to learn about the Model-View-Controller pattern. Building a small project using a framework like Yii, or CodeIgniter should allow you to get the hang of it.
The most important idea behind MVC is separation of concerns. If you separate your code well, then changes to one part of a program won’t affect other parts negatively.
Your code will spend about 80% of it’s lifetime in maintenance mode. That’s when you have to go back to fix bugs or add new features. After a year, you won’t remember what you coded any more. (I don’t remember what I coded last month.) The more readable and well-structured your code is, the better for future you. Code readability is very important.
Documenting your project is important too! You don’t want to try to remember what the database password used to be. Keep login and hosting details down in a secure location.
Finally, learning new languages (plural!) will help you become a better programmer. I like Python, so I suggest you start with that.
Also, if you are so inclined, the Tao of the Hacker may prove enlightening.
UPDATE 2018: Since this question was asked, several options for self-taught developers to get a more formal education have opened up. I still think the books above are a great foundation for programming craft, but the study plans mentioned below can help you get really solid technical skills.
- Old Google Guide to Technical Development
- OSSU Computer Science Study Plan
3
You can learn to program in a cleaner way with Php.
Start by using a framework if you’re not doing that already; read some code from big-scaled and well-reputed Php applications. You should also study design patterns and try to apply them.
In any case, having a clean code doesn’t come automatically from using some language or tool; it’s something you have to work on.