Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

10 Intermediate and Advanced Tips from PHP Masters




PHP Elephpant
Not long ago, we offered you 10 tips for PHP beginners from a panel of certifiable PHP experts. Many of you more experienced PHP devs were kind enough to chime in with tips of your own in the comments.
Well, if you happen to be one of those more seasoned PHP developers, this post is for you. Our expert panel has returned to offer helpful hints and suggestions for those of you who have long since passed the “beginner” milestone and are on your way to becoming true masters of the art and science of PHP.
Feel free to ask questions and leave your own suggestions in the comments — the lovely people we interviewed in this post are quite likely to pop in and reply to you directly.

1. Elizabeth Naramore: Stay Current



Naramore is a SourceForge employee and founded PHPWomen.org. She reminds us all that we’re never done learning.
“Keeping up to date on what’s going on in the PHP world can really help you be a better developer,” she said.
“If you stay in your comfort zone, coding the same way you always have, and don’t keep up with newest releases, changes, and other pertinent news, you are doing a disservice to yourself and your employer. Also, taking time to play with and explore new ways of doing things can help improve your skills. Listen to podcasts, keep up with blogs, take time to learn new skills and experiment.”
And of course, open source isn’t just good for beginners looking to get their feet wet. Naramore notes, “Taking time to contribute to an open source project not only helps you hone your own skills, it helps you help others, and allows you to give back to the community.”

2. Keith Casey: Interact With Others’ Code



Casey founded a software shop and does a lot of work in the unconference circuit. For more seasoned PHP developers, he recommends a rather social program of getting your hands dirty with other developers’ code.
“Explore other projects. It’s a great way to find new ideas and approaches to problems. And sometimes you may be able to submit bug reports or patches. Participate in — and eventually lead — code reviews. It’s humbling to have your code criticized in a group, but it’s powerful and educational to see others’ strategies.”
Casey also backs up Naramore’s advice to keep educating yourself. “Find something you don’t know and learn it,” he said. “Exploring the ins and outs of a supporting tool or related concepts, regardless of the language, will give you new ideas to apply. Or it may help you notice your own bad ideas sooner. Either way, you win.”

3. Eamon Leonard: Give Back



Leonard runs Ireland-based software company echolibre and co-founded CloudSplit, a real-time analytics service for cloud computing. His advice to intermediate and advanced PHP devs is all about community.
“I think if you’re intermediate or advanced, you’ve probably benefited from the experience of others, be it from reading development blogs, going to conferences, etc. I think when you get to the intermediate/advanced stage as a PHP developer, you have a duty to give something back to the community.
“This can be as simple as writing a blog post on how to solve a particular problem, or may be running a workshop at an unconference. This can help an intermediate or advanced developer in many ways, most notably by extending their circle of developer contacts, improving their own development style by conversing with other developers, and perhaps even finding a leadership-type role in the community.”

4. Lorna Jane Mitchell: Ask Questions



“Lornajane,” as Mitchell is more commonly known online, is a PHP consultant, developer, writer and speaker. She advocates a Curious George/Georgia approach to continuing development of your PHP skills.
“Never be afraid to ask questions. There are mailing lists, forums and IRC channels — plus, of course, the real-life user groups — and if you have already looked for an answer and you understand what question to ask, people will always jump in and make suggestions.
“This is how I’ve always kept learning in the years I’ve been using PHP.”

5. Chris Cornutt: Help the Noobs



Cornutt runs PHPDeveloper.org and Joind.in and has been using PHP since 1998.
Of intermediate developers, he says, “These are the folks that have made it past their second or third PHP application and know their way around the language. They’re the ones that should be looking at the beginners and helping them with some of their first steps. The mid-range folks remember more clearly what it was like when they hacked away at a script for hours just to get a basic CRUD interface working.”
“Since it’s the most fresh on their minds, they’re the best to help,” he adds. “As an added bonus, they’ll learn a few things in the process. There’s no other one developer that has the same experience as you, so help them out and keep an open mind.”
He also reminds intermediate and advanced PHP developers that now that they have some legitimate skills under their belts, there’s no excuse for lazy hacks or code Band-Aids. “That’s the lazy developer in them coming out… You’ve come a long way in your development and know how things work (maybe even the PHP internals!), and you should spend the time to really get into a problem and fix it.”
Along with the so-obvious-yet-no-one-does-it-well tip, “Document your code,” Cornutt also tells advanced devs, “There’s another tip I’d highly recommend that can only help you in the long run: unit testing. There are great tools for it in PHP (like PHPUnit and SimpleTest) and it can really make a difference in the stability of your application.”

6. Abraham Williams: Keep It Simple



Williams is a developer and self-styled “hacker advocate.” He tells PHP devs to keep things simple and focus on incremental improvements in a code base rather than reinventing the wheel.
“Don’t try to over engineer. Clean, modular code is important, but it is easy to try too hard and try to abstract too much. For me it works better just to get the code down and progressively make small improvements. Maintain lots of tests.”
He also echoes the sentiments of his peers, saying, “Most importantly be active in your local and digital community.”

