comp.lang.ada
 help / color / mirror / Atom feed
From: Keith Thompson <Keith.S.Thompson+u@gmail.com>
Subject: Re: Why "Hello World" as a first exercise?
Date: Sat, 31 Jul 2021 19:37:11 -0700	[thread overview]
Message-ID: <87mtq1ao14.fsf@nosuchdomain.example.com> (raw)
In-Reply-To: se05ic$741$1@gioia.aioe.org

Richard Iswara <haujekchifan@gmail.com> writes:
> Why is it most of the courses of introduction to programming or
> programming language use a "Hello World" kind of program as a demo or 
> first exercise?
> Why not do a proper input loop as a showcase or a first exercise? With
> an input loop procedure you get:
> 1. How to read and output an input.
> 2. Show the if-then-else structure.
> 3. Show the loop structure.
> 4. Show error messages and how to properly handle it.
> 5. On Ada in particular you are showing the type system.
> 6. If it is a subprogram then input loop shows how to do and call the
> subprograms.
> And last but not least it teaches and reinforces to the student how to
> think about safety in programming.
> So why a useless look at me, ain't I cool "Hello World"?
>
> Sorry I had to vent after an unsatisfying exchange over at arstechnica.

All those things you listed absolutely should be covered -- but only
*after* the "Hello World" exercise.

The first time someone with no programming experience tries to write,
compile, and run a program, *something* will very likely go wrong.
Maybe they'll omit a semicolon, or misspell an identifier, or invoke the
compiler without a required option.  And they're likely to be shown a
terse error message that might not direct them to the right way to fix
it.

By making the first program something trivial that can reasonably be
entered verbatim, you eliminate several sources of errors.  If the
student double checks that the source file exactly matches what's in the
textbook and it doesn't run, it's substantially easier to diagnose the
problem.

Once the student gets "Hello, World" working correctly, if the second
program uses some of the features you mention and *that* doesn't work,
they'll know that the problem is something in the difference between the
first and second programs.

You might try a more ambitious first program if you're an experienced
programmer trying out a new language, but even then I'll probably try
"Hello World" before I try FizzBuzz.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */

      parent reply	other threads:[~2021-08-01  2:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-30  6:17 Why "Hello World" as a first exercise? Richard Iswara
2021-07-30  9:57 ` Paul Rubin
2021-07-30  9:57 ` AdaMagica
2021-07-30 23:06 ` Randy Brukardt
2021-07-31  1:28   ` Dennis Lee Bieber
2021-08-01  1:16     ` Randy Brukardt
2021-07-31  3:06   ` Richard Iswara
2021-08-01  2:37 ` Keith Thompson [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox