Download - Why You're A Bad PHP Programmer
![Page 1: Why You're A Bad PHP Programmer](https://reader035.vdocuments.net/reader035/viewer/2022081907/546fd636b4af9ffa638b4635/html5/thumbnails/1.jpg)
Why You’re a Bad PHP Programmer
Presented by: Aubrey
![Page 2: Why You're A Bad PHP Programmer](https://reader035.vdocuments.net/reader035/viewer/2022081907/546fd636b4af9ffa638b4635/html5/thumbnails/2.jpg)
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
![Page 3: Why You're A Bad PHP Programmer](https://reader035.vdocuments.net/reader035/viewer/2022081907/546fd636b4af9ffa638b4635/html5/thumbnails/3.jpg)
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
![Page 4: Why You're A Bad PHP Programmer](https://reader035.vdocuments.net/reader035/viewer/2022081907/546fd636b4af9ffa638b4635/html5/thumbnails/4.jpg)
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
![Page 5: Why You're A Bad PHP Programmer](https://reader035.vdocuments.net/reader035/viewer/2022081907/546fd636b4af9ffa638b4635/html5/thumbnails/5.jpg)
You Sacrifice Clarity for Brevity
➔ Adding curly braces adds a few lines,
but it clarifies the statement
immensely
![Page 6: Why You're A Bad PHP Programmer](https://reader035.vdocuments.net/reader035/viewer/2022081907/546fd636b4af9ffa638b4635/html5/thumbnails/6.jpg)
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
![Page 7: Why You're A Bad PHP Programmer](https://reader035.vdocuments.net/reader035/viewer/2022081907/546fd636b4af9ffa638b4635/html5/thumbnails/7.jpg)
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."
![Page 8: Why You're A Bad PHP Programmer](https://reader035.vdocuments.net/reader035/viewer/2022081907/546fd636b4af9ffa638b4635/html5/thumbnails/8.jpg)
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
![Page 9: Why You're A Bad PHP Programmer](https://reader035.vdocuments.net/reader035/viewer/2022081907/546fd636b4af9ffa638b4635/html5/thumbnails/9.jpg)
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
![Page 10: Why You're A Bad PHP Programmer](https://reader035.vdocuments.net/reader035/viewer/2022081907/546fd636b4af9ffa638b4635/html5/thumbnails/10.jpg)
You’re a Wang
“Avoid actively making your code hard to understand at all costs.”
![Page 11: Why You're A Bad PHP Programmer](https://reader035.vdocuments.net/reader035/viewer/2022081907/546fd636b4af9ffa638b4635/html5/thumbnails/11.jpg)
You’re a Wang
“Avoid actively making your code hard to understand at all costs.”
![Page 12: Why You're A Bad PHP Programmer](https://reader035.vdocuments.net/reader035/viewer/2022081907/546fd636b4af9ffa638b4635/html5/thumbnails/12.jpg)
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.
![Page 13: Why You're A Bad PHP Programmer](https://reader035.vdocuments.net/reader035/viewer/2022081907/546fd636b4af9ffa638b4635/html5/thumbnails/13.jpg)
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
![Page 14: Why You're A Bad PHP Programmer](https://reader035.vdocuments.net/reader035/viewer/2022081907/546fd636b4af9ffa638b4635/html5/thumbnails/14.jpg)
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
![Page 15: Why You're A Bad PHP Programmer](https://reader035.vdocuments.net/reader035/viewer/2022081907/546fd636b4af9ffa638b4635/html5/thumbnails/15.jpg)
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.
![Page 16: Why You're A Bad PHP Programmer](https://reader035.vdocuments.net/reader035/viewer/2022081907/546fd636b4af9ffa638b4635/html5/thumbnails/16.jpg)
You Don’t Have Any Side Projects
➔ Start a new project that uses the technique you’ve learned
![Page 17: Why You're A Bad PHP Programmer](https://reader035.vdocuments.net/reader035/viewer/2022081907/546fd636b4af9ffa638b4635/html5/thumbnails/17.jpg)
Questions?
![Page 18: Why You're A Bad PHP Programmer](https://reader035.vdocuments.net/reader035/viewer/2022081907/546fd636b4af9ffa638b4635/html5/thumbnails/18.jpg)
Source
➔ http://code.tutsplus.com/tutorials/why-youre-a-bad-php-programmer--net-18384