About the Author

Chris Shiflett

Hi, I’m Chris: entrepreneur, community leader, husband, and father. I live and work in Boulder, CO.

PHP Advent Calendar Day 10

Today's entry is provided by Chris Cornutt.

Chris Cornutt

Chris Cornutt
Chris Cornutt is the senior editor of PHPDeveloper.org, a popular PHP news site, as well as a lead PHP developer at a Texas natural gas distributor.
Dallas, Texas

You're hacking your way through yet another project and you hit that point. You know the one; you've been going and going, churning out code like the end of the Internet is coming tomorrow, and you sit back after finishing off a long haul and are hit by something. You look at where your code is now, and reviewing how you thought of it about five hours ago, you realize there's no next step. You know you need to keep going, but you're just not sure where. If you take the wrong step, you could end up with a big bowl of spaghetti, not the elegant application you're going for.

This is prime example of bad planning practices. Many developers forget to take this all-important step before they lay their fingers to the keys. They lay out the basic idea in their heads and just start typing, and, unless they're really lucky, they hit a wall somewhere.

I've got a few tips to help:

  • Always plan. Yes, I know it's simple, but even if it's just a rough layout or a tree structure doodled on a cocktail napkin, it's something. A big process isn't required to plan out your application.

  • Have a clear goal in mind. Sit down and hash out what you want your application or web site to do, and write it all down. The less that's left to the imagination, the better. That'll help you get the basic structure down, then you can add the bells and whistles.

  • Know what you have to work with. Nothing sucks more than when you have a great idea and have basically written up the code in your head only to find out that the machine you're working on doesn't have the right version of PHP. Know your base.

  • Don't guess. If you don't know whether a certain method will work for your application, poke around. See if there's anyone else that has done it that way before. There might even be an example of it that you can use as a guide. Guessing can lead to big headaches in the future.

  • Pick your environment carefully. Just because you have a laptop and can work anywhere doesn't mean you should. Any programmer out there knows that they work best in certain situations. Figure out what that is and go with it. I'm not suggesting you crank Metallica at the office (maybe some headphones?), but do find what suits you, even if it's just a keyboard that makes things feel a bit more like home.

  • As tempting as it is, save the pretty part for last. Most developers I know build their applications while dividing their attention between the back end and the front end. This is distracting. Sure, building out an interface is fine, but don't get too wrapped up in it. If you have a designer, rely on them. If not, finish the programming as much as possible first, then come back to the look and feel later. You are keeping the interface and business logic separate, right?

  • Distractions are the devil. Most programmers I know aren't too fond of distractions, so they try to avoid them at all costs. I know how much it pains some of you out there (it hurts me, too), but turn off the email client, shut down the instant messenger, switch off the phone (if you can get away with it), and focus on coding. Not only will this help with productivity, but you can also use the same tricks when you're planning out your application. Less distractions == more focus == better structure.

I got a little wordier than I probably should have, but hopefully something in this list can be added to your practices. Best of luck to you in 2008 and remember, you can always start planning now for tomorrow's code!

About this post

PHP Advent Calendar Day 10 was posted on Mon, 10 Dec 2007. If you liked it, follow me on Twitter or share:


1.Chris Shiflett said:

I would let Chris know that his entry has been posted, but he's not on IM. :-)

Mon, 10 Dec 2007 at 22:53:27 GMT Link

2.Chris Cornutt said:

Woo! Thanks for posting it! :)

Tue, 11 Dec 2007 at 13:14:57 GMT Link

3.Ken Guest said:

Thanks Chris - most of these I knew already but there are some good gems here ;-)

Tue, 11 Dec 2007 at 20:57:00 GMT Link

4.Cal Evans said:


Great post!


Wed, 12 Dec 2007 at 03:51:27 GMT Link

5.derby said:

I agree with your distractions wholeheartedly. I noticed when I turn off my email client and IM, how much more focused I am while developing.

Thanks for the Article.

Tue, 16 Dec 2008 at 02:01:02 GMT Link

Hello! What’s your name?

Want to comment? Please connect with Twitter to join the discussion.