7. Demian Turner: Use Better Tools



Turner has been working with web and open source projects since 1996. He runsPHPKitchen.com and was a recent Seedcamp finalist.
For developers who are moving out of the “beginners” level, he recommends using better IDEs, unit tests and static analysis tools to become a better coder.
“Don’t be afraid of using an interactive debugger, available in decent IDEs like PHPstorm and also Netbeans and Eclipse if you have the patience — this is the best way to understand what the code is doing.
“Don’t be afraid of unit tests — not only will you have an easier time maintaining your code base, but often unit tests are the best form of documentation for a codebase and will allow new devs to get up to speed fast. Use some of the available static analysis and IDE tools to help you refactor your code — good code is not subjective!”

8. Stuart Herbert: Maintain Your Code



Herbert has been coding PHP since 1999. He’s also been writing about PHP for several years and has contributed greatly to Gentoo Linux.
One of the tips he says helped him along his way to becoming an expert PHP coder is: “Maintain your own code so that you can learn from your mistakes. Refactor early, refactor often.”
He also agrees with Cornutt that teaching others is a good idea, and he concludes his advice with an admonishment to make sure you follow standards and get up to speed on source control.

9. Maggie Nelson: Monitor Your Code



Nelson is a PHP developer currently employed by Flickr. She recommends a few good tools for code monitoring.
“Use FireBugFirePHP and YSlow add-ons for Firefox. These will help you judge your web app’s front-end and back-end performance.
“Profile your code. Try some in-depth tracking of what your PHP is doing. If you don’t understand something, read documentation and talk to other developers, but don’t leave any questions unanswered. The more you know, well, then the more you know. TryXdebug for starters.”
She also reminds devs to keep an eye on error reports. “Look at your application logs and strive for clean logs. PHP has many levels of error reporting — use them accordingly. Take advantage of what your application tells you, and fix problems as you see them. A clean log means less hairy debugging under emergency conditions.”
Finally, she notes that although you might be happily settling into life as a PHP dev, there’s more to web development than PHP.
“Don’t ignore other languages only because you love PHP. PHP is simply one of the tools for building applications. Try other languages, different data storage options, even a new code editor once in a while. As new needs emerge, new technologies will grow. Be familiar with them.
“Sometimes PHP will be the best tool for the job, but sometimes it won’t be. Learn to recognize the difference.”

10. Michael Maclean: Work With Others



Maclean is a PHP and Python developer based in the Outer Hebrides in Scotland. His advice lines up with what Naramore and Casey advised.
“Don’t work in isolation. Go and have a look at what other people are doing. Read blogs, Twitter, go on IRC, whatever. If there are conferences or user groups in your area, go to them and speak to other people. That way, you can keep up with what’s happening and find out what interesting things other people are doing.”
He also says devs should stay curious and maintain a hacker’s state of mind about all the tools they use. “Don’t just use whatever framework you’re working with — go and poke around inside and see how it works. You might learn something on the way.”

10 Beginner Tips from PHP Masters




PHP Elephant
PHP is the language behind some of the most powerful and pervasive web applications around, including the ubiquitous Facebook and the unstoppable WordPress.
Learning a new language can be daunting, so we’ve tapped a few PHP experts for their advice for novice PHP coders (stay tuned for an intermediate/advanced selection of tips, coming up in a couple weeks).
If you’re a new PHP developer (or an old pro), be sure to leave a note in the comments and let us and other readers know what specific steps you’ve taken that’s made learning the language easier for you.

1. Elizabeth Naramore: Start with OOP



Naramore is a SourceForge employee and founded PHPWomen.org. For total beginners, she recommends getting a thorough background in object-oriented programming (OO) before diving straight into PHP.
“If you’re coming from a non-tech industry, take the time to learn solid principles of software development. Things like object-oriented programming, test driven development, version control, debugging, design patterns, etc.
“If you’ve tried and can’t solve your problem, don’t be afraid to ask. The PHP community in general is very helpful and friendly, and there are countless resources for the beginner available online. Entrench yourself in a community, whether it be a local user group, an open source project community, or an IRC channel like #phpc on freenode.”

2. Keith Casey: Google It



Casey founded a software shop and does a lot of work in the unconference circuit.
His advice centers around finding your place in the PHP community and following an increasingly important dictum: Google before you ask.
“Connect with a Users’ Group right now. There are PHP Groups all over the world where smart people gather to chat, explore ideas, and help one another.
“Remember to try a Google search before asking questions. No one likes lazy.”

3. Eamon Leonard: Join Open Source Projects



Leonard runs Ireland-based software company echolibre and co-founded CloudSplit, a real-time analytics service for cloud computing. Like many of his peers, he recommends trying your hand at open-source projects, even as a beginner.
“Get involved in open source as soon as you come to grips with the basics… This gives one access to source code and a chance to learn from industry veterans.
“Finding and documenting reproducible bugs is a time consuming task, and one that would be greatly appreciated by any open source team… When it comes to hiring developers to work with us, we would value someone’s potential contribution to our company a lot more if they have worked on an OSS project.”

