Jump to content

Talk:Computer program/Archive 4

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by ClueBot III (talk | contribs) at 04:04, 20 October 2020 (Archiving 1 discussion from Talk:Computer program. (BOT)). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Archive 1Archive 2Archive 3Archive 4

Defined as a "collection of instructions" confusion

It seems counter intuitive to consider computer programs as non-sequential. I'm assuming "collection" refers to declarative programming languages. I recommend this nuance be explained in the lead. Timhowardriley (talk) 16:02, 14 October 2015 (UTC)

Hello! I'm not really sure what's so wrong with using "collection of instructions"? Surely, we might want to explain it further, but using "sequence" actually isn't better. Almost no program is a plain linear sequence of instructions – just think of various libraries, for example. Moreover, the sequence is only one element of structured programming, besides the selection and iteration. — Dsimic (talk | contribs) 16:22, 14 October 2015 (UTC)
Soon after the definition was changed, this edit was made: https://en.wikipedia.org/w/index.php?title=Computer_program&diff=685664350&oldid=685658307 I don't think I'm the only one scratching my head. Timhowardriley (talk) 16:31, 14 October 2015 (UTC)
See turing machine: "Despite the model's simplicity, given any computer algorithm, a Turing machine can be constructed that is capable of simulating that algorithm's logic." A turing machine has an initial state. The sequence has a starting point. Timhowardriley (talk) 16:34, 14 October 2015 (UTC)
Regarding "Surely, we might want to explain it further": What words would you suggest? Timhowardriley (talk) 16:38, 14 October 2015 (UTC)
(edit conflict) That particular edit seems perfectly fine to me. Speaking about the Turing machine, the tape it operates on is just the data, while the instruction table is the actual program it executes. Thus, it doesn't represent a plain sequence of something, if you agree. At the moment, I don't see how to explain the "collection of instructions" further and whether we actually need to do that, but I'm open to discussing any proposals. — Dsimic (talk | contribs) 16:46, 14 October 2015 (UTC)
I changed the definition in response to #Less specific intro above. Only the simplest of programs can be said to be "sequences" in any interpretation of that claim. Some valid ways to claim that programs are sequences would be:
  • The machine code is stored as a sequence of instructions. (But that's no longer strictly true today, now we have fancy executable file formats and dynamic linking).
  • The execution trace of a program is a sequence. (But that's not how we "intuitively" think of a program, and is no longer true if we introduce multithreading or other forms of concurrency).
The source code of high-level languages is usually thought of as an abstract syntax tree (not as an abstract syntax sequence). The semantics of a program can be though of as a control-flow or dependency graph, or in terms of other fancy (fancier than a sequence, that is) mathematical structures.
In the end, I think, we just want to say that "a program is a bunch of instructions" and not go into to much more detail in the lede (elaborating in the body would be fine). And "collection" seems like a sufficiently formal synonym of "bunch" so that it can pass as an encyclopedic definition, and with just the right amount of vagueness, so that we neither say anything we don't want to say, nor say nothing at all. —Ruud 17:18, 14 October 2015 (UTC)
I suggest the following experiment: Google "computer program is a collection of instructions." Google "computer program is a sequence of instructions." Timhowardriley (talk) 17:56, 14 October 2015 (UTC)
I suggest the following experiment instead: Google "we did land on the moon." Goole "we did not land on the moon." —Ruud 18:08, 14 October 2015 (UTC)
This was a less than nice thing to say. Timhowardriley (talk) 18:24, 14 October 2015 (UTC)
Please, let's keep in mind the existence of WP:GOOGLEHITS guideline, which of course isn't directly related, but applies to a certain extent. — Dsimic (talk | contribs) 18:29, 14 October 2015 (UTC)
WP:GYNOT would be the applicable guideline here. Google "comparisons" are problematic because they often give silly results depending on the exact way you phrase and interpret your queries. In this case we in particular don't know how many of those hits correspond to people simply having copied the Wikipedia definition, which has been in the article for several years, I think. And we're supposed to be educating people here, not simply repeat the same (mis)information that has been spreading among the hoi polloi. —Ruud 18:53, 14 October 2015 (UTC)
May I politely assert that I thought of using Google comparisons because I read this talk message: "Top hits on Google Books: [7] [8]. —Ruud 00:13, 13 October 2015 (UTC)". I know Ruud didn't mean to illustrate popularity. But when I made my suggestion to use Google, I should have said, "Google Books". Books.google.com matches published material defining Computer program as a sequence. Nonetheless, from my earliest computer education until I learned about Declarative programming, computer programs were sequential. They had a starting point, followed a sequence of instructions, then outputted the results. However, declarative programming "expresses the logic of a computation without describing its control flow." Declarative computer programs are sets of instructions; they don't express a computer algorithm. I'm going to keep thinking about how to explain the new definition of computer program to young readers of this article. Timhowardriley (talk) 17:49, 15 October 2015 (UTC)
Even programs as simple as computing a greatest common divisor or summing a list of numbers aren't sequential, as they require iteration or recursion. Only if you take the execution trace point-of-view can those said to be sequential (which I don't think is the mental model most people would have when thinking about programs), and then only because they don't use any form of concurrency (which is getting increasingly common nowadays). I don't mind including a few white lies in the lede, so as to keep it sufficiently simple (such as that programs are made up from "instructions"; radical declarative programmers would insist they are made up from declarations, and they are right to some degree, but that discussion belongs in the subsection on Programming languages, not in the lede). But claiming that programs are sequences seems to be making a rather strong commitment to how programs are stored and executed, and one that can be easily avoided by using slightly different terminology. —Ruud 18:09, 15 October 2015 (UTC)
I can reconcile iteration and recursion as sequential activities. Concurrency is an optimization that compiler and hardware designers provide – well, mostly. Pedantic declarative programmers probably appreciate the new definition. My motive is to effectively communicate computer program to the largest audience possible. Timhowardriley (talk) 18:34, 15 October 2015 (UTC)

How computer programs relate to algorithms

The following sentence is vague: "A small part of a computer program that performs a well-defined task is known as an algorithm." What does "a small part" mean? I found a textbook definition of algorithm and replaced this sentence with the definition. I also used words to couple algorithm to computer program. "A programmer implements algorithms with computer programs." Okay, maybe I should have written, "Programmers generally use algorithms to build programs." But that was reverted, also. What's wrong with my edits? Timhowardriley (talk) 15:37, 17 October 2015 (UTC)

I moved Ruud's personal talk page comment to here for discussion: He said, "Concerning the third paragraph of the lede of Computer program: the intention of mentioning algorithms there is to succinctly relate that concept to computer programs and direct the reader to the article Algorithm for further information. It does not intend to give a precise definition of an algorithm, as the quoted source tried to do.
Ruud 16:43, 17 October 2015 (UTC)" Timhowardriley (talk) 17:47, 17 October 2015 (UTC)
However, I believe more specific information is better, if it's available. And a textbook definition of algorithm best serves the reader. There still can be a Wikilink to its article. Timhowardriley (talk) 17:58, 17 October 2015 (UTC)
Again, I moved Ruud's personal talk page comment to here for discussion: He said, "'Computer programmers implement algorithms with computer programs.' (or 'Programmers generally use algorithms to build computer programs.') is an awkward sentence. It doesn't feel natural in that paragraph. If I try to put the phrase 'computer program' back into 'An algorithm is a clearly specified set of simple instructions to be followed to solve a problem.', then I end up with almost the original sentence. —Ruud 18:59, 17 October 2015 (UTC)" Timhowardriley (talk) 20:34, 17 October 2015 (UTC)
Ruud, I interpret your viewpoint as: the current sentence, although a little white-washed, is sufficient enough information for the broadest audience to grasp, considering it's in the lead. Is this correct? Timhowardriley (talk) 20:40, 17 October 2015 (UTC)
Yes, I think it's accurate enough for its purpose. I don't immediately see a good way to make that sentence more precise, without it becoming very long-winded. But I'm open for suggestions. —Ruud 20:47, 17 October 2015 (UTC)