Daniel Bachhuber: The Zen of WordPress Development

Daniel Bachhuber of Automattic’s WordPress.com VIP team, gave this awesome talk at WordCamp Phoenix 2012 earlier this year. He walked through some things developers are overlooking when working with WordPress, and some great tips and tricks to speed up your development workflow.

One thing I learned from that talk is that I should stop using Textmate’s “search in project” and use ack instead, which is faster, available in the command line environment (no need for GUI), and has a bunch of options for output customization. By the way, here’s how you install ack on OS X:

  • Download and install MacPorts if you haven’t already.
  • Open your Terminal and type sudo port install p5-app-ack

You can find the notes and slides to the presentation on Daniel’s blog, and by the way, it was originally called “Five tenets to mastering WordPress development” :)

Hope you enjoy the video and feel free to share your thoughts in the comments section below.

About the author

Konstantin Kovshenin

WordPress Core Contributor, ex-Automattician, public speaker and consultant, enjoying life in Moscow. I blog about tech, WordPress and DevOps.

11 comments

    • Zane, maybe you can share some more grep tips? @Soulseekah’s quick test revealed ack is much faster :)

    • Honestly,

      I’ve been using sublime text2 and liking that so far, thus I’m not working in vi,emacs,nano,etc (but I do have a custom nanorc file :).

      for example, this line:

      ack --before-context=10 --ignore-dir=wp-admin 'function esc_'
      

      Would be this in grep:

      grep -ron "function esc_'" . |grep -v .git/ |sort
      r = recursive
      o = oppress output
      n = show line number
      v = not
      

      I’m not sure what before-context does, if its doing what I think it is you could pipe what I have above to head or tail like head -n 10 that would be the first 10 lines of the file.

      Example output would be:

      ./my-function.php:16:function esc_
      

      I’ll admit, grep does look more archaic.

      I’ved used ack/sed a few years back when we would do stuff like global find/replace on servers (obviously we did a dry run and had backups).

      I’d like to hear what you mean by “faster”?

  • Zane, the --before-context flag in ack is the same as the --before-context flag in grep or -B for short, they do the same thing. My quick tests reveal that simple plain searches are faster by around 4 times. I’ll do more tests on ack vs. grep next week, since I’ve only been using it for the last couple of days and haven’t been able to fully assess it yet.

  • wow…someone in the audience asked him what he means by “command line”?

    Might I be so bold to assume he was way over some people’s heads at this event? lol

    Great presentation btw…I’ve learned a ton and have learned that I’m either doing it right, or not doing it at all.

    Local dev environment, check.

    Using ack, no check.

    But havent found anything that Im doing very wrong, so thats good news :-)

    • Hey Dino, yeah, apparently not everybody’s a tech geek, but that’s fine at a conference like WordCamp. It’s for publishers, bloggers, designers and content managers too, not only developers :)

  • Please note that there is a version of ack available for TextMate called AckMate.

    https://github.com/protocool/AckMate

    The part of ack that is fastest over grep is that ack command lines are faster to type than grep.

    The –before-context argument can be shortened to -B. The –after-context argument is -A. If you want both, it’s -C.

    The ack-users mailing list is very helpful for people just getting into ack. http://groups.google.com/group/ack-users

    • Wow, thanks so much for the tips Andy! And thank you for stopping by to comment :)

  • […] vs. grepFollowing Daniel Bachhuber – The Zen of WordPress Development talk, I’ve started to explore this magical ack tool, a replacement for the native […]