comp.lang.ada
 help / color / mirror / Atom feed
* Why "Hello World" as a first exercise?
@ 2021-07-30  6:17 Richard Iswara
  2021-07-30  9:57 ` Paul Rubin
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Richard Iswara @ 2021-07-30  6:17 UTC (permalink / raw)


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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Why "Hello World" as a first exercise?
  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
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Paul Rubin @ 2021-07-30  9:57 UTC (permalink / raw)


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?

The actual exercise is to (if necessary) get the compiler and tools
installed, make the source file, invoke the compiler, and run the
executable.  Depending on the environment, this can be quite a serious
challenge.  Going from there to a more complicated program is simple by
comparison.

I believe the "hello world" meme started with Brian Kernighan's
1970s-era tutorial for the then-new C language, but I could be wrong
about that.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Why "Hello World" as a first exercise?
  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-08-01  2:37 ` Keith Thompson
  3 siblings, 0 replies; 8+ messages in thread
From: AdaMagica @ 2021-07-30  9:57 UTC (permalink / raw)


You're right, this Hello World doesn't tell anything about the language, its syntax, semantics, what these have to do with safety. But you find this nonsense, as you say, everywhere.
But how to begin? The opinions vary. They depend on the audience - beginner, experienced,...

I say: Give them a simple problem and ask: What kind of (numeric) type do you need to fulfil the needs of the solution.
Others disagree: It's to complicate for a beginner to say "type Meter_Rod is range 0 .. 2_000;", just use Integer for the beginning.

The question is: How to avoid bad habits from other languages from the beginning?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Why "Hello World" as a first exercise?
  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-07-31  3:06   ` Richard Iswara
  2021-08-01  2:37 ` Keith Thompson
  3 siblings, 2 replies; 8+ messages in thread
From: Randy Brukardt @ 2021-07-30 23:06 UTC (permalink / raw)


"Richard Iswara" <haujekchifan@gmail.com> wrote in message 
news:se05ic$741$1@gioia.aioe.org...
> 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?

Because the problem isn't about programming at all, but rather getting 
through all of the admistrivia needed to actually run a program. Starting 
with a canned program of some kind is simply the best plan.

My first actual programming class spent the first two or three sessions on 
the administrative things: where is the computer center? How do you use a 
keypunch? (I admittedly am showing my age here; but at least we were the 
second last semester to use the keypunches.) How to submit a card deck? What 
magic incantations are needed to get the computer to accept a card desk? 
Where to find your results afterwards (this being a batch system)? Etc. The 
actual program was very secondary to all of that (I don't remember what it 
was, but we had to key it and submit the results -- in order to prove that 
we understood all of the admistrivia).

Obviously, there are differences from then to today, but there still is a 
lot of admistrivia -- both in an academic environment and also at home. (How 
to use the IDE? How to build a program? How to capture the results? Etc.) So 
it is very valuable for any student to prove that they understand how to 
enter and build a trivial program before they turn to actually learning 
about fundamentals. The flow of any type of course gets interrupted 
everytime someone has problems building a program -- the sooner they 
understand that, the better.

"Hello World" isn't the most interesting program, but it has the advantage 
of being very short and applicable in most contexts (for instance, it makes 
sense both in GUI and text environments). And it also shows a primitive way 
of doing debugging, something that every student will need to know almost 
from the beginning.

Janus/Ada uses a slightly larger program as an installation test at the end 
of installation. (At least if you read the installation guide -- I wonder 
how many do?)  It just sorts a bunch of numbers and displays them to the 
screen. It's not really a useful example, but it does prove that the 
Janus/Ada system and the things it depends upon are all installed properly. 
It doesn't pay to write a program until you are sure of that!

I note that a similar issue happens in a lot of elementary education. I 
vividly remember that the first word in the first book that we read when 
learning to read started with and entire page devoted to "Tom" (and a line 
drawing of a boy). No verb or action or abstraction of any kind. Hardly 
useful text but valuable in getting the new readers introduced to the idea 
of text associated with pictures having the same meaning.

The point being that there is a lot of stuff unrelated to the topic at hand 
that needs to be navigated to learn just about any concept. The sooner that 
that stuff can be dealt with, the better.

                                         Randy.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Why "Hello World" as a first exercise?
  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
  1 sibling, 1 reply; 8+ messages in thread
From: Dennis Lee Bieber @ 2021-07-31  1:28 UTC (permalink / raw)


