Posts tagged ‘Hello World’

Hello World Nightmare

Traditionally, when someone is introduced to programming, the first block of code they write is the infamous “Hello World” program. Unless you’re dealing with some esoteric language this program usually consists of just a few or even a single line. There is one popular language out there where, in comparison, Hello World is a monster: Java. If you’re a Java coder you may not see it, especially if Java wasn’t your first language. Try to look at it from the perspective of a first timer:

public class HelloWorld {

	public static void main(String[] args)
	{
		System.out.println("Hello World");
	}
}

In addition to a huge dose of OOP some of the concepts bundled into this small block of code are: visibility and scope, arrays, return types, and data types. How do you explain static to someone who has no concept of an object? I explicitly recall, when taking my first Java course, my professor referring to static as “Voodoo Magic”. Compare this to something like C++:

int main()
{
	cout << "Hello World";
	return 0;
}

Granted the whole << thing might seem a bit strange, but overall this is much easier to explain. Don't even get me started on PHP:

echo ‘Hello World’;

Don't get me wrong. I think Java is a great language for beginners. It's balance between ease of use and structure keeps new comers from punching their monitors while at the same time adhering to a fairly strict set of rules.

Plugin Review: Hello World

This being my first plugin review, it seems fitting that it be a review of a plugin called Hello World. Lets start off with the basics:

Plugin: Hello World Code Generator
Author: Carl Sverre
Website: WordPress Plugin Directory, Home Page
Description: Generates a random hello world code snippet in one of many languages. Just drop the short tag [helloworldsnippet] into a post or page.
Compatibility: The plugin directory claims that it is downward compatible to WP 2.7, but I ran it on 2.5.1 without issue.

This is a plugin that really needs no description. The Hello World Code Generator, generates hello world code. This being the case I’ll get right into the four categories I’ll be judging the plugin on: Usefulness, Usability, User Interface, and Code.

Usefulness

Okay so generating hello world code for display in a post at random isn’t very useful, but this plugin does not claim to be useful. Rating this plugin on its usefulness wouldn’t be too fair when its goal is not to be useful. Considering that it does what it says it does I’m going to say that this category is not applicable.

Usability

This plugin requires no configuration and installation is a matter of dropping the files into your plugin directory. The use of the shortcode makes using this plugin exceedingly simple.

When I first saw this plugin the first thing that popped into my head was that it would be nice to drop it into my header, footer, or sidebar to display a short code snippet. This is not possible for two reasons, however. The first is that the this plugin uses short tags and they will only be parsed in posts or pages. The second is that some of these hello world code snippets consist of many lines; too many to insert into a header. In order to serve this purpose the code snippet probably shouldn’t be any more than three lines.

User Interface

Hello World has two output modes. If you use the [helloworldsnippet] tag it outputs the code without formatting. This is perfect if you intend to use it in combination with a syntax highlighter. If you use the [helloworldsnippet_pre] tag the code is wrapped in <pre> tags before outputting, which is perfect if you don’t have or don’t want to use a syntax highlighter.

Code

The code is pretty much what I would expect from a plugin this simple. Its clean and well written. One thing that I was happy to see was that this plugin cleans up after itself. On uninstallation the table it created in the database is dropped, which is exactly what you should expect when uninstalling a plugin.

To Summerize…

Hello World does exactly what it says it does more or less as well as anyone can expect. The only things I can think of to improve upon would be to use filters instead of (or in addition to) short tags and to have an output mode for only short code snippets.