Developer

“Hello, World!” in the real world

Published February 2nd, 2020

Important: The information in this article is over 12 months old, and may be out of date or no longer relevant.

But hey, you're here anyway, so give it a read see if it still applies to you.

“Hello, World!” means something to most programmers – after all, it is most probably the very first thing you wrote code about. I know that my first year of Uni, very first course for the very first day, “Programming in Java”, the first thing was to write an application that says "Hello, World!", like this:

1class HelloWorld {
2 public static void main(String args[]) {
3 System.out.println("Hello, World!");
4 }
5}
Copied!

Ring any bells?

Maybe I’m setting up a new web server, and want to make sure the public root is working as expected. So I’ll put in a “Hello, World!” HTML file. Maybe learning a new concept, framework or technique – the basics are just that, “Hello, World!”.

The “Hello, World!” wiki page even tells us two useful purposes:

  • Used to introduce programmers to a new language

  • Used as a sanity test to ensure a language is installed correctly (and is running as expected)

Programming in Java – introducing me to a new language. The HTML file – a sanity test.

Two real-world usages. Two valid real-world usages. Great for learning, great for testing. But there does come a time when “Hello, World!” outstays its welcome.

As a developer, every day includes learning – new skills, languages, technologies, techniques, algorithms, patterns – the list goes on, but always learning and evolving with the technologies. Some of these lessons are not actually for a new language or a sanity test, but more of a concept or extension of ideas within an existing ecosystem.

For example, I think back to learning how to build an MVC component for a popular open source content management system. The tutorial starts out well, the usual “Hello, World!” as you would expect. But the tutorial continues for nearly two dozen lessons, extending this “Hello, World!” concept.

Get this, a view called “HelloWorld” in a component called “HelloWorld” – and this framework dictates a specific naming convention, so the tutorial, aimed at beginners, is now tasking me with creating things like “HelloWorldViewHelloWorld”.

While learning, lessons should be straight-forward and simple to follow. But what is “HelloWorld” referring to now?

For the very basics of setting up a MVC component, I’ve got no problem with “Hello, World!” type setups. After all, purpose 1, a new language (well, new technique). Set up the single View, output "Hello, World!", and we've found valid use.

But how does “HelloWorldViewHelloWorld” relate to any real-world solution?

Quite simply: it doesn’t.

In the very first lessons, we learn about the MVC structure, files, locations and names. But as you start to extend, in a component called “HelloWorld”, adding anything else called “HelloWorld” just starts to become confusing and unnecessarily obtuse.

Over the past year, I’ve been upskilling myself on the Laravel framework, and Laracasts – superb Laravel-focused screencasts – have been so valuable, useful and meaningful. Jeffery Way has produced whole courses on getting stuck in to Laravel, starting from the ground up - perfect for beginners. Laracasts has become so valuable to me, and I adore Way’s teaching style, I’ve signed up for a lifetime membership too, it’s that good.

What I find so special about Way’s education style is that lessons are made in the code, in the framework, learning about features and best-practices with real world examples.

To get started, Laravel comes with a splash page, in other words, its own “Hello, World!” page that actually ticks off both purposes 1 and 2 above – learning how to write a basic route to present a view, and ensuring the framework installed and running correctly. So that’s actually really neat. And that’s all we need our “Hello, World!” idea for – anything extra needs a real-world purpose.

After we’ve confirmed Laravel is running, and we’ve been introduced to basic routing, Way takes us in to developing our own app – no longer using a Hello-World-esque approach, but using a real world ideas, including templates, menus, routes, views, models, controllers, testing, relationships, the list goes on – lessons (depending on the Laravel version stream you’re following) can include real-world concepts for the web such as blog posts, comments, users, projects, books and genres (including pivot tables). Sure, these may still be trivial examples, but the skills have active application to real-world problems.

By learning how to use Laravel by building these basic examples, I can see how I can create a list of Books, each owned by a User, and also assign one or more Genres to each Book. We’ve got models, relationships, controllers and views, all explained using ideas and techniques that could be applied to actual software that needs building: Projects, assigned to multiple Users, owned by a Company. Same same but different – but the key is that the lessons learned from Way have given me the skills to apply skills to my own coding. There is no way that you can get “Book” and “Genre” confused (like “HelloWorld” vs “HelloWorld”) as not only do the names mean something in day to day life, but shows a realistic usage and implementation of them in the framework.

Even in the JavaScript world, there’s this awesome todomvc.com which demonstrates how to build the exact same app – a real-world-like To Do app – in a number of JavaScript frameworks: Vue.js, Ember.js, AngularJS, React, jQuery, Vanilla JS or ES6… and even more.

“Hello, World!” definitely has a purpose and a place – but after the very first “Hello, World!” lesson, you’re done – there’s no need to mention those words again. In Java back at Uni, we then started learning about collecting user input, and doing basic maths operations on it. In Laravel, we started building a collection of Books. In Vue.js, we build a To-do app. After we’ve confirmed our code is running – c’mon System.out.println, echo, alert, console.log, whatever – it’s on to learning skills with real world application.

What would you prefer to learn? How a model "HelloWorld" can be related to a number of "HelloWorlds", or how a Book can be related to a number of Genres? What makes more sense in your mind?

Everyone does learn differently – but lessons should also be presented with relatable, meaningful and clear language, concepts and similes, so that what you’re trying to teach can be picked up with greater ease, less confusion and give the student time to grow their skills to get them ready for their real world problem solving. Laracasts does this beautifully, and has given my learning a sense of excitement and purpose, and an eagerness to keep learning. 

You may be interested in...