There are plenty mistakes that you can make as a developers, plenty of them unrelated to the programming language you are using. Let's see:
I think I left here a list of advices more than a list of mistakes to avoid. And I could go on and on about things that developers don't do right. At the end of the day, all this can be summarized in one simple principle: learn and practice constantly. Doing so will not guarantee that you won't make mistakes (everybody did, does and will do), but it will definitely take you through all the steps of the process.
- Never ever ever ever use ‘eval’ - it will open a can of worms you don't want to deal with
- Do not trust user input, a.k.a. always sanitize input - make sure you escape and validate any user input before actively using it (using it in a DB query, writing to a file etc.)
- Pay attention to your coding style - great code might (and usually does) take a 3-steps process: write code that works, improve the code to be easy to read and maintain and optimize the code
- The first is easy and it just takes a bit of practice, nothing much to say here
- Refactoring code to make it easy to read and maintain takes more experience than the first step. It requires attention to details about the various sets of principles (SOLID, DRY, simplicity and common sense), about the side effects of each function/method you write, about the seggregation between the internal logic of you code and the API it exposes. This is a large topic, subject of other questions already asked on Quora
- Optimize code - again, something that comes with practice.
- Do not avoid unit tests - automated tests will solve a lot of problems for you (helps catching bugs, helps giving code a better structure, helps with the corectness of your code and so many more)
- Use PDO instead of myslq/myslqi - it offers the same level of abstraction of a DB connection with the advantage of OOP style
- Do not reinvent the wheel - the community is filled with solutions that people already thought of to problems you haven't encountered first. Use them, don't attempt to reinvent the wheel. But make sure you understand how they work. Copy-Paate oriented programming will keep you in the begginner area longer than you think
- Write code - don't be afraid to experiment, try things just out of curiousity if nothing else. Practice is the key

COMMENTS