[wp-hackers] Different background colors for different code blocks to help keep organized code

Jeremy Clarke jer at simianuprising.com
Tue Dec 3 15:32:13 UTC 2013


One thing to keep in mind is that IDEs like PHPStorm/NetBeans/Aptana are
all super-powerful, but it's very easy to fail to take advantage of that
power. They've all got hundreds of features, some of which you need to
ignore (to maintain your sanity) and others that you need to seek out to
take advantage of.

In terms of your original question I think you're probably on the wrong
track looking for "highlighting" of code blocks. Instead you should make
sure that you're making full use of the following features in whatever IDE
you choose:

   - "Go to declaration" which will let you select a function/method and
   jump to it's definition.
   - "Find usages" which will search out all uses of a
   function/method/variable.
   - "Code folding" which will let you collapse sections of a document so
   that the parts you're working on are closer together. (NetBeans and
   probably others also have a "Collapse All/Expand All" feature that folds
   the entire document, a great way to get a bird's-eye view of your code.

FWIW making your code easy to navigate isn't just about tools, sometimes
you also need to re-organize your code to make it easier to work with. If
most of your code is contained in monolithic functions that handle input,
query the DB and output HTML then the "Go to declaration" feature of an IDE
will still take you to an unmanageable mess. Having your program logic
broken up into small, focused bits of code will make it easier to find what
you need whether you're using the scroll wheel, a basic search tool or a
full suite of IDE tools.

I did a WordCamp talk about using IDEs (NetBeans as example) a couple years
ago, might be worth checking out:

http://www.youtube.com/watch?v=6sWllWP3NKM


P.S. On choosing an IDE: I've used NetBeans for a long time and find it
extremely useful, but it's been buggier than usual lately, especially the
latest release (7.4). Performance-wise it's been shockingly up-and-down
over the years, usually bouncing back from the points where it got really
laggy. That said I usually have it running on a fairly-powerful MacBook, so
if you've got a budget rig you'll probably have a different experience.
PHPStorm seems like the obvious choice as a commercial alternative, I would
switch if I wasn't so comfortable with my NetBeans setup.

-- 
Jeremy Clarke • jeremyclarke.org
Code and Design • globalvoicesonline.org


More information about the wp-hackers mailing list