This posting is a reply to the question that is the title of this posting. It has been asked in the CakePHP Discourse forum before. As I like to recycle my sometimes exhaustive answers into blog articles this one is no difference.
From the sometimes pretty silly questions I see on Stackoverflow I would say the thing most people struggle with is actually not even writing code but being able to organize and educate them-self and being able to make conclusions based on logic. Both is a crucial skill for a software developer.
It is incredible how many people who want to be programmers are not even capable of reading and understanding a very simple and well worded error message. For example recently there was a guy crying very loud for help because “intl extension not found”. If you can’t make the conclusion “Ah, the php extension is missing. Check Google on how to install it. Follow instructions.” then you have a far more serious problem than a coding problem. And I would say people who struggle with these very basics will never ever become capable programmers. This is not even tied to a framework or programming at all, it is a generic issue that applies to whatever they want to do. This needs to be addressed first.
Principles and concepts
So my first advice to everybody, even in my martial arts lessons, is learn how to learn and learn principles. Everything else is mostly just an exercise.
When the this problem is fixed and a person is able to work with structured information and able to make basic conclusions it’s time to start with… guess what: Tutorials. Usually every better project these days comes with at least one tutorial to get started with the very basics.
Reading and reading the correct way
Next advice is to read documentation and books and to read them from the beginning. People tend to start picking pages from chapters far beyond the basics and then start crying because something is not working because they haven’t even understood the principles (back to first advice) or not read the introduction / beginner guide (back to advice two).
If you managed to master the first two things I just explained, then and not before, start with a simple project.
Becoming an expert after that in something requires exercise and practice and it is required that basic principles (advice one) are understood and can be applied. If principles aren’t understood it’s impossible to become professional in anything. This applies to martial arts as well as programming, it is universal.
To know a lot doesn’t make you smart
Knowing a lot of things doesn’t mean somebody is smart or a good programmer. I can know the whole API of a lib or framework, if I fail to apply principles and best practice on that knowledge I’ll still stay a dumb copy and paste drone and write terrible code. If you understood the principles of programming the language nor the framework will matter much. It will be just a matter of time to learn the API. Being able to apply principles to your knowledge in a craft is what it means to be professional – IMHO. People who can’t apply concepts and principles to knowledge are just parrots. Another example, you can’t communicate in a language by just knowing the words, you must understand the grammar as well to build meaningful sentences.
Participate in Open Source Projects
Another good advice is to participate in open source projects. People will peer-review your code and give you feedback on it. And you’ll look on other peoples code as well and learn from it. The only tricky part here is to know what a well written project to contribute to is. For example WordPress is really really bad, it’s just terrible. But you can contribute to almost any of the most popular php frameworks (Zend, Symfony, Laravel, CakePHP…) if you want to be sure that you’ll have to follow best practice and principles when you try to get your pull requests merged.