Perpetually In Beta.

Best Blogging Options for Programmers / Source Code Formatting

with 9 comments

Hello! (in french)

Hello! (in french)

I think everyone that starts blogging inevitiably writes things like, "This is my first blog, um, i don't know what to say, um, oh this is awkward isn't it.  Hello world!"  But, unlike everyone, I do actually have something (somewhat interesting) to say.  Which is strange, but nice I suppose.

The idea for this post started when I was reading a post on Stackoverflow, the new joint venture between Joel Spolsky and Jeff Atwood, entitled 'How you can tell you are ready to start your own blog?'

The post went as follows:

Hi, I'm curious whether I should start my own blog or not.

I've been working as a programmer for 3 years and have some good and bad experience I can share. On the other hand I'm not sure I will be able to post very often (maybe even less then one time per week).

They say writing a blog will improve your writing skill and it seems appealing to me. I've to admit sometimes I've a problem to write down my ideas in a short clear way so people can understand them easily. But I don't want to write for the sake of writing. I think that blog helps me only if there will be some readers and therefore some comments. In order to have readers I've to put some interesting stuff there pretty regularly, haven't I?

So how can you tell when it's time for one to start blogging?

The replies are now legendary.  Besides improving your writing skills, the reasons to start a blog as a programmer are quite numerous.

Why You Should Blog As a Programmer

The mere act of writing your thoughts and actions down is a form of teaching.  Blogging cements the knowledge you have acquired in your brain 8.9 times better then just mere-programming or even verbally explaining something to someone.

Steve Yegge writes in 'You Should Write Blogs',

"…that blogging is a source of both innovation and clarity. I have many of my best ideas and insights while blogging. Struggling to express things that you're thinking or feeling helps you understand them better."

Jeff Atwood talks about in his podcast how he doesn't feel like he has actually done any work at all if he hasn't documented it and put it in the public sphere.  Being so exposed, he knows he is accountable to the thousands of people who read his blog.  This, in turn, causes him to produce better quality work (he hopes).

When blogging as a programmer, you are creating a documented public portfolio of what you are working on, a resume that is more then a few lackluster pages in Word with various haphazard skills and, in my case, a not so long job history as well as a reference for your future projects.

But better then that, simply the act of blogging can lead to success and fame.  In how to achieve blog success in one easy step, Jeff Atwood writes about his success from blogging,

I won't say I got my job here at Vertigo back in 2005 because of this blog, but it was definitely a factor. I was interviewed on .NET rocks, and I've been interviewed online not once but twice. I've been invited to speak at conferences. I am approached for book deals every few months. I exchange email regularly with Steve McConnell, one of my programming idols as a young adult, and he once asked me for advice on blogging. Joel Spolsky actually recognized me and invited conversation when I attended the Emeryville leg of his world tour. Charles Petzold sent me, completely unprompted, a signed copy of his latest book. People offer to send me incredibly cool free swag on a regular basis.

Jeff goes on to say that he thinks that blogging is "the most important thing I've ever done in my entire career."  Wow.

So, inspired to the teeth by reading all of the above, I set out to start my own blog.  I went to google, clicked "create blog" at Blogger, clicked "Write New Entry," and started working on a piece about, i don't know,  the Template Pattern in Ruby or something.  I pasted some code into my blog, moved my mouse up to the formatting options and stopped dead in my tracks.

There was no Code Formatting option!

Shame shame know your name Google.  How can you write a programming blog without code formatting options?  (Answer: Black Bear).  I realized this was a question for the hive mind so I asked the good folks at Stackoverflow what is the best blogging host for programmers/code formatting?  The results were wide and varied.

Blogging Options

Most people seemed to agree that Wordpress was the best overall blogging platform in terms of options and flexibility.  These same people stated that one is better off self-hosting wordpress or using a hosting provider and getting a domain name rather then using the hosted wordpress (Wordpress.org vs. Wordpress.com).  Self-hosting has a couple of main advantages as stated by Christain:

  • You will be the master of your domain name: when you want to change hosting company or software, you will be able to do so. You don't want to change your domain name when you have thousands of readers and a Google PageRank of 5.
  • You will be able to customize your software (with little effort) to add the many plugins available.

