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"?

  • An idea could be to take an online course on programming (there are many available online, and they are free). After you have learned good programming patterns and practices, you can (try to) apply them in any programming language. – Giorgio Jan 29 '13 at 13:20

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.

| improve this answer | |
  • +1 for Pragmatic Programmer. I'd give you another +1 for recommending learning multiple languages, but I can't. – Steve Hill Jan 29 '13 at 9:18
  • The Pragmatic Programmer looks like a great read, thanks for that! As for MVC, I use Codeigniter currently on most of my PHP projects. I love the MVC pattern, but I find myself relying on the libraries of the framework too much. For now, I'm going to learn Ruby and Rails while reading the book you suggested. – PHPguy Jan 29 '13 at 17:14
  • Relying on libraries is a good thing. Don't reinvent the wheel. – Gustav Bertram Jan 30 '13 at 6:53

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.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.