On Fri, 30 Jul 2021 18:06:21 -0500, "Randy Brukardt" <randy@rrsoftware.com>
declaimed the following:


>My first actual programming class spent the first two or three sessions on 
>the administrative things: where is the computer center? How do you use a 
>keypunch? (I admittedly am showing my age here; but at least we were the 
>second last semester to use the keypunches.) How to submit a card deck? What 
>magic incantations are needed to get the computer to accept a card desk? 
>Where to find your results afterwards (this being a batch system)? Etc. The 
>actual program was very secondary to all of that (I don't remember what it 
>was, but we had to key it and submit the results -- in order to prove that 
>we understood all of the admistrivia).
>
	Sounds like my college... Here are the three 029 keypunches... Here's
how to program a drum card to simplify entering code... Here's the minimum
JCL to run FORTRAN(-IV) (Sigma CP/V had two FORTRAN compilers -- the
traditional compiler outputting a relocatable object [ROM] file, to be
followed by a linker outputting a load module [commonly called a LMN file];
the OS didn't use file extensions, so our practice was to name the source
S:xxx, object O:xxx, executable L:xxx. The other compiler was FLAG --
FORTRAN Load And Go -- compile/link/execute with one invocation). Turn in
the card deck to the operators, here. Come back later to pick up your
printed output.

	It wasn't until my second year that we were given access to the
Hazeltine terminals, along with accounts that had some modicum of disk
storage associated with them. The BASIC class got something like 30
"granules" -- about 15kB; others got 100-200 "granules".

	CP/V somehow combined time-share (we had something like 50 terminals
scattered over campus and a few high schools with dial-up lines), Batch
Processing, and (not of use to a college installation) supposedly
/real-time/ operations.




-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
	wlfraed@ix.netcom.com    http://wlfraed.microdiversity.freeddns.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Why "Hello World" as a first exercise?
  2021-07-30 23:06 ` Randy Brukardt
  2021-07-31  1:28   ` Dennis Lee Bieber
@ 2021-07-31  3:06   ` Richard Iswara
  1 sibling, 0 replies; 8+ messages in thread
From: Richard Iswara @ 2021-07-31  3:06 UTC (permalink / raw)


On 31/07/2021 06.06, Randy Brukardt wrote:
> "Richard Iswara" <haujekchifan@gmail.com> wrote in message
> news:se05ic$741$1@gioia.aioe.org...
>> 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?
> 
> Because the problem isn't about programming at all, but rather getting
> through all of the admistrivia needed to actually run a program. Starting
> with a canned program of some kind is simply the best plan.
> 
> My first actual programming class spent the first two or three sessions on
> the administrative things: where is the computer center? How do you use a
> keypunch? (I admittedly am showing my age here; but at least we were the
> second last semester to use the keypunches.) How to submit a card deck? What
> magic incantations are needed to get the computer to accept a card desk?
> Where to find your results afterwards (this being a batch system)? Etc. The
> actual program was very secondary to all of that (I don't remember what it
> was, but we had to key it and submit the results -- in order to prove that
> we understood all of the admistrivia).
> 
> Obviously, there are differences from then to today, but there still is a
> lot of admistrivia -- both in an academic environment and also at home. (How
> to use the IDE? How to build a program? How to capture the results? Etc.) So
> it is very valuable for any student to prove that they understand how to
> enter and build a trivial program before they turn to actually learning
> about fundamentals. The flow of any type of course gets interrupted
> everytime someone has problems building a program -- the sooner they
> understand that, the better.
> 
> "Hello World" isn't the most interesting program, but it has the advantage
> of being very short and applicable in most contexts (for instance, it makes
> sense both in GUI and text environments). And it also shows a primitive way
> of doing debugging, something that every student will need to know almost
> from the beginning.
> 
> Janus/Ada uses a slightly larger program as an installation test at the end
> of installation. (At least if you read the installation guide -- I wonder
> how many do?)  It just sorts a bunch of numbers and displays them to the
> screen. It's not really a useful example, but it does prove that the
> Janus/Ada system and the things it depends upon are all installed properly.
> It doesn't pay to write a program until you are sure of that!
> 
> I note that a similar issue happens in a lot of elementary education. I
> vividly remember that the first word in the first book that we read when
> learning to read started with and entire page devoted to "Tom" (and a line
> drawing of a boy). No verb or action or abstraction of any kind. Hardly
> useful text but valuable in getting the new readers introduced to the idea
> of text associated with pictures having the same meaning.
> 
> The point being that there is a lot of stuff unrelated to the topic at hand
> that needs to be navigated to learn just about any concept. The sooner that
> that stuff can be dealt with, the better.
> 
>                                           Randy.
> 
> 
> 
> 

Fair points. Obviously now it's a lot different than it was, so why 
don't textbooks and online instructions, especially those with online 
IDE, don't evolve their approach?
I still think that students should be trained and challenged to think 
carefully about implications of their programs. One of the reservations 
I have about those online courses or code solutions sites is how many 
don't consider documentations and coding safely as part of their grades. 
Skills alone do not suffice in the "real world", communications matters 
also. How many hours of training after the students graduate will be 
wasted by their employers to teach them to consider their codes 
carefully. That is IF (that's the big question) the employers do any 
kind of training or mentoring. Why don't that kind of consideration is 
taught and trained until it become a habit during the students education?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Why "Hello World" as a first exercise?
  2021-07-31  1:28   ` Dennis Lee Bieber
