Writing better code is important for readability, maintainability, simplicity, efficiency, and clarity. Tips for better code include commenting and documenting code according to standards, consistent indentation, avoiding obvious comments, grouping code logically, using consistent naming schemes, and limiting deep nesting. Other tips are limiting line length, well organizing files and folders, using revision control and commit messages, automating repetitive tasks, refactoring code periodically, allowing time for learning, and reading open source code.
3. Why Better Code?
• Writing better code is a universal subject in the world of computer
programming.
• Readability (for you and anyone else who has look into your code)
• Maintainability (easy to modify)
• Simplicity (not complicating things when there's no need for that)
• Efficiency (of course your code should execute fast)
• Clarity (if your code is self-explanatory, there's no need for comments most of
the time, name your methods/properties etc. sensibly, break the long code
down, never copy & paste a block of code)
4. Tips
• Commenting & Documentation
• @author, @category, @link, @license, @package, @since, @version and
more at http://www.phpdoc.org/docs/latest/index.html
• Consistent Indentation
• Avoid Obvious Comments
• Code Grouping
• Consistent Naming Scheme
• Avoid Deep Nesting
5. Tips
• Limit Line Length
• File and Folder Organization
• Capitalize SQL Special Words
• Use revision control for your code
• Write good and detailed commit messages
6. Tips
• Know your editor
• Automate all repetitive tasks (DRY Principle)
• Refactor every so often
• Allow time for learning
• Watch talks and presentations
• Read Open Source Code