ls as Hello World

From the Go Time Podcast, it was discussed when you should write a CLI (command line interface) app in a full featured language instead of writing a shell script. The proposal of one of the casters was to rewrite common tools in the language you are trying to learn. I completely agree with this statement and will expand on why I think this should be the default method instead of how we have been do it for the last 50 years.

The traditional first app when encountering a new language is "Hello World". This application displays a message, typically the letters "Hello World". Very simple goals makes the exploration of a new space much more likely to be successful. Having such a simple first application give the explorer a victory of this new land in just a couple of minutes usually, but that victory is typically very short lived. Because this has been the first activity in a language for so long, languages have optimized the "Hello World" experience. Even languages that take a great deal of education to become truly proficient, such as Erlang, have a very straight forward "Hello World" experience. In short "Hello World" did not teach you anything about the new lands you are so eager to visit.

When I proposed this to some of my friends they brought up that at a minimum "Hello World" at least gives you the experience of setting up a development environment. At first I acquiesced, but recently I have been reminiscing with my son while working on his college essays. I remember his first foray away from JavaScript and into languages that needed compilers, and how difficult he found setting up an environment to do C++, and to a lesser extend rust. For C++ he was able to create his first program in minutes after downloading and installing the GCC compiler, but soon discovered to be effective a simple text editor and calling the compiler on the command line was not efficient. "Hello World" had given him a false sense of confidence that was quickly replaced with frustration.

If instead of writing "Hello World" your introduction would have been a tool like ls (directory listing, the name is short for list). The basics of ls are simple enough that you can call the compiler directly on the command line, thus saving the pain of needing to learn a build system, but you would have been able to benefit from a editor that understands the language. You would have also learned a significant number of the basic libraries that are used in the language, to format text (something that is significantly different in most languages), how to handle user input, and a multitude of other useful skills that he can take with him to the next program he decides to write.

By picking an existing application that you use frequently it gives you a set of requirements because you can compare your results with that of the tool you are re-implementing. If you are writing the tool in a language that the original was not written in, and it works better than the original you can petition to move to your new and improved tool. Most importantly, you don't have to implement all the features of the tool, you can implement the ones that interest you or you work with the most and leave anything you aren't interested in exploring behind, or on your TODO list for another day.

By writing a practical tool that has a good reference implementation in a language that is designed for that type of action, you will get all the benefits of a high quality map, while you explore the wonders of the world learning a new language brings you.