I decided to go with Wordpress and bought a one year webhosting package from DreamHost (recommended by wordpress) for a little under $100 for like a bagillion gigs of space and bandwith.  Plus, setting up wordpress on Dreamhost was insanely easy.  They have a one-click installer.  It took 2 minutes.  They also have a one-click installer for Subversion which i found cool.  You are now viewing the results.

Code Formatting Options

1.  If using wordpress, the WP-Syntax plugin provides clean syntax highlighting using GeSHi — supporting a wide range of popular languages. It supports highlighting with or without line numbers and maintains formatting while copying snippets of code from the browser.

Below is an example of GeSHi formatted code in Ruby using the wordpress plugin,

class Report
  def initialize
    @title = 'Monthly Report'
    @text = ['Things are going', 'really, really well.']
  end
 
  def output_body
    @text.each do |line|
      output_line(line)
    end
  end

Geshi isn't limited to wordpress, but can be used to "highlight code on ASP pages, numerous blogs, wikis and forums."

2.  Use Windows Live Writer with the Insert Code plugin. The problem with this option is that you are limited to blogging on a Windows (sic) Machine, and it only formats the the following languages:  C#, HTML, MSH, JavaScript, Visual Basic and TSQL.

3.  SyntaxHighlighter is a Javascript based Code Formatting mechanism that can easily integrate into most blogging systems.  It supports the following languages: C++, C#, CSS, Delphi, Java, JavaScript, PHP, Python, Ruby, Sql, VB, XML/HTML.  Ellis Web posted a great article on Using Syntax Highlighter to Format Code in Wordpress.

4.  If using the blogging engine Chyrp, Geshify or Feather can be used for Code Formatting.

5.  Mango Blog and BlogCFC both support code blocks out of the box.

6.  CodeHTMLer is a simple program that translates plain text code into a colorized HTML version of the code.

7.  If you use TextMate in Mac OSX, BitButter has a great post on how to display your TextMate code (formatting included) in WordPress.

Share:
  • Digg
  • Reddit
  • del.icio.us
  • Facebook
  • TwitThis

9 Responses to 'Best Blogging Options for Programmers / Source Code Formatting'

Subscribe to comments with RSS or TrackBack to 'Best Blogging Options for Programmers / Source Code Formatting'.

  1. Good luck with your new blog.

    Based on your query on sof, I just wrote a blog post about implementing SyntaxHighlighter on a WordPress blog.

    Yaakov Ellis

    14 Aug 08 at 7:42 am

  2. Wow, your post was great. Thanks for visiting the site!

  3. Sure. On a different subject, I like the template that you chose. However, right now it doesn't display the comments on the single post page, unless you find the tiny link to comments located at the top of the page. I think that keeping it this way greatly reduces the visibility of the comments, and makes it less likely that people will read or contribute to them.

    So I think that it might be a good idea to change the Single.php template so that it always lays out the comments and comment form, beneath the article.

    Yaakov Ellis

    14 Aug 08 at 10:20 am

  4. Yeah, you are absolutely right. I'll try to modify the template accordingly. At least with a link to the comments at the bottom of the post. All this web programming business is new to me — I also liked the option on your blog where you can be emailed if someone else replies to a comment. How did you implement that functionality?

  5. I used the Subscribe to Comments plugin.

    Yaakov Ellis

    15 Aug 08 at 9:50 am

  6. Thanks for this, code formatting is something which will give a professional look to the site.

    Prasanna S

    11 Sep 08 at 7:08 pm

  7. Thanks for stopping by Prasanna!

  8. Nice blog, keep it going. Seems like we have lots of topics in common (serial port programming, embedded device interfacing, etc.)

    Eli

    27 Sep 08 at 12:17 pm

  9. [...] read “Best Blogging Options for Programmers / Source Code Formatting” and some other posts and decided to give it a try. I really liked the huge adoption and plethora [...]

Leave a Reply