4. Lorna Jane Mitchell: Just Do It



“Lornajane,” as Mitchell is more commonly known online, is a PHP consultant, developer, writer and speaker.
She gives a word of advice quite commonly heard in hacking circles: Just do it.
“Jump in! PHP is a really accessible language and fast to develop in. The best way to find out if something can be done that way is to try.
“Anyone can program PHP. The low entry barrier means that there is a lot of bad PHP in the world. But bad PHP that works is useful even if it isn’t pretty. Personally I think that if you can solve your problems with PHP, then you should get on and do it, even if it isn’t perfect.”

5. Chris Cornutt: Avoid Coding Burnout



Cornutt runs PHPDeveloper.org and Joind.in and has been using PHP since 1998. In his advice to baby PHP devs, he cautions against coding fatigue and burnout.
“I think new developers get overwhelmed too easily… Beginners like the language and they hack away with the ‘just make it work’ mentality, but I dare say more than half stop there.
“Try to find a mentor that can guide you through some of these early steps. It makes worlds of difference when you have someone real to talk to. IRC is a good option, but a go-to person is so much better.
“Thankfully, they also have the entire web at their disposal with loads of PHP sites and examples to help them through the tough spots. Some of the examples are good, some not so much, but they’ll come to learn those over time. PHP development, like anything else, is a skill that has to be honed — you can’t just jump into the middle and be an expert overnight.”

6. Abraham Williams: Try Drupal



Williams is a developer and self-styled “hacker advocate.” He, too, advises new PHP coders to jump into a coding project, giving preference to open source work.
”Find a quality project or community (preferably open source oriented) to contribute to. Get to know the code, the people and the customs. Not only will you learn from experienced developers, but the maintainers have a vested interest in quality code and a friendly community. They will be more than willing to recommend code improvements in patches and even how to be a better community member.
“I suggest the Drupal project as a good starting point. It is mature, has a epic community, a great growth rate and lots of jobs for good Drupal developers.”

7. Demian Turner: Study Seasoned Coders



Turner has been working with web and open source projects since 1996. He runs PHPKitchen.com and was a recent Seedcamp finalist.
He gave us a ton of great advice for new PHP developers, advice that can save time, make for better code and help sustain your interest in coding.
“Read the code of seasoned devs; there’s always a better, cleaner way to do things. Don’t reinvent any wheels; you will always have more than enough to program; use reputable libraries whenever you can avoid writing the code yourself.
“Ensure your code is human readable; if you can’t understand it six months later, how will it be for other devs?
“Always try and simplify your interfaces; it’s much more difficult to write simpler code, but consistent refactoring will save you a lot of time and headaches when it comes to maintenance.
“Finally, read up on some of the great programmers and find out how they stayed passionate about the art of programming so many years later.”

8. Stuart Herbert: Know Test-Driven Development, Encapsulation and Source Control



Herbert has been coding PHP since 1999; he’s been writing about PHP for several years and has contributed greatly to Gentoo Linux.
For new PHP devs, he advises, “Learn about test-driven development and encapsulation. Once you get the hang of it, you’ll ship code quicker, and whoever inherits your code will thank you for it.
“Oh, and learn about source control; it’s never optional!”
He also says the language’s biggest strength is “the fantastic documentation available at PHP.net for free. With certain other languages, you need to go out and buy the docs as books, but not with PHP.”

9. Maggie Nelson: Read Up on Data Storage



Nelson is a PHP developer currently employed by Flickr.
She tells PHP newbies to start leanring about data storage early in their careers.
“In many cases, you’ll use PHP for web applications. Compelling web apps tend to be the ones that use data in unexpected ways or in ways that solve everyday problems. If you’re just starting with PHP and this is your first language ever, spend a day or two reading up on data storage and perhaps learn some SQL along the way as well. PHP is known for playing very well with databases. Check out MySQL, other relational databases and venture out to a few NoSQL data storage solutions.
“Write all the code ‘from scratch’ for at least one application. The PHP world offers many great frameworks that can easily abstract away data access, but always be sure that you really understand how the data is actually manipulated behind the scenes!”

10. Michael Maclean: Learn about Security



Maclean is a PHP and Python developer based in the Outer Hebrides in Scotland.
He says, “PHP’s pretty easy to get going with, which is why so many people use it, but I think it’s important to have a look at what people who’ve been using it for a while are doing. Rather than writing everything from scratch, check out a couple of frameworks, which will probably give you a bit of a head start.
“The other thing to do is learn about security. PHP’s got a bit of a bad rep for that in the past, which is a bit of a side-effect of its ease of use. There are many resources online and in print on how to avoid security problems. Check out the books by Chris Shiflett and Ilia Alshanetsky who also have information about that online.”