Whoa there. Harsh title?
Perhaps. War is such a strong word. However, through experience, I have reached the conclusion that this teaching approach cannot be tolerated anymore, and forceful removal is necessary. Stumbling blocks being what they are in this industry, I feel it's time to talk about this, and without any beating around the bush. Let's start with an analogy:
Danny wants to be a board game player. He looks up how to play a board game on the internet. He selects checkers as it's a simple game to learn for someone new. After playing the game a time or two, he feels confident enough to sign up for a beginner board game competition. He is assigned to play chess - which is also a board game, so he figures he can apply what learned from checkers and figure it out as he goes along. His first turn, he moves a piece and feels good about that. The next move that ensues from his opponent leaves him scratching his head. He doesn't understand it exactly, so he decides to shake it off and move another pawn. That's how he learned to do it with checkers, so it can't be that different. It's just a board game. The game progresses with each move from his opponent removing his pieces, one by one, and he can't seem to confiscate any of their pieces in return. Even though he was moving his pieces forward, he didn't understand that each TYPE of piece represents different levels of capabilities. Before he knew it, he was outwitted and checkmated. All he knew was how to move a piece forward one space, like in checkers. But this was not checkers - this was chess. While both games, on a board, with some movement - how you get to the end of a real game is vastly different.
Danny failed to learn the strategy and approach to the game.
This is what new developers, or experienced developers switching to an unfamiliar tech stack, experience often. As teachers, we believe in breaking things down to it's most basic and simple level. When presenting a quick reference of help, like on Stack Overflow or in the comments section of a blog, this approach is welcome. But when you prepare a tutorial, article, video course or speaking session, you have a greater responsibility to show a more complete application.
Wait a minute. Hello World was not designed to teach people design patterns and architecture. It's just to communicate a small example of what a particular thing does. Why is there a problem with this?
Teaching how to do something that is REAL WORLD in how you would be expected to execute it shouldn't be a concept that we leave behind for the sake of brevity. Documentation examples are notorious for this. One of the fundamentals of clean code is to handle naming in a human readable fashion, as robust as is necessary. Most would agree that getTimezoneAbbreviation() is clearer than the shortened version getTAbbr().
I don't have time to arrange the holy grail of teaching courses. I'm just going to put all my code in one file so I don't have to worry about a bigger structure. As long as it runs and proves the point of the functionality I'm showing, I call it good.
Sure, you could do that. In fact many of the authors of instructional code do this. It doesn't make it good for the student to learn. Why set up the learner for failure? It doesn't really take that much longer to JUST DO IT RIGHT in the first place. At the very least you show proper placement in a real environment, and what kinds of hurdles will have to be overcome in relation to the rest of the application. In addition you also educate, indirectly, how good architecture can work. Reinforcing the fundamental best practices of thoughtful development is the responsibility of all of us. Why take time out to do it any other way? Common sense programming doesn't exist until we make it commonplace.
The reign of Hello, World has had it's time, but a new approach should be considered that can assist the learning curve and make more sense. That is a tutorial style I know I'd be more likely to dive into. Therefore, I issue everyone the challenge to craft more of your examples this way whenever possible. Perhaps we can refer to it as:
Hello, Real World.
Because context matters.