The second problem with blogging about technology is putting my code on the page in a fashion that does not cause the readers' eyes to bleed. I know that most of the time you skip right over the code sections. I do too. But there are some blogs with code samples that look like they jumped right off a tab in your favorite IDE. Since I get the most out of those, that's what I intend to do.
The first problem with blogging of course is where to put the blog, but my decisions about that are obvious without writing anything extra. You're probably thinking that it would be content that would be a problem of some sort. I used to think that too. If you make it to the point of actually typing into the blog editor, it is likely that content is spewing out of you and you just need a place to put it. It's often safer to toss it out on the Internet, like hurling garbage out into space. From what I see through my rss feed reading view of the world, I am not the only one with frustrations and strong opinions when it comes to technology. Hopefully that's not going to be what this blog is about, but I think that it has to be there or you never even get started.
Even though I write software for a living, and have for quite a while, I only know a handful of people who actually love writing software. It seems lots of developers are day laborers at a keyboard rather than a craftsman who considers his skill part of his identity. My point is that it is time to reach out and surround myself with more people I can identify with, and the blog is one way of doing that.
I also hope to offer my experiences, especially with the stuff that is misunderstood by the typical large waterfall mindset company. To start I'll share what I learned about sticking code in a blog. I plan to show just enough Java and Ruby in this blog to get my point across. Hopefully more Ruby because Java is such an awkward language that doing anything takes hundreds of lines of code (plus some XML).
It turns out that there are tons of ways to turn your code into HTML, and I spent way too much time trying several out. I'm only going to point out the ones that I actually use. The best solution I found for displaying Java code was this little conversion webpage. Very simple and quick to use. My favorite converter for Ruby is CodeRay. It doesn't do Java yet or I would do that with it too. CodeRay handles line numbers and horizontal scrolling well. It's also open source Ruby. It takes a little more work to get it working for you, but it's worth it. Netbeans also has a "Print to HTML" action. Convenient, but I didn't like the output as well.
Update! The last paragraph is deprecated. Gist is a perfect solution and I've updated all the code snippets.
Java and Ruby respectively:
The only thing ugly now is the Java code compared to Ruby. Notice they both do the same thing.
Monday, September 3, 2007
Subscribe to:
Post Comments (Atom)
3 comments:
Hey Dude,
Nice looking pages...
Mark
I think that the comparable Java would be:
for(String s : new String[]{"a","b","c"}) {
System.out.println(s);
}
Post a Comment