@ 2021-08-01  1:16     ` Randy Brukardt
  0 siblings, 0 replies; 8+ messages in thread
From: Randy Brukardt @ 2021-08-01  1:16 UTC (permalink / raw)


"Dennis Lee Bieber" <wlfraed@ix.netcom.com> wrote in message 
news:6199gg1vsegpsqj6prdrqmmme4qo8avk71@4ax.com...
> On Fri, 30 Jul 2021 18:06:21 -0500, "Randy Brukardt" 
> <randy@rrsoftware.com>
> declaimed the following:
>
>
>>My first actual programming class spent the first two or three sessions on
>>the administrative things: where is the computer center? How do you use a
>>keypunch? (I admittedly am showing my age here; but at least we were the
>>second last semester to use the keypunches.) How to submit a card deck? 
>>What
>>magic incantations are needed to get the computer to accept a card desk?
>>Where to find your results afterwards (this being a batch system)? Etc. 
>>The
>>actual program was very secondary to all of that (I don't remember what it
>>was, but we had to key it and submit the results -- in order to prove that
>>we understood all of the admistrivia).
>>
> Sounds like my college... Here are the three 029 keypunches... Here's
> how to program a drum card to simplify entering code... Here's the minimum
> JCL to run FORTRAN(-IV) (Sigma CP/V had two FORTRAN compilers -- the
> traditional compiler outputting a relocatable object [ROM] file, to be
> followed by a linker outputting a load module [commonly called a LMN 
> file];
> the OS didn't use file extensions, so our practice was to name the source
> S:xxx, object O:xxx, executable L:xxx. The other compiler was FLAG --
> FORTRAN Load And Go -- compile/link/execute with one invocation). Turn in
> the card deck to the operators, here. Come back later to pick up your
> printed output.

Ah. We had the very advanced self-service card reader for simple jobs. You 
put your card deck in, pushed a large button, watched a very impressive 
swooshing of cards about, and then went and stood around a desk-sized 
printer with lots of other people waiting for a page with your user name in 
very large letters to head a printout, rip it off (preferably leaving anyone 
elses that was attached -- didn't always happen), and go read the output to 
see what you did. The original compile-execute-debug-repeat cycle (more like 
run-read-punch new cards-repeat cycle).

They had a few Decwriters, but only upper classmen got to use them (and they 
wasted tons of paper). Real terminals showed up the next year -- by the time 
of the compiler contruction class, most of the classes had moved to PDP/11s 
(way slower), but the compiler construction was still on the mainframe. But 
almost everything was done on the terminals (Janus/Ada never was on punched 
cards, thank goodness). We had to buy one of those huge computer tapes to 
rescue our source code and use another labs capability to transfer that to 
floppies in order to move our work to the CP/M computer on which RRS was 
born. A lot more engineering went into that sort of issue than today 
(probably a good thing).

                             Randy.


                                    Randy. 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Why "Hello World" as a first exercise?
  2021-07-30  6:17 Why "Hello World" as a first exercise? Richard Iswara
                   ` (2 preceding siblings ...)
  2021-07-30 23:06 ` Randy Brukardt
@ 2021-08-01  2:37 ` Keith Thompson
  3 siblings, 0 replies; 8+ messages in thread
From: Keith Thompson @ 2021-08-01  2:37 UTC (permalink / raw)


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 */

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-08-01  2:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox