Why You're A Bad PHP Programmer

839 views

Published on

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
839
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
25
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Why You're A Bad PHP Programmer

  1. 1. Why You’re a Bad PHP Programmer Presented by: Aubrey
  2. 2. You Don’t Plan Before You Start Coding “Before you write a single line of code, you should have a solid plan of attack.” ➔  Write an outline in comments first ➔  Plan out an entire application using this.. ➔  If there comes a feature that requires a functionality tweak, just change the comment
  3. 3. You Don’t Comment Anything “Five seconds at a time will add up in a big way.” ➔  The single worst problem with most code is that it’s poorly commented or not commented at all Code without comment Code with comment
  4. 4. You Sacrifice Clarity for Brevity “Good examples of sacrificing clarity for brevity include unclear variable names and dropping the curly braces.” ➔  Example of sacrificing clarity for brevity include short, unclear variable names (such as $a) and dropping the curly braces
  5. 5. You Sacrifice Clarity for Brevity ➔  Adding curly braces adds a few lines, but it clarifies the statement immensely
  6. 6. You Don’t Follow a Coding Standard “Choose a standard and stick to it.” ➔  Choose a standard (e.g. PSR - 1, PSR - 2) and stick to it ➔  When it comes to programming, think of it like a spoken language. Grammar and punctuation exist for a reason: so we can clearly understand each other when we write things down ➔  Following a standard means people understand what you’re trying to say
  7. 7. You Duplicate Code “You're doing it wrong.” ➔  Look at every single piece of your app as something that will need to change at some point ➔  If you have to update more than one file, it’s time to re evaluate how you write code Don’t Repeat Yourself (DRY) -- "Every piece of knowledge must have a single, unambiguous, authoritative representation within a system."
  8. 8. You Don’t Follow a Development Pattern “You should always have a structure when you code.” ➔  You should know how to classify components and where they should go ➔  By following a logical development pattern, many decisions become automatic, and someone coming to your code doesn’t have to guess much when looking for a certain functionality in your codebase
  9. 9. You are Too Clever for Your Own Good “The simplest solution is usually the most appropriate” ➔  Resist the urge to force a complex solution into a space where a simple one is sufficient ➔  Avoid overcomplicating things ➔  Don’t think your way is better just because it’s your way
  10. 10. You’re a Wang “Avoid actively making your code hard to understand at all costs.”
  11. 11. You’re a Wang “Avoid actively making your code hard to understand at all costs.”
  12. 12. Dude, What are you Talking About? “If you stop learning, then the projects you work on are stuck in whatever time period you decided to settle.” ➔  You lack continued learning and forward progress Technology isn’t changing because the community at a large is bored and we decide to redecorate; most new technologies emerge to more efficiently and easily solve existing problems.
  13. 13. You’re Trying to Do it All Yourself “Find out which of these programmers have a similar approach and let them fill you in on the big news.” ➔  Take time to find out a programmer that has a similar approach and style
  14. 14. You’re Not Out of Your Comfort Zone “I simply mean to suggest that you'll feel more fulfilled as a programmer and see your talents progress more and more if you choose to always be looking to the next level of programming.” ➔  Find new challenges within projects ➔  Try not to settle in and convince yourself you’ve learned everything you’re going to learn ➔  Try out a new concept that you’re not quite comfortable with
  15. 15. You’re Not Sharing “Always discuss your code with your fellow programmers.” ➔  Write a tutorial or release an open-source project ➔  Hangout on a community forum and offer help to the newcomers e.g. StackOverflow.com Usually, if you post a solution that could be optimized, other experienced programmers are going to hop in and offer tweaks.
  16. 16. You Don’t Have Any Side Projects ➔  Start a new project that uses the technique you’ve learned
  17. 17. Questions?
  18. 18. Source ➔  http://code.tutsplus.com/tutorials/why-youre-a-bad-php- programmer--net-18384

×