Talk:Computer program

From Wikipedia, the free encyclopedia

Maintained The following user(s) are actively involved with this article and may be able to help with questions about verification and sources:
Derek farn
This in no way implies article ownership; all editors are encouraged to contribute.

This is the talk page for discussing improvements to the Computer program article.

Article policies
Archives: 1
This article is within the scope of Computing WikiProject, an attempt to build a comprehensive and detailed guide to computers and computing. If you would like to participate, you can edit the article attached to this page, or visit the project page, where you can join the project and/or contribute to the discussion.
B This article has been rated as B-Class on the quality scale
Top This article has been rated as top-importance on the importance scale
This article is within the scope of WikiProject Computer science, which aims to create a comprehensive computer science reference for Wikipedia. Visit the project page for more information and to join in on related discussions.
B rated as B-Class on the assessment scale
Top rated as top-importance on the assessment scale


Contents

[edit] Definition of a computer program

I think the definition of a computer program should be: A computer program is a sequence of instructions that is carried out by a computer.

This is a good and concise definition. It is a good definition because it still holds true if you swap the subject with the predicate. A sequence of instructions to be carried out by a computer can only be a computer program. It is concise because if you remove any words, it loses its meaning. Timhowardriley 03:20, 19 April 2007 (UTC)

I think this is too sequential. Parallel programs are not executed as a single sequence of instructions. Nor are Prolog programs.—greenrd 13:29, 19 April 2007 (UTC)
It depends at what level of abstraction is used. At the lowest level a program is a sequence of instructions. At a higher level of abstraction the sequence might be viewed as containing multiple threads of execution. I guess the article ought to come at it from both angles. The current definition approaches the topic from a high level software point of view. A cpu 'eyes' perspective is really needed as well. Derek farn 16:00, 19 April 2007 (UTC)
It's important to distinguish between a computer program and a computer process. Yes, processess can execute in parallel. What's a prolog program? I can't figure out the distinguishing characteristics of prolog. If the programming language can be emulated with a Turing machine, and since Turing machines are sequential, I think the proposed definition still holds. Timhowardriley 17:21, 19 April 2007 (UTC)
Not all "sequences of instructions" are programs. For example, a function or subroutine is a sequence of instructions, but it is not a program. A program with threads does not execute "sequentially" when there are multiple processors. Therefore we need to add some additional verbage. You cannot "cheat" and redefine each thread to be a separate program in most cases. With respect to Prolog, RPG, and other non-procedural languages, I'm content to define them separately if needed. It's like pornography: I cannot give you a simple definition, but I know what a program is when I see one. -Arch dude 00:05, 20 May 2007 (UTC)
How about amending the definition to "collection of instructions". It's a little more general and doesn't conflict with high level programming concepts or thread-level parallelism. I agree that the term is rather nebulous, so putting a fine point on its definition is probably not the way to go. -- mattb 16:07, 21 May 2007 (UTC)
But collection means a gathering, implying no order whatsoever, like a set. Consider the framework of the program counter. Because the program counter gets incremented after each instruction, we have one thing following another -- a sequence. Timhowardriley 16:34, 21 May 2007 (UTC)
As was pointed out before, this is true on a low level with modern implementations of computers (CPUs), but there are high level programming languages which abstract the hardware enough for the "sequence of instructions" explanation to be less applicable. -- mattb 20:35, 21 May 2007 (UTC)
OK. Let's consider the most high level language, the language that completely hides the algorithm of the task -- SQL. 1) Would you agree that SQL is a language? (There's been some disagreement about this.) 2) Would you agree that SQL completely hides the algorithm? 3) Would you agree that SQL is a single instruction language? 4) Would you then agree that a computer program is either a single instruction or a sequence of instructions? Timhowardriley 20:54, 21 May 2007 (UTC)
I think we're getting into a classic "forest for trees" rut here. When in doubt, I'd suggest going with a more general statement. I don't believe that you're going to agree upon a super specific and precise definition for "computer program". In the early days of computers, this would have been easier to define, but as with many things computer related, time has blurred the exact meaning of "program" in this context. This is something you might be able to acknowledge in the article without worrying so much about producing a concise, specific one-liner definition. -- mattb 22:46, 21 May 2007 (UTC)
I like the pornograph analogy because computer program is an abstract idea, not a concrete thing, like a power supply. I went to the library, and a computer principles textbook, "Principles of Information Systems" (by Stair, et al., 2003), defines computer programs simply as "sequences of instructions for the computer." Regarding functions and subroutines: a function or subroutine seems like a computer program to me. Could you expand on how it is different? I see a function or subroutine as a computer program with its scope segregated from the main program. Moreover, when a function or subroutine is encountered, the instruction is (admittedly oversimplified) a stack push of the program counter and an assignment of the program counter to now be the address of the function or subroutine. Also, regarding a program with threads: yes processes can execute in parallel, but the source code (the computer program) reads from the top to the bottom, in sequence. Timhowardriley 16:29, 21 May 2007 (UTC)
May I cite as a reference: dictionary.com? Dictionary.com defines a computer program as "noun (computer science) a sequence of instructions that a computer can interpret and execute." Timhowardriley 20:54, 21 May 2007 (UTC)

Jumping in since Tim asked me to: I agree that the phrase "sequence of instructions" is unnecessarily wrong (given FP, constraint programming, and so on). However, I also think it's unnecessarily pedantic to insist that a subroutine is not a program (given that, in most if not all modern programming languages, a program is identical to a collection of subroutines with one magic subroutine as the entry point).

I'd offer: "A computer program is a set of instructions that a computer can use to carry out a task." Which is amazingly close to the current wording, though I swear I didn't look at the page before writing that! I do prefer the word "set" to "collection" in this case, since "collection" sounds unnecessarily vague to my ear, and because it has another meaning in computer science already. --Quuxplusone 03:19, 22 May 2007 (UTC)

I see a bit of a problem in that one, too: How many layers may be between the computer and that set (or whatever, let's discuss that elsewhere)? timhowardriley has brought up SQL as a often used case (4GL, VHLL), but I'd go even farther: Isn't even a config file a program (by that definition) in that it may contain a set of instructions a computer may use to carry out a task? Okay, it may need a bit of interpretation... by an interpreter... But, and that is the main problem I see, Java programs -for example- need that, too. Now, what to do? Try to define a computer program simply as a collection of instructions for a programming language and leave it to the programming language article to talk about Turing completeness of the language as potential criterion? Tierlieb 08:43, 22 May 2007 (UTC)
  • I quite like Quuxplusone's definition. I might also point out that this is a general purpose encyclopedia. We are not here to be overly pedantic, or nit-pick indefinitely. Wikipedia is here to inform the ignorant (everyone is ignorant, although in different fields), and this article should do so. If I go to the article for Computer program, I want to learn what 99.99% of people (including professional programmers) call a "computer program", not what could be called a program, or what is the limit of what is not a program. We all call "program" either a script later interpreted by an interpreter or a binary object obtained by compiling a piece of source code. The definition should reflect this, I think. — isilanes (talk|contribs) 11:43, 22 May 2007 (UTC)
  • There is also the meaning of the word program. Why (how) is a computer program a "program"? A program is a kind of list of what is going to happen (on TV, in cinemas, at the opera) in the near future, as a computer program is a list of task the computer will execute. Also, a program is a comparable to a cooking recipe, where the cook is the CPU, and the dish is the finished task. A cook (or set of cooks) can cook in parallel. They can read the recipe and optimize it. They can produce one dish, or one thousand. They can use other recipes combined with that recipe. But in the end, a recipe is a set of instructions that a cook can use to produce a dish, just as a computer program is a set of instructions that a computer can use to carry out a task. The program is the recipe, and all the rest (including the physical appearance of the recipe) is circumstantial. — isilanes (talk|contribs) 13:40, 22 May 2007 (UTC)
  • I must say that I also like Quuxplusone's definition. I'm not completely certain why I like set better than collection, as both words already have connotations in computing. However, could computer program possibly be defined more generally as instructions that are carried out by a computer, and leave off set or collection? This seems to be getting bogged down in the nature of the instructions, so I'm left wondering what is absolutely necessary for the simplest definition possible. Ltruett 17:04, 22 May 2007 (UTC)
This almost gets us back to the current definition. The problem with the term set is that it implies only one of each kind of thing. Collection has no unnecessary connotations. The cooking recipe is often cited (and is an example of a kind of program that is not executed by a computer). However, I might 'program' the waiter with a collection of dishes I would like to eat and leave the technical details (ie, the tasks) to other people (ie, the what, not the how). Derek farn 17:38, 22 May 2007 (UTC)
"The problem with the term set is that it implies only one of each kind of thing." True, although (as I'm sure you know) "set" also has the non-mathematical meaning of "group, but phrased more pretentiously". :) For example: a set of blueprints, a croquet set. However, both collection and group do have an unnecessary — and unwanted — connotation to my mind, which is the connotation of disorder. I think of a "collection" as something that is gathered without much thought to organization, rather than laid down in an organized fashion. For example: a collection of fairy tales; a bottle cap collection. I might say that a structured program consists of a collection of subroutines, but I wouldn't say that it consists of a collection of instructions. "Set", to me, strikes the right balance between "sequence" (too strictly ordered) and "collection" or "group" (too loosely organized). There might be a better word that I'm just not thinking of. (Isilanes' allusion to a "recipe" is right on the mark, but I don't think we want to use the word "recipe" in the intro; let's aim a little more pretentious than that. :) --Quuxplusone 02:03, 23 May 2007 (UTC)
  • As loosely as possible a computer program is a grouping of zero or more instructions that a computer can carry out. It seems we are now wrestling the issue of how loose should the definition be, especially in terms of the program's goal (if there is one) and the how the statements are grouped. Should a program necessarily have a unified goal, and how can that best be stated in the definition? What sort of grouping are the program's statements in? I think I could see reason for both looser (to include all possibilities) and tighter (to include what is generally thought of as a program). Is there a generally accepted Wiki way to incorporate both into the definition? Ltruett 20:02, 22 May 2007 (UTC)
The term task is sufficiently generic that it covers programs that contain any number of instructions. This term also covers the case where it is difficult to pin down exactly what/where the instruction is (prolog is a much better example language for this than SQL). Derek farn 22:49, 22 May 2007 (UTC)
  • How about the following?: we give a concise and simple definition of what a program is, in words anyone can understand ( OK, more pretentious than "recipe" :^) ), and then (maybe in the same paragraph, maybe in a subsection by its own) we discuss the limitations of that definition, and explore the limits of what can and can not be called a "program". This way, a reader with modest knowing of what even a computer is can grasp the general meaning of the expression (which is fairly simple, remember the recipe), and the more knowledgeable reader can find a more precise explanation (e.g. why/how/when the recipe/set of instructions/film script metaphor fails). For the "simple" explanation I propose a barely modified "Quuxplusone" definition (A computer program is a set of instructions that (a computer can use|tells a computer how) to carry out a task.) — isilanes (talk|contribs) 08:26, 23 May 2007 (UTC)


There are different [definitions on dictionary.com] under program, they seem to describe executables, and source code. In an attempt to unify, and I'm going rather general here: "a computer program is a description of a list of operations to be executed on computers, or a list of conditions and instructions from which such a list of instructions can be derived." I believe this covers it pretty generally.

  1. It covers executables, as a list of operations.
  2. It covers source code, as a list of operations can be derived from it (through compiling).
  3. It covers source code that doesn't do anything useful, it may produce the empty set of instuctions, or non-useful instructions.
  4. It covers source code in a language that doesn't have a compiler, by making someone rewrite the program with the same result in a lower level language.
  5. It covers distributed programing, by having computers in plural (one might argue that a set of distibuted systems form one computer, but this way of stating it prevents that discussion entirely).

Martijn Hoekstra 13:12, 25 August 2007 (UTC)

[edit] Computer program states (forms) and sets (levels)

A computer program can be in one of four states -- source, token, object, or binary.

A computer program can exist in a lot more states than this. What about abstract syntax trees, Register Transfer Language and a hole host of other intermediate forms. Derek farn 18:26, 19 April 2007 (UTC)
Yes, you're right. After reading the link, I think abstract syntax trees are an intermediate step in the compilation process, producing a data structure used to parse the language, or something like that. Register Transfer Language also appears to be a state of a computer program. Maybe at the 10,000 foot view of computer programs, we could say there are four primary states: source, token, object, and binary. These states would have the common characteristic that they are all stored in a file waiting for something else to happen. Then in a subsequent paragraph, we could explore the many intermediate states, which are used to modularize the compilation process. Timhowardriley 21:09, 19 April 2007 (UTC)

Since object and binary are logically equivalent,

What do you mean by logically equivalent? They are all different representations of the same thing. Derek farn 18:26, 19 April 2007 (UTC)
Yes. I was trying to get a simplified representation of the different states by combining the object state with the binary state. And since I'm learning that Java tokenized form appears to be in the object state, we should probably include the object state, too. Timhowardriley 21:09, 19 April 2007 (UTC)

it could be argued that three states exist. Also, computer programs can be categorized into one of two sets (levels) -- system and application. To explain the different states (forms) that a computer program could be in, and to explain the different sets (levels), I suggest the following sentences:

A computer program may be in its source code form, viewable as a programming language; it may be in its tokened form, ready to be interpreted; or it may be in its machine code form, ready to be executed. (An aside: source code form may also be interpreted.) Computer programs are divided into two levels -- system software and application software. System software is the operating system that couples the computer's hardware with the application software. Application software couples the system software with the user interface.

This would replace the current explaination of the different states and sets:

The term computer program may refer to source code, written in a programming language, or to the executable form of this code. Computer programs are also known as software, application programs, system software or simply programs.

Any suggestions? Timhowardriley 03:36, 19 April 2007 (UTC)

You've linked "tokened form" to bytecode, but bytecode is not at all equivalent to tokenized form, in general. Consider Java bytecode, for example, which is object code for a virtual machine. Quite a lot of translation has gone on in the Java compiler to get the program into that form - much more than just tokenization.
OK. They seemed the same to me. Are they both mainly an index to an array of instructions plus parameters? Timhowardriley 17:55, 19 April 2007 (UTC)
I stand corrected. Tokenized (if I remember correctly) is an index to an array of instructions plus parameters, and bytecode is sounding a lot like object code for interpreters (virtual machines). Timhowardriley 21:09, 19 April 2007 (UTC)
The distinction between (a) code that has been made ready for immediate interpretation (which may include more than just tokenization - see threaded code), and (b) object code, is quite complicated because the two forms overlap in some systems. I think we should abstract out, and consider what the user sees. Basically the user only sees two types of files - source code, which she can read directly (although she may not understand it), and object code, which she cannot read directly. The ready-for-interpretation state is kind of an implementation detail, if we view this from the perspective of types of files - which makes it easier to explain in a simple way, because then we only have two forms instead of three or four.
Also, your explanation of "application software" doesn't really say what it is, which it ought to.—greenrd 13:23, 19 April 2007 (UTC)

A suggestion about the paragraphs. After we get the definition nailed down and explain the primary states, we should have a paragraph on the transitions from state to state, like what the different types of compilers do. We should also have a paragraph about the two categories of computer programs: system and application. Then I think we'll have the major bases covered: definition, states, transitions, and sets. Timhowardriley 21:09, 19 April 2007 (UTC)

[edit] Changing states (forms)

I think an explaination about how computer programs change states (forms) would help the reader understand the process of going from code to output. Perhaps something like this:

Source code is converted to either tokened form or machine code form by a process called compiling. A compiler reads keywords from the source code, and by using a table of tokens (to convert to token form) or by using a table of machine instructions (to convert to machine code form), the compiler then outputs to a separate file the instructions ready to be interpreted or executed.

What do you think? Timhowardriley 04:05, 19 April 2007 (UTC)

This only mentions tokenization and output explicitly, and glides over all the other stages of compilation. A casual reader could be forgiven for thinking that tokens are simply serialized to output - nothing could be further from the truth. I agree that we should cover compilation, but as it stands your explanation is too simple, and potentially misleading.—greenrd 13:07, 19 April 2007 (UTC)
OK. We're working on the different states above. Once we nail that down, we can work on the transitions. Timhowardriley 20:23, 19 April 2007 (UTC)
Not all source code is compiled. Some is interpreted, some is assembled. The compiling and assembling are subtly different; the number of machine instructions produced by the process are the main differentiator; but interpretation versus the others is huge. SqlPac 04:35, 22 May 2007 (UTC)

[edit] New introduction (Suggestion)

Taking into consideration our previous discussions, I suggest the following introduction to Computer program:

I don't understand what it is that you object to in the current introduction.
I was hoping not to have to hurt anybody's feelings. I wrote an article that links here and saw the need for a more accurate definition of computer program. Timhowardriley 19:01, 22 April 2007 (UTC)
Please answer the original question. What it is that you object to in the current introduction? Derek farn 00:04, 23 April 2007 (UTC)
As an aside (and sorry to be so negative) your first paragraph below is technically incorrect,
Can it be improved? I was ignoring nuances for the sake of clarity. Timhowardriley 19:01, 22 April 2007 (UTC)
Perhaps you could suggest some qualifiers: mostly, sometimes, etc. Timhowardriley 19:05, 22 April 2007 (UTC)
Why try to fix an inaccurate and verbose proposed new wording when we have yet to discuss the inaccuracies in the original? Derek farn 00:04, 23 April 2007 (UTC)
and the second paragraph is overly long and detailed (perhaps it could go in a subsection on various options for executing programs,
Yes. The difference between system software and application software could be in it's own subheading. Timhowardriley 19:01, 22 April 2007 (UTC)
although it also contains technical inaccuracies, eg, systems software does not always operate in privileged mode and rarely has access to all hardware). Derek farn 11:38, 22 April 2007 (UTC)
What if it were edited to be more perfect? Timhowardriley 19:01, 22 April 2007 (UTC)

A computer program is a sequence of instructions that is carried out by a computer.

A computer program is written in a human readable form called source code. However, the computer's CPU requires a computer program to be in its machine code form. To get from source code form to machine code form requires one several methods of transition. The transition method chosen depends upon factors such as the desire for rapid development or the desire for rapid execution. If rapid development is desired, then the source code could be sent to an interpreter. An interpreter would decode the source code on-the-fly and use a machine code translation table to feed the CPU. If rapid execution is desired, then the source code would first be compiled to an object file. The object file would then be linked with other libraries, which are themselves precompiled to object files, and stored in an executable file. On the other hand, a hybrid method of transition from source code to machine code has emerged. Source code is compiled to bytecode; then the resulting file is sent to a virtual machine which feeds the machine code to the CPU. For example, the Java programming language may be compiled to bytecode, stored as a Java Archive File. When the Java computer program is requested, the corresponding bytecode is transmitted to your browser's Java virtual machine for execution.

Computer programs are divided into two classes -- system software and application software. Computer programs written as system software share two significant characteristics. First, they interact with the computer's hardware. This low-level coupling, combined with a logical Application Programming Interface, enables programmers to write hardware-independent computer programs. Collectively, all of the system software constitutes a computer's operating system. The second significant characteristic of system software is that it runs in privileged mode, never being denied access to any hardware. The second class of Computer programs is application software. Computer programs written as application software collect information from computer users or computer processes. The application software then uses the operating system's Application Programming Interface to access memory, disk drives, and other devices on behalf of the computer user.

What are your comments and edits? Timhowardriley 04:22, 22 April 2007 (UTC)

It's better. However, system software can include operating system utility software such as disk defragmentation utilities, which are not permitted to access the hardware directly. Also, I'm still not convinced that we shouldn't be merging Computer program into Computer software, as I previously suggested.—greenrd 11:30, 22 April 2007 (UTC)
This debate has been going on for decades. Why don't you add a paragraph on system utilities to fill in the gaps? Timhowardriley 19:01, 22 April 2007 (UTC)
If merged, which article would go away? Timhowardriley 19:03, 22 April 2007 (UTC)
Let's keep the discussion on the proposed merge in one place, please.—greenrd 22:11, 22 April 2007 (UTC)
Already posted to the other talk page, but just for good measure putting it here too. Strong oppose merge. SqlPac 04:36, 22 May 2007 (UTC)

[edit] Problems with current introduction

As requested by Mr. Farn. My purpose is improve computer program in Wikipedia, not to criticize works of others':

  • "collection of instructions"? A computer program is a "sequence of instructions" because computer programs are linear. (Computer processes can be parallel.) Even if computer programs were parallel, "collection" does not communicate parallelism.
The following is a tautology: "sequence of instructions" because computer programs are linear. Derek farn 19:41, 23 April 2007 (UTC)
It's not a tautology either. That's a ridiculous interpretation of that sentence. Obviously he was defining computer program and giving you a reason why!--24.57.157.81 06:08, 25 April 2007 (UTC)
"List of instructions" --24.57.157.81 06:04, 25 April 2007 (UTC)
List of instructions works; also, ordered set of instructions. But I respect Mr. Farn's implication that instructions may be un-structured. Unlike the objection below, I believe SQL may be considered an un-structured computer program. Instead of telling the computer *how* to perform, it simply tells the computer *what* to perform, and leaves it to an interpreter to convert the statement to a "list of instructions". This characteristic of computer programs can be incorporated into the definition; however, it will take two sentences to make the structured vs. un-structured distinction clear. Timhowardriley 20:44, 25 April 2007 (UTC)
  • "describe a task"? Computer programs do not "describe" anything; instead, they instruct the CPU. Does a food recipe describe a dish? No; to describe a dish you would use smell, color, texture, etc.
Prolog and SQL programs describe a task and you would be very hard pushed to find any sequence of instructions in the former. Derek farn 19:41, 23 April 2007 (UTC)
A QUERY IS NOT A PROGRAM, DEREK. --24.57.157.81 06:04, 25 April 2007 (UTC)
What grounds do you have for saying that select salary from database where name = "Derek"; is not a program? It is written in a computer language, I can put it in a file and have it executed (provided I have the necessary support software). I can write a query that consumes vast amounts of cpu resources and disk transactions, is that any more of a program than my simple example? Does Hello world fail to be a program because it is not sufficiently resource intensive? I think not. Derek farn 21:41, 25 April 2007 (UTC)
Now we could extend the concept of query to include Google searches. Is "foo bar" a program (because typed into a Google search box it will cause computer activity)? I would like to think not, but then I had the be pulled dragging and screaming around to the point of view that html was a programming language. Derek farn 21:41, 25 April 2007 (UTC)
We could take the programming language approach of giving various examples of a set of tasks that might be considered a computer program. That list of examples might range from the Linux kernel, to Microsoft word and a Google query. But I digress from the topic of the introduction, which needs to be broad brush, shortish and understandable to an intelligent lay person. Derek farn 21:41, 25 April 2007 (UTC)
HTML is not a programming language either, I don't know who convinced you of that but that's 10x worse than saying a query is a program. At least a query can look like a program. Queries can be monstrously complicated, and I respect the skill in developing them. However, a query is not program. The actual program moves the data around and returns it to you. Your query does not actual do anything, the program, the "necessary software" does. Queries are pure input. I have the utmost respect for writing queries, do not get me wrong. They can be far more complicated than a simple program which prints "hello world." They just aren't programs. Programs produce an output.--24.57.157.81 22:30, 25 April 2007 (UTC)
HTML is not a programming language. It's a "Markup Language". Hence the clever name. Queries can very easily be considered programs. What you seem to be saying is that a "real programming language" must explicitly change state, and that is not true. There are plenty of declarative programming languages, functional languages, etc., that do not rely on the programmer explicitly changing state to produce results. APL, Erlang, LISP, Haskell, ML, Schema, R, Mathematica are all examples of declarative functional programming languages. SqlPac 04:45, 22 May 2007 (UTC)
The technical term is external effect not output. Select statements do produce output, they output the result of the query (provided there is one). What if I change the string in a hello world program to the empty string? Does what I have written cease to be a program? In the case of html I do insist that the source contain some embedded scripting language (so it is Turing complete, which pure standard SQL is not {which is why vendors add extensions}). Derek farn 07:59, 26 April 2007 (UTC)
"(so it is Turing complete, which pure standard SQL is not {which is why vendors add extensions})."
I take it you are not at all familiar with the SQL/PSM standard? SqlPac 20:01, 23 May 2007 (UTC)
  • "set of tasks"? How does this add any meaning? True, computer programs can be written to do more than one thing. How does this characteristic help define what a computer program is? Does the fact that a car can go more than one place help define what a car is? "A car is a mode of transportation that can go from one point to another point, or a set of points."
A set of tasks means more than one task and no particular relationship exists between them (well, that is my guess at what the author meant). Derek farn 19:41, 23 April 2007 (UTC)
  • "Computer programs are also known as ..." A list of synonyms should follow. However, what follows is a list which combines synonyms (software), classes (system vs. application), and nonsense (programs): "Computer programs are also known as programs"

These are just the first two sentences. :--( Timhowardriley 17:14, 23 April 2007 (UTC)

These are just the first two sentences for which you have not appreciated the full implications. Derek farn 19:41, 23 April 2007 (UTC)
I cannot communicate with those that do not wish to achieve excellence. (See CPU for an example of excellence.) To achieve excellence, we need to avoid naysaying and recognize that improvement is necessary in the computer program article. After one recognizes that improvement is necessary, at least pretend to consider all suggestions offered. That way, others will be encourage to participate, including those that know both computers and English. Timhowardriley 23:46, 23 April 2007 (UTC)

[edit] Rewrite

Pretty obvious. --24.57.157.81 06:13, 25 April 2007 (UTC)

[edit] New introduction (Suggestion v 2.0)

A computer program is one or more instructions that are carried out by a computer.

Timhowardriley I am at a loss as to why you continue to promote this technically incorrect sentence/idea. Derek farn 18:25, 27 April 2007 (UTC)
Please provide a counter-example. Display for me a computer program that is not one or more instructions that are carried out by a computer. Timhowardriley 20:41, 27 April 2007 (UTC)
If a computer program is the current definition, "a collection of instructions that describe a task, or set of tasks, to be carried out by a computer", and since "collection" means, "to gather", and since "describe" means "to depict in words", and since "task" means "work to be done", then you would have to agree that a computer program is a "gathering of instructions that depicts in words work to be done, or a set of works to be done, to be carried out by a computer." Is this really what you mean for the definition of a computer program? In spite the fact that SQL is flexible in it's syntax, I would not go as far as to say that it is simply a gathering of instructions. Moreover, "to depict in words" does not add any meaning because the alternative would be to depict in, say, pictures. Finally, "work to be done"? Well, maybe. But... Timhowardriley 20:41, 27 April 2007 (UTC)
For example, "a = 0" is a computer program that does not fit the current definition. Timhowardriley 20:51, 27 April 2007 (UTC)
And once and for all, explain to me how "a set of tasks" helps to define what a computer program is. Timhowardriley 20:41, 27 April 2007 (UTC)
BTW, "a collection ... that describes", not "a collection ... that describe." "Collection" is a singular noun and, therefore, requires a plural verb. Timhowardriley 20:41, 27 April 2007 (UTC)

Computer programs must conform to the syntax specified in the programming language.

You mean the source code form of computer programs; there is no such requirement on the executable form.Derek farn 18:25, 27 April 2007 (UTC)
Most programming languages are procedural, meaning each instruction is a step in an algorithm. However, some recently developed programming languages are non-procedural, meaning the computer program consists of a single instruction. (For an example, see SQL.) The single instruction is crafted to tell the computer what to do, not how to do it.
What do you mean by recent? SQL has been around since the 80s. I'm sure that declarative programming have been around since the 60s. Derek farn 18:25, 27 April 2007 (UTC)
I agree. I'll remove the words 'recently developed' and insert 'in source code form' before 'must conform'. Timhowardriley 20:41, 27 April 2007 (UTC)

What are your comments and edits? Timhowardriley 16:45, 27 April 2007 (UTC)

Timhowardriley, if I might make a suggestion. You are obviously keen to make a contribution to Wikipedia, why not channel your energies into creating one or more articles on the many missing topics.
I resent this condescending remark. Timhowardriley 20:41, 27 April 2007 (UTC)
I think it is obvious to those following this thread that you don't have a great deal of knowledge on the topic under discussion and are not a natural author. Yes the article could be improved, as all Wikipedia articles could be. You don't have the expertise or writing skill to improve on the current introduction. Why should we spend time pointing out your rather basic factual mistakes and editing your rather contorted prose? Starting the ball rolling on new articles is a good way to learn more and refine your writing skills. Derek farn 23:03, 27 April 2007 (UTC)
Tim is obviously trying to learn, and he's making an earnest attempt to improve this article at the same time. Rather than brow-beating him, why don't you try providing some guidance. Suggest to him, for instance, some books or websites that would provide him with some good starter information. I'd personally recommend "The Art of Computer Programming, vols. 1 - 3". Or give him some topics he could Google up like "Assembler language", "MIXX", etc. There are even a couple of halfway decent starter articles here on Wikipedia, like Declarative programming, Functional programming, Object-oriented programming, Imperative programming, etc. Some of the content in these articles, though not well-sourced, is fairly accurate and would provide a good starting point for getting past the Introduction of this article, at least. I'll be coming back around this way once I break out some of my old books, and we'll see if I can help you guys whip this article into shape. SqlPac 19:41, 22 May 2007 (UTC)
Computer program is a very broad subject with lots of nuances. Creating a better introduction will be tough (I hope there is an experienced expert out there who will rise to the challenge). Derek farn 18:25, 27 April 2007 (UTC)
A consensus has formed concluding that the current introduction is deficient. I agree with your comments above that my suggestion for the introduction needs refinement. And soon I will submit a refined version for comments. Timhowardriley 20:41, 27 April 2007 (UTC)

[edit] Computer Program Forms (Suggestion v 2.0)

A computer program is written in a human readable form called source code. However, the computer's CPU requires a computer program to be in its machine code form. To get from source code form to machine code form requires one of several methods of transition. The transition method chosen depends upon factors such as the desire for rapid development or the desire for rapid execution. If rapid development is desired, then the source code could be sent to an interpreter. An interpreter would decode the source code on-the-fly and use a machine code translation table to feed the CPU. If rapid execution is desired, then the source code would first be compiled to an object file. The object file would then be linked with other libraries, which are themselves precompiled to object files, and stored in an executable file. On the other hand, a hybrid method of transition from source code to machine code has emerged. Source code is compiled to bytecode; then the resulting file is sent to a virtual machine which feeds the machine code to the CPU. For example, the Java programming language may be compiled to bytecode, stored as a Java Archive File. When the Java computer program is requested, the corresponding bytecode is transmitted to your browser's Java virtual machine for execution.

What are your comments and edits? Timhowardriley 16:45, 27 April 2007 (UTC)

[edit] Computer Program Classes (Suggestion v 2.0)

Computer programs are divided into two classes -- system software and application software. Computer programs written as system software share two significant characteristics. First, they interact with the computer's hardware. This low-level coupling, combined with a logical Application Programming Interface, enables programmers to write hardware-independent computer programs. Collectively, all of the system software constitutes a computer's operating system. The second significant characteristic of system software is that it runs in privileged mode, never being denied access to any computer hardware. The second class of computer programs is application software. Computer programs written as application software collect information from computer users or computer processes. The application software then uses the operating system's Application Programming Interface to access memory, disk drives, and other devices on behalf of the computer user. One school of thought places system utilities, like disk defragmentation software, into the system software class, not the application software class, even though these utilities are peripheral to the operating system.

What are your comments and edits? Timhowardriley 16:42, 27 April 2007 (UTC)

[edit] New introduction (Suggestion v 2.1)

A computer program is one or more instructions that are carried out by a computer. Computer programs, in source code form, must conform to the syntax specified in the programming language. Most programming languages are procedural imperative, meaning each instruction is a step in an algorithm. (For an imperative example, see C.) However, some programming languages are declarative, meaning the computer program consists of a single instruction. The single instruction is crafted to tell the computer what to do, not how to do it. (For a declarative example, see SQL.)

What are your comments and edits? Timhowardriley 08:39, 29 April 2007 (UTC)

[edit] The introduction

There have been a lot of 'new introductions' posted by Timhowardriley, none of which are (imho) better than what we currently have. In fact I do not understand what is wrong with what we currently have. Could someone please explain which bits of the introduction are (a) incorrect or (b) hard to understand (or (c) have some other problem). If there are problems with it then they, of course, need fixing but please let's pinpoint the problems first then work on a solution! --HappyDog 14:59, 30 April 2007 (UTC)

There's a good exchange in the talk heading "Problems with current introduction" above. Also, the section titled "== New introduction (Suggestion v 2.0) ==" has a paragraph dissecting the current definition, pointing out its flaws. But mostly, the article itself was 1) marked for cleanup, 2) marked for rewrite, and 3) marked for abandonment (merged). Timhowardriley 22:57, 30 April 2007 (UTC)
HappyDog I am pleased to hear what you say. Timhowardriley some of the material in the body of the article could do with rewriting and cleaning up. The introduction is of good quality and making it better will be tough. Derek farn 08:32, 1 May 2007 (UTC)

[edit] New introduction (Suggestion v 2.2)

A computer program is one or more instructions that are carried out by a computer. Computer programs, in source code form, must conform to the syntax specified in the programming language. Most programming languages are imperative, meaning each instruction is a step in an algorithm. (For an imperative example, see C.) However, some programming languages are declarative, meaning the computer program consists of a single instruction. The single instruction is crafted to tell the computer what to do, not how to do it. (For a declarative example, see SQL.)

What are your comments and edits? Timhowardriley 22:31, 2 May 2007 (UTC)

A computer program is one or more instructions that are carried out by a computer. 
Not true. NOP is not a computer program.
Sure it is. As is:
NOP
NOP
You are telling the computer to do something. It is doing it. Not entirely useful unless you need to waste a couple of clock cycles for some reason, and does not apparently have any code to return to the O/S, but it is a simple (though admittedly useless) program. SqlPac 03:30, 22 May 2007 (UTC)
Yes, but by that argument any random string of bytes is a program. Perhaps one that crashes the computer, maybe printing some garbage to the screen first if you're lucky, but still a program. Surely that's the same that a random heap of bricks is a house? --HappyDog 04:45, 22 May 2007 (UTC)
Any "random string of bytes" that contains valid machine-level instructions could be considered a program if the computer can execute it. This is why modern processor architectures evolved to try to keep data and programs separate. On a 65xx processor, or even the 8080/Z-80 series, data and application bytes were not separated in any way (no Data Segments, etc.) In fact, as has been highly publicized everytime Microsoft releases a service pack, people shove valid machine-level instructions into data all the time and try to make remote computers run it using a variety of methods.
So to answer your question, if you want to throw a "random heap of bricks" on a piece of land and decide to live underneath it, yes you can call it your "house" if you like. I might not want to live there, but if that's where you choose to live, then so be it. Bottom line is that there is nothing "magical" about data, and the only thing that separates "data" from "instructions" is a "Chinese wall" so to speak, built into the processor. If you were running at the appropriate privelege level, there is no reason you could not JMP into the middle of a JPEG image stored in memory somewhere. The computer would merrily hum along until it hits instructions it doesn't recognize or encounters some other fault (bad memory address, etc.) But it will execute any and all instructions it encounters.
You are trying to define a "program" in terms of doing "useful" work or "useful" output. That's a *very* slippery slope to go down, since what you consider "useful" work/output someone else might consider completely "useless". SqlPac 19:58, 22 May 2007 (UTC)
What's NOP? No operation? Isn't that a filler instruction to wait for a device? If so, then that would qualify as a computer program in assembly language form. Timhowardriley 19:15, 3 May 2007 (UTC)
NOP is Assembler Language (x86-series, Z-80, and I believe even 65xx-series) for No Operation. Basically an instruction to waste a clock cycle or two, which is occasionally necessary. SqlPac 03:30, 22 May 2007 (UTC)
Quote: "Isn't that a filler instruction to wait for a device?" HappyDog's Verdict - not qualified to write on this subject. --HappyDog 00:53, 4 May 2007 (UTC)
Quote: "not qualified to write on this subject." Not true. Just because someone doesn't know what a rarely used archaic Assembler Language instruction does, that does not make him/her "not qualified" to write about programming. Even people who know the intricacies of ROL and BIT instructions are going to have different levels of knowledge. That doesn't make any one of them less qualified than others to write about programming. SqlPac 03:35, 22 May 2007 (UTC)
Just because someone doesn't know what a rarely used archaic Assembler Language instruction doesn't mean they don't know how to use Google. That was my main point. To say "I don't know what this is" but then to go on and base an argument on your guesswork (when NOP is just a four keystrokes away) does not sound like someone qualified to write about a technical subject which, as you have already pointed out, even an expert is likely to need to do some research if they are going to cover all the bases. --HappyDog 04:45, 22 May 2007 (UTC)
And my point is that not everyone has the same set of skills, knowledge, or experience. It seems to me that Tim is attempting to learn by doing, and I personally think it would be a much better experience for everyone here if the more experienced people helped out by providing guidance rather than criticisms. Just my personal opinion, however, and it's worth exactly what you paid for it :) Personally I think it's great that he's actually excited enough about this particular topic to want to go in and make the article better. And I think we could do better in providing some starting points for him to begin his research. SqlPac 20:04, 22 May 2007 (UTC)
Computer programs, in source code form, must conform to the syntax specified in the programming language.
Why is this in the second sentence? In fact, I doubt it's important or enlightening enough to be in the intro at all.
It's a transition sentence to change the subject from computer program to the more general subject of programming languages. Timhowardriley 19:15, 3 May 2007 (UTC)
The more general subject of programming languages is better covered by the more general subject of programming languages, rather than the more specific subject of computer programs. --HappyDog 00:53, 4 May 2007 (UTC)
Most programming languages are imperative, 
Most? This kind of statement needs a citation.
OK. But I can think of a dozen languages that are procedural and only one that is non-procedural. A simple edit could fix this. Timhowardriley 19:15, 3 May 2007 (UTC)
Well, if you can only think of one, then perhaps we should say that there is only one. Is that one SQL, by any chance? --HappyDog 00:53, 4 May 2007 (UTC)
meaning each instruction is a step in an algorithm. (For an imperative example, see C.) 
Not true. A single step in the algorithm may require many instructions to be carried out. For example, try getting the square root of x in assembly language.
True. One instruction in the source code form gets converted to many instructions in the assembly form. This transformation process is explained in a subsequent paragraph. Timhowardriley 19:15, 3 May 2007 (UTC)
Sometimes, the source (believe it or not!) is in assembly language. HappyDog's Verdict - not qualified to write on this subject. --HappyDog 00:53, 4 May 2007 (UTC)
However, some programming languages are declarative, meaning the computer program
consists of a single instruction. The single instruction is crafted to tell the computer what to do, not how to do it. 
Completely false.
Please explain the flaw. Here's a single instruction that the interpreter has lots of leeway in deciding how best to fetch the answer: select salary from database where name = "Derek"; Timhowardriley 19:15, 3 May 2007 (UTC)
Here is a trivial example in Prolog, which is more than a single instruction:
sibling(X, Y)      :- parent_child(Z, X), parent_child(Z, Y).
parent_child(X, Y) :- father_child(X, Y).
parent_child(X, Y) :- mother_child(X, Y).
mother_child(trude, sally).
father_child(tom, sally).
father_child(tom, erica).
father_child(mike, tom).
If this is a 'single instruction' (bearing in mind that in a declarative language, the term 'instruction' is somewhat meaningless) then single_instruction == single_program. --HappyDog 00:53, 4 May 2007 (UTC)
(For a declarative example, see SQL.)
As detailed above, SQL is not declarative (although it contains some declarative elements). It is also debatable as to whether it is a programming language, and for this reason should not even be mentioned in the introduction.
How is it not a programming language? It has a grammar so it's a language. It runs in an interpreter like other computer programs. To be honest with you, declarative vs. imperative is new to me. Is the distinguishing characteristic whether or not the program tells the interpreter *how* to do the work? Timhowardriley 19:15, 3 May 2007 (UTC)
Language != programming language, although I retract the 'not a declarative language' statement. However, there is sufficient disagreement about this to avoid mentioning it so strongly in the first paragraph, imho.
Quote: "declarative vs. imperative is new to me." HappyDog's Verdict - not qualified to write on this subject. --HappyDog 00:53, 4 May 2007 (UTC)
In general - you have missed out several important points in the current intro, have expressed the remaining points less well and added some irrelevant and incorrect information. You have compressed the current 'friendly' intro into a single daunting block of text, which reads like "here is a list of things what I know about computer programs". Most importantly, you have still not explained what is wrong with the existing intro. Please do not bother posting any more suggestions for improvements until you have bullet-pointed the errors/omissions/ambiguities in the current intro.
--HappyDog 08:53, 3 May 2007 (UTC)
I will ignore the incendiary tone of your request. But to your point that I have not explained what is wrong with the existing intro, the following is a cut-and-paste of my previous post: If a computer program is the current definition, "a collection of instructions that describe a task, or set of tasks, to be carried out by a computer", and since "collection" means, "to gather", and since "describe" means "to depict in words", and since "task" means "work to be done", then you would have to agree that a computer program is a "gathering of instructions that depicts in words work to be done, or a set of works to be done, to be carried out by a computer." Is this really what you mean for the definition of a computer program? In spite the fact that SQL is flexible in it's syntax, I would not go as far as to say that it is simply a gathering of instructions. Moreover, "to depict in words" does not add any meaning because the alternative would be to depict in, say, pictures. Finally, "work to be done"? Well, maybe. But... Timhowardriley 19:15, 3 May 2007 (UTC)
Given the phrase "time flies like an arrow", since "time" means "measure the duration of", and since "flies" means "a group of insects", and since "like" means "in the same manner as" then you would have to agree that we should "measure the duration of a group of insects in the same manner as one would measure an arrow". Please raise your hand if you don't get the rather crass allusion. --HappyDog 00:53, 4 May 2007 (UTC)
Also, here is a cut-and-paste of my questioning the second sentence: "Computer programs are also known as ..." A list of synonyms should follow. However, what follows is a list which combines synonyms (software), classes (system vs. application), and nonsense (programs): "Computer programs are also known as programs" Timhowardriley 19:15, 3 May 2007 (UTC)
This point is worthy of consideration - the sentence could maybe be worked on. However, these are all names that are used to describe computer programs, and (to be honest) how you classify the programs is not that relevant here. In the introduction we should include the most common names that are used to describe computer programs, for people who have been redirected to this article. If the delineation between classes of program is important then it should have a separate section in the body of the article where the distinction is made clear. In my opinion, this sentence is neither incorrect, nor misleading (though it may be incomplete). Remember: (apples = fruit) != (fruit = apples) --HappyDog 00:53, 4 May 2007 (UTC)
In the many threads above this one, I have asked many questions that have remained unanswered. Like, how does "a set of tasks" help to define what a computer program is? Timhowardriley 19:15, 3 May 2007 (UTC)
Because a program may not simply carry out a single task. In fact, nowadays most programs carry out many tasks [1]. --HappyDog 00:53, 4 May 2007 (UTC)
Most importantly, the current article is not understandable. It does not clearly express computer program for both experts and non-experts in appropriate detail. Nor does it thoroughly explore and explain the subject. The subject should include the different states (forms) of computer programs, how computer programs transition to the different states, and the two classes of computer programs. This is where I believe I have added value. Timhowardriley 19:15, 3 May 2007 (UTC)
We're talking about the introduction here. I agree that the body of the article has many problems and needs a lot of work, but the points you raise are not relevant to the introduction. --HappyDog 00:53, 4 May 2007 (UTC)

[edit] Civility in Professional Communication

Regarding the exchange that went as follows:

Not true. NOP is not a computer program.
What's NOP? No operation? Isn't that a filler instruction to wait for a device? If so, then that would qualify as a computer program in assembly language form. Timhowardriley 19:15, 3 May 2007 (UTC)
Quote: "Isn't that a filler instruction to wait for a device?" HappyDog's Verdict - not qualified to write on this subject. --HappyDog 00:53, 4 May 2007 (UTC

Regarding the exchange that went as follows:

Not true. A single step in the algorithm may require many instructions to be carried out. For example, try getting the square root of x in assembly language.
True. One instruction in the source code form gets converted to many instructions in the assembly form. This transformation process is explained in a subsequent paragraph. Timhowardriley 19:15, 3 May 2007 (UTC)
Sometimes, the source (believe it or not!) is in assembly language. HappyDog's Verdict - not qualified to write on this subject. --HappyDog 00:53, 4 May 2007 (UTC)

Regarding the exchange that went as follows:

As detailed above, SQL is not declarative (although it contains some declarative elements). It is also debatable as to whether it is a programming language, and for this reason should not even be mentioned in the introduction.
How is it not a programming language? It has a grammar so it's a language. It runs in an interpreter like other computer programs. To be honest with you, declarative vs. imperative is new to me. Is the distinguishing characteristic whether or not the program tells the interpreter *how* to do the work? Timhowardriley 19:15, 3 May 2007 (UTC)
Language != programming language, although I retract the 'not a declarative language' statement. However, there is sufficient disagreement about this to avoid mentioning it so strongly in the first paragraph, imho. Quote: "declarative vs. imperative is new to me." HappyDog's Verdict - not qualified to write on this subject. --HappyDog 00:53, 4 May 2007 (UTC)

As quoted in WP:CIV:

Civility is a code for the conduct of editing and writing edit summaries, comments, and talk page discussions on all Wikipedias. Whereas incivility is roughly defined as personally targeted behavior that causes an atmosphere of greater conflict and stress, our code of civility states plainly that people must act with civility toward one another.

Our Wikipedia community has by experience developed an informal hierarchy of core principles — the most important being that articles be written with a neutral point of view. After that we request a reasonable degree of civility towards others. "Civility" is the only principle that we can apply to online conduct, and it's the only reasonable way to delimit acceptable conduct from the unacceptable. We cannot always expect people to love, honor, obey, or even respect one another. But we have every right to demand civility. Timhowardriley 16:43, 4 May 2007 (UTC)

I apologise. I didn't meant to offend. However, it is of my opinion, based purely on your postings on this page, that you do not have enough knowledge about this subject to rewrite the introduction (which didn't get to its current state by accident, by the way). There is nothing wrong with that - if we all knew everything there would be no point writing this encyclopedia! Regarding your mini-essay - as a user and editor of Wikipedia since 2003, I am well aware of the principles, and also how they grew into what we have now. I think I am more guilty of biting the newcomer than incivilty, but I apologise if my comments were taken the wrong way. --HappyDog 17:55, 8 May 2007 (UTC)
Accepted. However, one author's opinion of another author's knowledge-level is immaterial, if we are to get along in the Wikipedia sand-box. Whereas it is important to present flaws in arguments, it is personal to present flaws in people. We should take a cue from one of the most contentious sand-boxes on this planet -- the U.S. Congress. "To my dear friend and distinguished colleague from the great state of California, your arguments are FUBAR." Timhowardriley 17:01, 9 May 2007 (UTC)

[edit] Computer program is a collection of instructions?

According to Wikipedia:The perfect article, "A perfect Wikipedia article is understandable; it is clearly expressed for both experts and non-experts in appropriate detail, and thoroughly explores and explains the subject." (Emphasis added.) Moreover, my Business Communications professor said that a well written business report is written at the eighth-grade level. (That is, the sentences are structured simply enough for an eighth-grader to parse.) So, assume that an eighth-grader is writing a report on computer programs. Explain to this eighth-grade student why a computer program is a collection (a gathering, like eggs in a basket) of instructions (which defies intuition), and not a sequence of instructions (which is confirmed by intuition). Remember not to violate the scenario that a computer program could be in its assembly language form, within the context of the program counter. Timhowardriley 21:03, 9 May 2007 (UTC)

Because 'sequence' implies an order. Assume A-B-C-D-E-F is a program. To state that a program is 'a sequence of instructions' implies that B-D-F-C-E-A is a (functionally) different program, which is not necessarily the case. The order of the instructions may not matter, and using the word 'sequence' implies that it does. --HappyDog 01:15, 10 May 2007 (UTC)
So you are indicating that since A-B-C-D-E-F potentially produces the same results as B-D-F-C-E-A, they are in fact one and the same program. The discussion, however, is not whether two pieces of code that produce the same result are in fact the same program; although we can discuss that as well with the same collection of instructions listed twice:
program A-B-C-D-E-F
int i;
int j;
i = 0;          // A
j = 100;        // B
j = i * 20;     // C
j = j / 5;      // D 
i = j + 8;      // E
i = j * 10;     // F
Result: i == 0, j = 0
program B-D-F-C-E-A
int i;
int j;
j = 100;        // B
j = j / 5;      // D 
i = j * 10;     // F
j = i * 20;     // C
i = j + 8;      // E
i = 0;          // A
Result: i == 0, j == 4000
But let's take it a step further. We'll add a new program to the mix.
program G-H
int i;
int j;
i = 0;    // G
j = 4080; // H
These two programs produce the same exact same result, so does that mean that program B-D-F-C-E-A is the same program as program G-H?
But let's assume that these collections of instructions are executed in random order as has been stated. What are the results of the first or second program on any given run? If the instructions are executed randomly, in no specific order, we can expect different results every time the programs are run, correct? SqlPac 01:37, 25 May 2007 (UTC)
You have a point here. But this point is hair-splitting on whether or not "sequence" is the best noun to use to help define what a computer program is. However, my challenge to the authors is to explain to an eighth-grader why "collection" is the best noun to use to help define what a computer program is. Keep in mind that one "collects" stamps. Timhowardriley 18:12, 10 May 2007 (UTC)
"Collection" is the best word to use if a computer executes its statements in a random order, in which case you should never expect to receive the same results twice on any given run of the program. Here's an explanation even an 8th grader will understand: "the computer pulls instructions from your program randomly, like pulling tiles out of a Scrabble bag, and executes whichever one it retrieves at any given time." You might want to discuss among yourselves the finer points of whether the word should be "randomly" or "pseudo-randomly". SqlPac 01:37, 25 May 2007 (UTC)

The bottom line is that for a "collection" order is unimportant. The question is this: "Is the order of instructions in a computer program unimportant?" If so, then it needs to be stated plainly in the article that "The order of instructions in a computer program is unimportant." It would also be nice to have a reference for that statement. It doesn't get any simpler than that, folks. Really. SqlPac 01:53, 25 May 2007 (UTC)

[edit] Forming a definition of computer program

The first sentence in the computer program article is its definition, as it should be. What is a definition? What's the difference between the definition of computer program and the characteristics of computer program?

Vaguely speaking, a definition is the meaning of a word/term. But now we have to define "meaning". So, rather than getting too nuanced, I propose to use the meaning of definition that I learned from my Business Communications professor. (I am creating a Stipulative definition here.) A definition of a word/term is its super-category plus the minimum characteristics to make it unique. As examples: A dog is a canine that barks. A cat is a feline that purrs.

You know you have a good definition if you reverse the subject with the predicate and it still holds true. As examples: A canine that barks can only be a dog. A feline that purrs can only be a cat. You know you have a bad definition if there's ambiguity. For example: A dog is a canine with fur. Reversed: A canine with fur can only be a dog, is false -- a fox is also a canine with fur. Notice that there can be more that one good definition for a single word/term. As examples: A dog is a canine that barks. A dog is a canine that has been domesticated.

A good definition will allow you to substitute the definition for the word and still make sense. For example: A {canine that has been domesticated} let me pet her. A {canine that barks} let me pet him. For those of you fimiliar with MACROs, this should ring a bell.

Notice that the definition does not have to contain all of the word/term's characteristics. A concise definition only needs to contain the minimum characteristics that make it unique. For example: A dog is a canine that barks and has been domesticated. This is a true statement and will reverse and substitute correctly. However, this definition is not concise. Being concise means that if you take away any words, it will lose its meaning. Not being concise means that you can take away some words and not lose its meaning. In this case, you can take away either "that barks" or "has been domesticated" and still mean a dog.

So, the definition of a computer program need not contain all of the characteristics of a computer program. To form a definition, we first need to identify its super-category. Then we need to decide on any uniquely distinguishing characteristic. When we are finished, the definition of computer program can be substituted for computer program in a sentence and still make sense. Timhowardriley 19:36, 10 May 2007 (UTC)

Tim - Can I ask what you are trying to achieve with all this? Your examples are a bit rubbish - for example, a lion may purr and wolves may bark. Your arguments seem to be semantic with no real relevance to the content of the article. For example, re: your comment above about use of the word 'collection':
Given the phrase "time flies like an arrow", since "time" means 
"measure the duration of", and since "flies" means "a group of insects", 
and since "like" means "in the same manner as" then you would have to 
agree that we should "measure the duration of a group of insects in the 
same manner as one would measure an arrow". 
I thought you might have understood this comment the last time I posted it, but clearly not.
--HappyDog 03:45, 11 May 2007 (UTC)

[edit] Request For Comments

Please post any comments regarding the improvement or rewrite of this article. Timhowardriley 22:31, 18 May 2007 (UTC)

dear Tim, based on what I've read so far of the discussion, I would agree with User:HappyDog. The argument about the 8th grader is unconvincing, as in my opinion if a 8th grader cannot grasp the abstract meaning of a 'collection', he surely missed a bunch of Math class since a collection or set are a very fundamental abstraction in Math. I also concur with HappyDog that one cannot dissects a sentence word by word and hope to grasp the full and precise meaning of the whole.
That being said, thanks for your Request For Comment, but, altough I write 'programs' in my sleep, I do not have the literary talent to explain in simple and clear words what it is to a neophyte audience. Shmget 01:30, 22 May 2007 (UTC)
As opposed to all the criticisms I keep seeing on this page, how about pointing Tim to some valid resources he can use to begin his research, Shmget? It probably would have taken you about 1/2 the time to type in a couple of book titles and/or Web addresses rather than your assessment of Tim's knowledge of math. SqlPac 20:08, 22 May 2007 (UTC)
Let me apologize for the characterization of your quote, Shmget. I misread your statement. I do think it would be more constructive to offer objective advice though.
That being said, to Timhowardriley, while what your professor said might be true, don't think of these articles as business reports. These articles aren't structured like business reports, and are supposed to be as objective as possible; unlike most business reports which are often designed to convey a particular point of view (either "the company is doing great", or "the company might be going downhill, but it's not our fault"). The only similarities between these articles and business reports, AFAIC, is that they both use words and images to communicate information. That's about where the similarities end. Thanks. SqlPac 00:35, 23 May 2007 (UTC)
I got your request for comments on my talk page, and I have a couple of items that jumped out at me:
  1. You might want to add information about the history of computer programming (I don't think it would have to be all-inclusive since it's probably covered in detail in other articles, but a good overview would help).
  2. You definitely need to add references.
  3. You might add discussion of the types of abstractions used in computer programming (machine code, low-level languages, high-level languages, object-oriented programming, functional programming, declarative programming).
  4. Eliminate the Trivia section.
I'll break out Knuth's TAOCP and make some contributions to your article when I get a chance. SqlPac 03:20, 22 May 2007 (UTC)

[edit] A couple of things

Here's a few definitions to get you started.

  • Imperative programming = a programming method which uses statements that change a program's state. Imperative programs are an explicit sequence of commands for the computer to perform in an orderly fashion. Simply put - You specify the end result, and you tell the computer how to get there step-by-step. Cab driver analogy: Get in cab. Tell driver turn left at light, drive 3 miles, turn right onto interstate, drive 5 miles, get off at exit, stop at airport.
    • Procedural programming = an implementation of imperative programming, often used as a synonym for imperative programming.
  • Declarative programming = a programming method in which statements or queries are used to define problems in terms of the desired results, leaving the implementation details of the required algorithm up to supporting software. Simply put - you specify the end result, and let the supporting software decide the best way to accomplish those results. Cab driver analogy: Get in cab. Tell him to take you to the airport, and trust that he knows the best route.
    • Functional programming = a declarative programming model in which problems are defined in terms of mathematical functions.
    • Logic programming = a declarative programming model which uses a formalized logical notation to define problems.
    • Constraint programming = a declarative programming model which defines problems in terms of the relations between variables.

Like I said, when I get a chance I'll break out TAOCP and see what the Man has to say on the topic. SqlPac 04:08, 22 May 2007 (UTC)

[edit] Intro

Re-wrote the intro, provided a formal definition of computer program from The Master himself, along with references. Also added a section defining computational methods and their relationship to algorithms. Feel free to make changes (please source), and modify the rest of the article as needed. I also eliminated the Trivia section. Thanks. SqlPac 01:47, 23 May 2007 (UTC)

I would say that the next section (apart from possibly making my meager contributions easier to understand), would be to provide information about program development, etc. Information such as the tools of the trade (i.e., flowcharts, pseudo-code, UML, various diagrams, etc.) might be in order. The Computer programming article also has a pretty good, well-sourced, history of computer programming which we could do well to take a look at. Thanks. SqlPac 02:08, 23 May 2007 (UTC)


In my opinion, the problem the new intro has over the previous one is that it is much less comprehensible to a lay-person. I suspect that someone who knows nothing about computers and wants to know what a computer program is would read the first sentence and then leave, none the wiser. The previous version, whilst not necessarily a complete definition, was, I think, an accurate one, and a lot more friendly to newcomers. I am going to try a new edit that incorporates both of them - let me know what you think... --HappyDog 08:55, 23 May 2007 (UTC)
Good work Happy. While we need to keep the formal definitions, I think adding the user-friendly definition helps make the intro a little easier to understand for a layperson. Thanks. SqlPac 11:39, 23 May 2007 (UTC)

[edit] Copyedit

Quuxplusone thanks for the copy-editing. I like what you've done so far, but I have one minor clarification. You changed a sentence in the intro to read "Computer programs, also known as software, may be categorized along functional lines". Technically computer programs encompass both software and firmware. Is this a distinction we want to make, or do we want to classify firmware as a subset of software (as is this case with this wording)? Thanks. SqlPac 02:44, 23 May 2007 (UTC)

My understanding is that firmware is a subset of software. Hardware is real, tangible items (transistors, chips, wires, etc. up to monitors, speakers, and so on) whereas software is simply bit-polarity (whether on a disk, RAM chip or EPROM). The analogy is that a book is hardware, whilst words on the page are software, whether they're in easily erasable pencil, or water-resistant ink. --HappyDog 09:01, 23 May 2007 (UTC)
My understanding, which may be extremely Old School, is that software consists of programs that must be loaded into memory from some separate storage medium like floppy disks, or hard disk drives; while firmware consists of programs that are embedded in the hardware. Of course that definition is from back in the day before we had EEPROMS or DVD-R, so the lines may have blurred since then. SqlPac 11:37, 23 May 2007 (UTC)

[edit] Knuth's Definition

If we're going to change Knuth's definition of a program: "the expression of a computational method in a precisely defined computer language", we're going to need a couple of things:

  1. A better definition
  2. A VERY, VERY good source, preferably one that is better than one of the 12 greatest scientific monographs of the 20th century (right up there with Einstein's works)

I like that you've added explanation to the formal definition, but the formal definition is exactly that -- a formal definition. As for a computer language being "precisely defined", I've yet to see one that's not. Note that "precisely defined" is *not* the same thing as highly structured or extremely rigid. Personally I'll put my money on Knuth's definitions until I see better definitions that are well-sourced. Thanks. SqlPac 11:37, 23 May 2007 (UTC)

Derek farn, the three examples of languages you provided (Perl, PHP, BASIC) are all "precisely defined" languages. They all have formal grammars defined for them, and they all have statements and operators that are designed to behave in specific ways. As for the computational method, it is not an OO-specific term. As described in the article, it is a precise term for a superset of algorithms that do not necessarily have to conform to the algorithmic principle of finiteness. As mentioned, if you want to dumb down the formal definition, please source it with a better source than Knuth. SqlPac 19:56, 23 May 2007 (UTC)
BTW, Derek farn, just to get past this hurdle so we can stop arguing style and improve the actual substance of the article, and to avoid an edit war, I would be willing to post an RfC to the Computer Science WikiProject and abide by a consensus reached there as to the validity of Knuth's definition. Just let me know if that would be acceptable to you. SqlPac 23:37, 23 May 2007 (UTC)

[edit] Precise definitions needed

This is in response to the message you posted on my talk page. I think it would be better to resolve this issue here on the article talk page, so that we can all reach consensus; so I'm reposting your question and my response here:

I think the topic of our discussion is sufficiently far off the subject of this article that we ought to resolve it ourselves before reporting back the results here. Derek farn 02:16, 24 May 2007 (UTC)

Please point me at the precise definitions of Perl and PHP. There are plenty of imprecise ones around. Talking of precise definitions, what is the precise C or C++ definition of the expression (i=i++) (the behavior is specified to be undefined by the language standards, is undefined an acceptable answer for a language to be precisely defined?) Derek farn 21:25, 23 May 2007 (UTC)

The precise definition of a PHP implementation is at [[1]]. The precise definition of a Perl implementation is at [[2]]. The precise definition of a C++ implementation is at [[3]]. A precisely-defined computer language is not the same thing as a generic definition for all implementations of that language. As you alluded to, the expression (i=i++) has a specific definition for each implementation of the language. Therefore, no matter how many times I use (i=i++) in Visual C++ 7.1, I can expect a precisely defined set of rules to kick in, which will operate in exactly the same way every single time. No matter how many times I use (i=i++) in Turbo C++, I can expect a precisely defined set of rules to kick in, which will operate in exactly the same way every single time. Further, the fact that you used the ++ operator indicates that it is a precisely-defined operator. The fact that you used the = operator indicates that it is precisely-defined. The parentheses appear to be part of the language as well, and we could probably locate where they are defined in the language as well.
You have shown no undefined behavior; only behavior that is implementation-defined. Further, even if a specific implementation of C++ threw a compile-time exception when it encountered (i=i++), it is part of the precise definition.
You could not effectively program in a computer language that was not precisely defined. A computer language that was not precisely defined would have no way to know what your intent was; it therefore could not carry out your instructions.
Finally, Dr. Knuth's TAOCP has been the subject of nearly 40 years of intensive peer review and academic scrutiny. The fact that TAOCP has been named one of the 12 greatest scientific monographs of the past 100 years aside, if you want to challenge his definition of computer program, I'd recommend bringing some heavier firepower than not all implementations of a specific language follow the ANSI standard; therefore none of them are precisely defined by anyone.
Hope that helps. SqlPac 23:24, 23 May 2007 (UTC)

[edit] First non-experts then experts

Our mandate is to clearly express for both experts and non-experts in appropriate detail, and to thoroughly explore and explain, computer programs. The article should start by satisfying a non-expert's expectation at the same time not being so oversimplified as to turn off experts. I believe dictionary.com's definition achieves this goal. This definition is explainable even to declarative language programmers if you consider that every character in the source code is an instruction. After covering computer programs for non-experts, we should satisfy experts' expectations by adding details and nuances. Timhowardriley 17:30, 23 May 2007 (UTC)

IMHO, it is best to start with the precise formal definitions and then translate them to laymen's terms rather than starting out with oversimplified definitions and trying to complicate them. Just my opinion, however. Personally I think the simple lead sentence, or something like the one from Dictionary.com, followed by the properly-sourced formal definition works well.SqlPac 19:46, 23 May 2007 (UTC)
BTW, I don't know that collection is the best word in the informal definition. A collection might be unordered, whereas the instructions in a program are ordered in some fashion. Perhaps a word that conveys the order, such as sequence, ordered collection, or some such would be better? Just my opinion. SqlPac 23:27, 23 May 2007 (UTC)
The ordering is not necessarily relevant when talking about source code. Often it is, but not always. For example, I would say the following two pieces of code could be considered to be the same program: a=5; b=6; print(a+b); and b=6; a=5; print(b+a);. Of course, the print statement needs to come last, but the point is that although the order has some relevance, it can be modified without affecting the results. Or how about print("file1") >> file1; print("file2") >> file2; print("file3") >> file3;. The lines in this program can be in any order you like... --HappyDog 11:39, 24 May 2007 (UTC)
b=6;print(b+a);a=5;.
Rearranging the order of steps in an algorithm might produce the same output; however, the instructions fed to the computer are ordered and executed in a specific order, even in the examples you gave. Let's not confuse whether two different algorithms produce the same result with the fact that a computer executes instructions in sequence. The computer does not randomly pull the next instruction to execute out of a hat. The instructions are executed in an ordered sequence. Whether the order you fed them into the computer is correct or not to accomplish the goals of the algorithm (GIGO) is irrelevant. SqlPac 17:30, 24 May 2007 (UTC)
Well put. Timhowardriley 22:31, 24 May 2007 (UTC)
Except that you ignored the important qualification: the print statement needs to come last. If you took my other example, then yes, the statements could be ordered randomly. Of course, I never stated that this is what actually happens - that the computer randomly executes the statements in a different order each time. However this simple computer program as a source file can have its lines rearranged in any order you like. I also never claimed this was true for all programs - my point was that the use of the word 'sequence' to imply ordering is incorrect, as there are situations where the order does not matter. In C, the order of function definitions does not matter, in SQL (in a lot of instances - and let's not quibble over the exceptions) the order of the individual statements doesn't matter. In most languages that do not use explicit line numbers (and in fact, even in some that do), there is some level of granularity at which the order does not matter. --HappyDog 07:43, 25 May 2007 (UTC)
And reagrding run-time out-of-order, see OpenMP for example. - Shmget 08:43, 25 May 2007 (UTC)
Except that you ignored the important qualification: the print statement needs to come last. This sounds like an admission that the computer processes instructions given to it in a given order, as the print statement needs to come last. Does that sound about right to you? Or is it better stated that the computer randomly performs all statements, except print in random order? As for OpenMP, I don't see any indication that randomized processing of instructions fed to the computer is specified. In fact, the graphic provided with the article seems to indicate that the instructions are processed in a specific order, in parallel. Unless, of course, parallel processing == random processing. SqlPac 16:29, 25 May 2007 (UTC)
Please re-read the third sentence in my previous comment. That is more of an admission! :-) I gave two examples where statements may be re-ordered without affecting the output of the program. In the first, only some statements could be re-ordered, in the second the whole program could be re-ordered. At no point did I claim that execution order was random. At no point did I claim that all programs can be rearranged in this way. The purpose of the examples was to show that there are some programs (and I would posit that if you increase the level of granularity to more than a single statement, it's a lot of programs) can have their code rearranged without the output being affected. Therefore any definition that states the instructions must be in a strict order is incorrect. --HappyDog 17:21, 27 May 2007 (UTC)
Computer program source code is composed of instructions given in a specific order. Compiled, assembled, or interpreted code is executed by the computer in an order as well (the order may be sequential, or it may be controlled by external forces like the O/S, but the execution is ordered). Looking at your examples from a different point of view, and working under the assumption that two programs with either:
  • different instructions specified in both programs, or
  • the same instructions specified in different orders
Then the examples you gave would in fact be different programs. The core of your argument seems to be that two programs that produce the same output are the same program? Stating that two programs that produce the same output are in fact the same program seems a strange argument. Does this mean a program that implements a Bubble Sort is the same program as one that implements a Quick Sort, if the same output is produced when the same collection of names is passed in? If I have not stated your position correctly, then we can probably resolve this very quickly if you'll provide your definition of what makes any two given programs different from one another? SqlPac 20:34, 27 May 2007 (UTC)
Who is to say that a program is a set of assembly language instructions? Who is to say that assembly language is the lowest level that needs to be considered? Modern cpus map instructions to a variety of operations (ie, microcode) some of which can be performed in parallel. Many of the people driving the current discussion seem to have a very narrow idea of what constitutes a program. Programming languages are not precisely defined (although different implementations of a language may be precisely defined in different ways) and programs are often not sequences of instructions. Derek farn 22:40, 24 May 2007 (UTC)
So your argument is "Parallel execution = random execution"? I'm not saying a sequence of assembly language instructions os the lowest level that needs to be considered. In fact, you seem to be the one stuck on implementation details. Is it possible that processors or machines that execute instructions in parallel might still be executing those instructions in a sequence; or does parallel execution mean totally randomized order of execution? If that is the case you should expect different results every time you run the same program. SqlPac 23:47, 24 May 2007 (UTC)
That is a Strawman. For "are ordered and executed in a specific order," to be false, there is no need for "Parallel execution = random execution" to be true. In real life, especially with the generalization of multi-core, and the fact that almost all O.S now-a-day are preemptive multi-task, the execution of the code of a program is less and lees executed in a 'specific' order. Actually, among the most nasty bugs to find are synchronizations bugs that show up often in a very unpredictable fashion, for the very reason that programs do not unfold instruction in 'precise order'. Not to mention 'signal' processing....
For "are ordered and executed in a specific order," to be false, there is no need for "Parallel execution = random execution" to be true. In this sentence you have taken a logical leap. I did not say the order the programmer specifies for a set of instructions is the exact same order that the computer chooses to execute them in, though many here seem to be stuck on that. Anyone with ten minutes of experience with a C++ compiler knows that the many compilers can re-arrange and change the order of the compiled instructions for optimization purposes. Even in a preemptive multi-task environment, the code is executed in *some* order; whether it is sequential order, or an order applied by some external factor like the operating system. But regardless, you can place whatever you feel like placing on this page. For clarification purposes, please qualify the word collection with an adjective like unordered to make it clear that the order in which the computer executes the instructions in a program is unimportant. And source it. Too easy. SqlPac 16:29, 25 May 2007 (UTC)
At the lowest level, in a given function of a given thread we still have a very high level of sequentiality, but that is not accurate at the level of a program.
I'm not thrilled with 'collection', I think I would prefer 'set' which, in my mind, is more neutral, but the notion of sequential, here, is very misleading. - Shmget 02:03, 25 May 2007 (UTC)
A set is an unordered collection as well. SqlPac 16:29, 25 May 2007 (UTC)
In my view, set and collection are interchangeable in this context. Both have the same meaning to a lay-person, and both have an additional mathematical meaning which does not hold if applied to this sentence. Does anyone genuinely think that someone who is aware of the mathematical definition will read this and deduce that the instructions are necessarily unordered? Or are they more likely to (a) infer that the more general definition is being used or (b) note the ambiguity and read on for clarification. I do not think that it will cause as much confusion as people think! --HappyDog 07:43, 25 May 2007 (UTC)
Does anyone genuinely think that someone who is aware of the mathematical definition will read this and deduce that the instructions are necessarily unordered? The word collection implies disorder, even to non-mathematicians. Consider the Random House Unabridged Dictionary, which lists the following synonyms for collection: accumulation, aggregation, mass, heap, pile, hoard, store. Perhaps the word collection should be replaced with the word pile or mass to clarify the position that order is unimportant? SqlPac 16:37, 25 May 2007 (UTC)
I have a DVD collection. I can choose to keep it in alphabetical order, or to leave it unordered. Either way it is a collection. I don't think most people would make an assumption that my collection is in order, or that it is not in order - just that there is a collection of DVDs. --HappyDog 17:21, 27 May 2007 (UTC)
Ahhh, so the idea you are trying to convey to readers is that they can rearrange any given program—putting the instructions in alphabetical order, making them unordered, or placing them in any other order—and like your DVD collection it won't affect a thing. This would come in handy if you are planning to search for specific instructions in a program, in which case writing all the instructions of your programs in alphabetical order does makes sense, to make your programs better parallel your DVD collection. SqlPac 20:51, 27 May 2007 (UTC)
Just to clarify, I don't mind 'collection'. I find 'set' a bit more natural to ME, but 'collection' will do just fine. that being said, I am a bit more set (not pun intended) against the qualification of 'sequential' - Shmget 08:43, 25 May 2007 (UTC)
I agree. --HappyDog 17:21, 27 May 2007 (UTC)
I agree, so long as it's made clear in the article that putting the instructions of your programs in alphabetical order, reverse alphabetical order, or totally random order, appears to have no affect on the program. A comparison of a computer program to a set of DVDs in the article would thoroughly clarify this position. SqlPac 20:51, 27 May 2007 (UTC)

[edit] RfC

I've posted an RfC at [4] concerning the formal definition of computer program. Let's see if Knuth's work can withstand the "creation of reality by consensus". SqlPac 02:32, 24 May 2007 (UTC)

[edit] Software Speciation

Before declarative programming, instruction pipelining, and parallel computing, I suspect that computer programmers would easily agree they were writing sequences of instructions. However, the invention of these tools has caused programmers using these tools to easily agree they were writing collections of instructions. The added toolset was so revolutionary that users of these new tools developed a language incompatible with the language of non-users. This language differential is so severe that a non-declarative programmer, a non-instruction-pipelining exploiter, and a non-parallel-computing advocate does not understand why a highly trained and educated software developer cannot see that a computer program is a sequences of instructions. And vice versa, with the new toolset programmer who does not understand why others cannot see the collection properties. Software speciation has occurred. Therefore, to communicate to Wikipedia users that computer programs now have two distinct and incompatible definitions, a case statement is necessary. The first paragraph of the computer program article needs to have two definitions -- one supplying the case of traditional imperative programming and the other supplying the case of instruction collections. Timhowardriley 20:23, 25 May 2007 (UTC)

I disagree. If the nature of something changes, the definition must change and expand with it.
In the 17th century, you may well have described a Swan as "A white water-bird with orange feet and bill". However, after the discovery of the Australian Black Swan a broader definition would have to be used, to include both, probably dropping any reference to colour at all (or at least giving it much less prominence). The swan articles define what a swan is. A later section deals with the differences between the different types of swan. That is the model we should adopt (and have adopted) here. --HappyDog 17:36, 27 May 2007 (UTC)
Good argument HappyDog. I am at a loss to understand why some people want such a restrictive definition in the introduction. The introduction should be broad brush with the details fleshed out in the main body of the article. Derek farn 19:21, 27 May 2007 (UTC)
Even the swan article could begin with a much broader brush stroke than it does. Instead of saying that "Swans are large water birds of the family Anatidae", it could accuratley state that "Swans are members of the kingdom Animalia". Technically accurate. Nice "broad" definition. Very "unrestrictive". And the details could be "fleshed out in the body of the article". But does it add any value?
No. Like "Swans are things in the world" it is too broad. Why does everything have to be at one extreme or the other? --HappyDog 03:06, 31 May 2007 (UTC)
Here are the major points I draw from this discussion:
  • You seem to have decided that computer programs are disordered sets of instructions (a la DVD collections). Therefore, adding or changing the order of instructions of any program will change nothing, as it does not with your DVD collection. As long as you can source it, please add it; and definitely provide examples.
  • You have not yet provided a disordered collection of instructions, and in fact the examples given prove only further that order is important (e.g., print). However, as long as you can source it, please add it; and definitely provide examples.
  • You also seem to have expanded the definition of a program to mean that any two pieces of code that produce the same result are in fact the same program, which I disagree with, but as long as you can source it then please add it; and definitely provide examples.
To respond to HappyDog's excellent analogy to the definition of swan, I urge you to expand the definition of computer program to include whatever you care to throw in there. Just be sure to source it. Remember that Wikipedia does have a policy concerning NOR, so making up your own definition "on the fly" without any sources whatsoever would appear to be a no-no, as would my making up an unsourced definition of swan and trying to pass it off. I don't really have anything further to add to this article, so I'll let you all get back to arguing amongst yourselves over another sentence for the next month or so. Good luck with this article. SqlPac 21:22, 27 May 2007 (UTC)
Again my views are misrepresented. You are extrapolating a general statement from a specific counter example. It is as if you had said "Ice cream is vanilla flavoured" and I replied "That is untrue - chocolate ice-cream is not vanilla flavoured". To then go on and argue about why my claim that "all ice-cream is chocolate flavoured" is incorrect would be somewhat missing the point.
Ditto, to claim that the swan article should start "Swans are members of the kingdom Animalia" is, as I'm sure you aware, a complete nonsense argument. How does that tell the reader anything at all? Do they really have to read the whole article to realise that there is a difference between a swan and an elephant? Let's hope they didn't get to the article from here!
Regarding your points, I have answered most of these questions before, and you still don't seem to get my point. Or perhaps you are just baiting?
One point I should answer, as it is a new one: I never claimed that two programs with the same output are the same program. However, I also think it would be wrong to say that two programs (and we're talking source code here) must be identical at byte-level in order to be considered the same. For example, if program (a) contains three functions and program (b) contains the exact same functions in a different order, then I would consider them the same. The division lies somewhere between 'programs are only the same if they are byte-level identical' and 'all programs are identical' and the line is probably not an easy one to draw. It is certainly not one we should be making up for the purposes of this article!
--HappyDog 03:03, 31 May 2007 (UTC)

[edit] Get your merge on

I'm planning on working towards merging this with the software article. This will mean making the software article less awful first. Mmmm, plenty of work needed on this one. Chris Cunningham 10:48, 13 June 2007 (UTC)

I completely agree that this article should be merged instead of keeping it as a separate page, and while merging this is should be given a seperate page i believe Kalivd 05:17, 18 June 2007 (UTC)

I disagree that a computer program is necessarily software. Software is only a subset of all computer programs. Metrax 22:25, 17 October 2007 (UTC)

[edit] Mediation request

I've picked up the mediation request for this article and I'm currently reading through the past history on the talk page and the article itself. While I'm familiarizing myself with the dispute, I have a question to ask Derek farn, Timhowardriley and HappyDog: that being "Ideally, what do you want changed about this article, if anything?" Trusilver 15:40, 31 August 2007 (UTC)

I believe a multi-sentence definition of computer program could be produced that:
1) does not contain "collection". The definition should define both the vast majority of existing and future computer programs (sequence of instructions) plus declarative computer programs (where the sequencing is camouflaged).
2) does not contain "instructions that describe...".
3) does not contain "or set of tasks". Timhowardriley 15:53, 31 August 2007 (UTC)
4) replaces "describes a task" with "executes an algorithm". Timhowardriley 20:31, 31 August 2007 (UTC)
This debate, as far as I am aware, has been about the opening paragraphs (before the TOC) and does not really about the rest of the article, so my response to your question is only related to that section.
The current version of this section has undergone a good number of revisions in order to get it to where it currently is, and in my opinion it's pretty good. There may still be room for improvement, however every attempt to 'fix' this by timhowardriley has made it less readable, less complete, less correct, or less newbie-friendly (or, often, some combination of the above). In my opinion timhowardriley, though clearly acting in good faith, seems not to have a broad enough understanding of the subject, as his refinements often remove an important qualifier that is required in order to accurately describe 'computer program' as a general term. For example, in point 4 above he asks to replace 'describes a task' with 'executes an algorithm'. However, computer programs can be written in pseudo-code, which cannot be executed, and it is also debatable whether a single line program could be called an algorithm. Most of the content of the introduction has been chosen deliberately and carefully, and should not be changed lightly. --HappyDog 19:20, 2 September 2007 (UTC)
HappyDog, thanks for a great summary of the issues. I agree with what you say. Derek farn 20:36, 2 September 2007 (UTC)
Wikipedia:civility says, "Civility is a code for the conduct of editing and writing edit summaries, comments, and talk page discussions on all Wikipedias. Wikipedians define incivility roughly as personally targeted behaviour that causes an atmosphere of greater conflict and stress." HappyDog referring to me as "not to have a broad enough understanding of the subject" is personally targeted and demeaning behaviour, lacking in mutual respect. Whether true or not, one author's opinion of another author's subject-understanding is immaterial. Whereas it is important to present flaws in arguments, it is personal to present flaws in people. Moreover, Wikipedia:No angry mastodons says, "all it takes is mutual respect and a willingness to abide by referenced sources and site policy." I have provided two referenced sources saying that a computer program is something other than the status quo. I also have provided a logical explaination to account for the difference. If the editors guarding the status quo are truly acting in good faith, then they will "dig up the very best evidence you can find and put that in the article. Let the other side's best evidence be a challenge to raise your own standards and always bear the big picture in mind: we're here to provide information for nonspecialists." Timhowardriley 17:49, 3 September 2007 (UTC)

[edit] What is a computer program?

Please consider my essay, "What is a computer program?". Timhowardriley 07:53, 22 September 2007 (UTC)

A computer program is one or more instructions intended for execution by a computer. Is there a reason for trying to complicate rather than simplify here? Metrax 03:19, 17 October 2007 (UTC)
There are two camps here. One camp thinks the introduction should include nuances, and the other camp thinks simple is enough. However, the nuance camp got to the article first. Timhowardriley 17:29, 17 October 2007 (UTC)
Regardless of camp, would both camps agree that a computer program requires at least one instruction? If so, then would both camps also agree that a computer program could be partially defined as having "one or more" instructions? Metrax 20:50, 17 October 2007 (UTC)
Sounds good to me. Timhowardriley 21:13, 17 October 2007 (UTC)
Replacing 'a collection of' with 'one or more' seems reasonable to me. I am sure someone will argue that the special case of a computer program with no instructions is theoretically possible, but that sort of subtlety should not be in the intro. btw, I'm not sure what you mean about the two camps. I personally think that simple is paramount (hence the layman's explanation before the technical one) - however not at the expense of being correct! --HappyDog 21:42, 17 October 2007 (UTC)
There are lots of computer programs that contain no instructions. For instance, many Prolog programs only contain clauses (ok, many implementations support extensions that allow imperative (i.e., instructions) statements) and the runtime system figures out what clauses hold for a given input data set (and invariably generate some output). When will people follow the links in the article, expand their horizons and learn that the world of computer programs is larger than one or more instructions (in sequence or otherwise). Derek farn 21:49, 17 October 2007 (UTC)
Is it necessarily true that all Prolog programs are computer programs? Or is Prolog a logic programming language? Metrax 22:01, 17 October 2007 (UTC)
"When will people ... expand their horizons and learn that the world of computer programs is larger than one or more instructions..." This is the nuance camp. Timhowardriley 22:11, 17 October 2007 (UTC)
While that may be your personal point of view, it doesn't answer the question to any degree. "Camps" can only continue to exist if you continue to recognize differences of opinion rather than place importance on agreements of opinion. If you truly want to see an end to "camps" then do more to seek consensus. Pointing out your personal opinion that "camps" exist becomes a recursive recreation of the same. Metrax 22:19, 17 October 2007 (UTC)
Point well taken. Timhowardriley 22:24, 17 October 2007 (UTC)
If a computer program is required to contain instructions then some Prolog programs would not be computer programs. If all Prolog programs are required to be computer programs that a computer program need not contain instructions. Metrax, would you regard the SQL program "select cond from database" as containing an instruction, even though it only specified what was needed (ie, the set of zero or more values from database that satisfied condition cond) and not how to obtain these values? Derek farn 01:23, 18 October 2007 (UTC)
Relative to the language in question, if "select" is considered an instruction, then of course it would "count" as being an instruction. The point of consideration, though, is whether a program exists that does not have instructions. The word "program" itself implies something to do rather than something that is empty. A program such as "NOP", for example does a non-operation, and yet it must be considered an instruction since it is executed and changes the program counter/instruction pointer. If there is a program in Prolog that has zero instructions, does it compile? If so, then are there instructions that are carried out in the resulting image? Consider C for a different example: The program void main(void){}, will still compile to a machine level "return" instruction. As a program relative to its language, that is to say, as a C program, it hasn't any instructions, but its resulting image does. It occurs to me that the definition of "instruction" itself may be at fault here. Would you agree then that all computer programs have at least one machine instruction rather than language based instruction? Per the perspective of a person that hadn't any idea of what a computer program was, how would you explain to them that some programs have nothing scheduled for the computer to do? Some languages do not use the word "instruction" whatsoever and are defined as everything being either a "command" or "function". Would it then be incorrect when speaking in general to refer to a computer program from such a language as "instructions for a computer"? On the flip side, are all expressions in computer languages considered computer programs? And on the edge of the coin, what about instructions that are manually/electronically given to a CPU? Although they haven't any source code nor binary image, they are still programs comprised of at least one instruction. Metrax 04:29, 18 October 2007 (UTC)

[edit] Use of the term "task"

The current article describes a program as a collection of instructions that describes a task, or set of tasks. The use of the word "task" here is ambiguous. Per Intel's "Architecture Developer's Manual, Volume 3, Systems Programming": A task is a unit of work that a processor can dispatch, execute, and suspend. It can be used to execute a program, a task or process, an operating system service utility, an interrupt or exception handler, or a kernel or executive utility. While it is logically clear that all tasks are necessarily computer programs or portions of computer programs, all computer programs are not tasks, nor does a computer program necessarily describe a task or set of tasks. The word "instruction" already implies that some change of state is intended for execution by a computer.

Even the simplest of programs listed here in discussion, the single instruction NOP, necessitates a change of state by a computer were it to be executed. The instruction pointer in the CPU will change. A computer that does not have task capability could execute the "NOP" program if such an instruction is within its instruction set. In the simplest of Turing machines, either the head or the tape moves one cell in some direction and the instruction pointer in a computer is analogous to this. All computers have an instruction pointer that changes state upon execution of an instruction, but not all computers necessarily have the architecture to handle tasks. Metrax 21:54, 17 October 2007 (UTC)

The first sentence is aimed at the layperson. The word 'task' in this context is not meant to have any CS-specific meaning, but simply means a job to be performed. And by 'job' I don't mean as in the CS-sense of a job-queue, but the laypersons sense of a job - perhaps I should have used the word 'function' instead. By function I don't mean in the CS-sense of a defined procedure or mathematical transformation... etc. etc. My point is that Computer Science seems to have purloined a massive number of common words and given them a specific CS meaning (or meanings) which makes it hard to describe to a layperson AND a computer scientist without either confusing the first (by using technical terms) or the second (by not using technical terms in the way they expect). This is why there are two sentences in the first paragraph that essentially say the same thing. The first, informally, for the layperson and the second, a formal cited definition with more technical precision (but less surface clarity). It is also why there is so much discussion about the wording of that paragraph on this page (e.g. use of 'set' vs 'collection', both of which are synonymous to the layperson, and both of which are incorrect if you use the mathematical meanings of the terms). --HappyDog 06:38, 18 October 2007 (UTC)
So in your opinion then, it is better to confuse the lay person from the get-go? It doesn't make any sense to me to intentionally use a word that will eventually need to be clarified rather than finding a simpler form to begin with. In your comment for your revert, you mention "It is possible to sing without an audience". How does that apply here? A computer program, unlike simply a "program", does require a computer as the intended "audience", does it not? Are you aware of any instances of computer programs that are not intended for execution by a computer? My concern here is that if this subject matter expands as it should, then one would expect to find an article on "process", for example. To remain consistent between various articles on different computer topics should be something a little foresight would make easy rather than difficult. If eventually there are articles on "Job", "Task", and "Process", or even if these become sections in some other article, this article would be contradictory to those. As this article exists in current form, it is already in disagreement with other articles that point to it. See "Stored Program Architecture" in the article "Computers". The fact that CS uses so many common words to describe various abstract ideas is a convenience more than a hindrance. It makes it possible to be technically correct while simultaneously using simple common words. Using "task" for something other than its CS understanding is unnecessary and sets the stage for a separate article to disagree with this article. I can understand keeping things simple for the lay person, but to treat the lay person as someone without any intelligence at all, would be insulting. Do you feel that the word "instruction" is too complicated for the average lay person to understand? The word "instruction" already includes the idea that something is to be done, regardless of what one might call it. If a lay person is to get something at all out of an article, it should be educational and that in my opinion includes correct terminology. Metrax 09:30, 18 October 2007 (UTC)

[edit] Object code

Object code may necessarily contain a computer program or a portion of a computer program, but is not a computer program itself. Object code contains symbols and instructions for linkage as well as the source object on which a linker operates. It may be considered on the whole as an instruction for a linker, or a "linker program", but not a computer program. Object code is more like a small database that contains records in a particular format (the format depending on the linker). The current article mentions that the machine-executable expressions of computational methods are commonly referred to as executables, object code.... The comparison is rather like saying that because chicken soup contains chicken meat, that chicken bones are therefore soup. Metrax 23:22, 17 October 2007 (UTC)

[edit] A chart or template is needed

I'm not a programmer, so forgive any inaccuracies, exclusions, or misuse of terminology. From an average curious user's perspective, what this article could use is a chart or template showing the hierarchy of program types, from machine code operating systems at the base, to things like client-side scripting, plugins, drivers, etc at the end of the branches. There must be at least 5 or more levels of programs on top of programs at each branch. The different branches would be something to the effect of internet applications, LAN user applications, offline user applications, programming applications, operating system resources, emulators, etc.Oicumayberight 01:02, 18 October 2007 (UTC)

[edit] two definitions, both incorrect.

Logically speaking, the statement made by Knuth is that all expressions of a computational method in a computer language are programs. That they are "computer" programs is implied. He does not, however, state that all computer programs are expressions of a computer language. In effect he says that all red apples are apples, but he does not say that there are not cases of green apples. Knuth's statement defines expressions of computer languages, it does not define computer programs. For a case in point, electronic manipulation of a CPU is a program for that CPU but does not adhere to any computer language. The program exists, yet there isn't any source other than hardware. Metrax 00:04, 19 October 2007 (UTC)

I agree that the "formal definition" should be stricken; however, for a different reason. I do believe Knuth is making an if-and-only-if definition; therefore, User:SqlPac, the editor who added the definition, could successfully swap the subject with the predicate to convert the definition as stated in the book to the definition as stated in the article. However, I believe it should be stricken for the following reasons:
  1. I don't believe formal definitions exist like formal proofs exist. Formal proofs exist because informal proofs also exist. An informal proof might gloss over complicated steps or spell out in English what would otherwise be mathematical expressions. However, a word or term might have multiple definitions, with each being just as correct within its context as any other definition. I don't see how one definition is formal and another is informal, implying inferiority.
  2. Knuth's definition is confusing. Students in 8th grade are now going to their school's computer lab to type computer programs. One mandate placed upon wikipedians is to write articles that are understandable. Now, I realize understandable is relative to the subject matter, but I don't think an 8th grade threshold is unreasonable for the understandability of computer programs.
  3. Knuth's definition is presented out of context. OK, this really smart fellow writes three volumes of very thick books covering math and algorithms. The books' title, The Art of Computer Programming, even becomes its own acronym — TAOCP. So, one would expect a grand definition of computer program followed by volumes of ways to make it artful. But instead, the subject matter is the definition of algorithms, and algorithms have five necessary characteristics, and one of the characteristics of algorithms is definiteness, and one way algorithms could be presented with definiteness is by writing them in a programming language, and oh by the way, "An expression of a computational method in a computer language is called a program." I don't believe Knuth intended for this sentence to become a landmark.
  4. Knuth's definition can be restated as, "A computer program is a combination of symbols forming an algorithm that may or may not terminate, and that algorithm is written in a programming language." Why don't we use this as the foundation for a new introduction?
Please post your responses below. The preceeding is submitted by Timhowardriley 06:57, 19 October 2007 (UTC)
Knuth does not set out to define computer program and his statement is only pertinent to the expressive languages he is defining. A program written in FORTRAN is a FORTRAN program as well as a computer program, but the program of a computer is not limited to higher level languages, assembler, or even reading previously formatted machine code from memory. The program of a computer relies only upon the state of its instruction/control lines. If you were to replace "computer" with "Personal Computer" then maybe I'd agree with you. The fact is, though, that your average PC today is a conglomeration of several smaller computers working together. The average video card, for a popular example, is a computer in its own right. Others might include I/O processors, interrupt controllers, and etc., all within a typical PC. Are you sure you want to give eighth graders the impression that the word "Computer" only refers to something that can sit on top of a desk? What about the real time systems that fly overhead making sure those desks can have PC's on top of them? I agree that we should limit the word "Computer" to the electronic variety even though I really don't believe it is necessary to do so regarding the definition of "Computer Program". The definition we had before the word "tasks" was reintroduced was simple enough to take all of these things into account. Metrax 23:04, 19 October 2007 (UTC)
Could you expand on, "The program of a computer relies only upon the state of its instruction/control lines."? Timhowardriley 23:33, 19 October 2007 (UTC)
see Universal Turing Machine. A computer is a machine, the actions of which are controlled by its program. Specifically, a computer is a finite state machine, the actions of which are only changes of states. Therefore, a computer program is only that which controls the change of states of a computer. Normally, the word "instruction" is used to refer to that which controls a single change of state. For this reason, I balk at accepting the idea of zero instructions being a program since without an instruction, the state of the machine remains constant. The very first program that your PC executes when it is first turned on, is a single instruction that, at one time (unsure if they still do it this way), was created by a small pack of resistors. Its function is to jump to a start address in ROM where the basic i/o system has been encoded. While it is probably the most important program on anyone's PC, it hasn't any source code, cannot be contained in a file, and does not reside in memory (per se). Metrax 04:52, 20 October 2007 (UTC)

[edit] Representing expertise in Computer Program

I think the computer program article should go from center and simple outward to complex and nuanced. At the complex and nuanced extremes are 1) the high-level computer programs where algorithms are hidden in black boxes and 2) the low-level computer programs where electricity is passing through gates. It seems like each editor joining this article specializes in one of the two extremes and wants their specialty represented in the opening paragraph. Timhowardriley 23:54, 19 October 2007 (UTC)

The term "low-level" usually refers to assembly language and/or compiler intrinsics. I don't believe it is necessary to have a complicated definition of "computer program" and do believe a simple definition can satisfy all. I don't believe that any editor, though, should make assumptions about the backgrounds of other editors, nor that it matters much. It would actually make me quite happy to see that eigth grader you mentioned participate. It matters more that it is correct and understandable by all concerned. A consensus is designed to be micro-representative of the overall readership. With that in mind, again, it is also very important to be consistent and in agreement with all other articles pertaining to computers and computer programs. Metrax 05:11, 20 October 2007 (UTC)

Please forgive my over-generalization and righteous indignation. Let me make my point another way. Describing computer program is as difficult as describing an elephant. One editor wants to describe an elephant in terms of its trunk, and another editor objects because that description contradicts the description of an elephant in terms of its ear. My point is to first look at an elephant from 100 feet high, and then zoom in. Regarding computer program, it's OK to whitewash minor contradictions and exceptions in the beginning of the article and address them later. Minor exceptions to be whitewashed would be computer programs that do null (I love the main(){} example), or computer programs that do nothing or nonsense, or computer programs never intended to be executed. Timhowardriley 17:16, 20 October 2007 (UTC)

The "C program" has zero instructions, however, after compilation, the resulting computer program has a return instruction. A distinction to realize is that the C program is only SOURCE for a computer program and not the computer program itself. True, both the lay person as well as the pro might refer to the C program as a "computer program" using the logic that it is both a program and intended for use on a computer. But they wouldn't be trying to define "computer program" if they did, but rather trying to define their source code. Whereas they could enjoy the liberty of being conversationally lax, an encyclopedic definition does not enjoy the same luxury. In any case, the simple definition in place at the moment appears to be both semantically correct as well as formally correct, and agrees with other articles that point to this article, again, only in my opinion. By the way, although I didn't intend for you to think you had been insulting by my earlier comments, I do find it interesting that you would choose to compare the editors of this article by analogy to blind men as a means of reconciliation. Metrax 21:03, 20 October 2007 (UTC)
I interpreted your comment to be only the mildest of admonishments. I re-read my post and realized it was an over-generalization and righteous indignation. Also, I forgot that the characters in the fable were blind men. Sorry. Timhowardriley 21:16, 20 October 2007 (UTC)
You've apologized twice now unnecessarily. The intent of my statement was to make you grin and/or slap your hand to your forehead and do the old "Arrrggggggh!" Metrax 21:55, 20 October 2007 (UTC)

[edit] symbols? algorithm?

In the introductory statement: "Specifically, it is a combination of symbols forming an algorithm that may or may not terminate, and that algorithm is written in a programming language." This is a description of a source program only. It is rather like saying a story must be written to be a story (symbols). The article on algorithm currently defines an algorithm as "a finite list of well-defined instructions for accomplishing some task...". There are computer programs that are not algorithms by this definition. The NOP program is a good example. If one used NOP for a specific purpose then sure, it could be a step in an algorithm to waste time, but NOP has other uses that are not steps in any algorithm, and stand-alone, while it does meet the definition of an instruction, does change the state of a computer, it does not "accomplish some task", on the contrary, by its definition it does no operation. By definition, then, the single instruction computer program NOP is not an algorithm. Metrax 21:51, 20 October 2007 (UTC)

In spite of its flaws, Wikipedia:Verifiability says, "The threshold for inclusion in Wikipedia is verifiability, not truth." Timhowardriley 22:00, 20 October 2007 (UTC)
True. And Original research (OR) is a term used in Wikipedia to refer to unpublished theories. The reference for that statement does not even mention the word algorithm, while at the same time the article for algorithm has plenty of verifiable references. For an acid test, consider the following rule of thumb: Any verifiable statement can be included verbatim into an article provided that it be referenced to avoid plagiarism. Can you see how the statement actually disagrees with what Knuth has written? Is there some reason the statement improves upon his grammar or other reason the statement is not the same as his statement verbatim? Metrax 22:17, 20 October 2007 (UTC)
Regarding "The reference for that statement does not even mention the word algorithm": The definition references "computational method", and computational method is defined as an algorithm that doesn't necessarily have to end, like an operating system. See Computer Program#Computational methods and algorithms. Regarding "Is there some reason the statement improves upon his grammar or other reason the statement is not the same as his statement verbatim?": I literally expanded the confusing jargon of Knuth's definition to each jargon's respective definition. (It is logically equivalent; I did not change a thing.) The purpose of the expanded definition was clarity. Timhowardriley 22:31, 20 October 2007 (UTC)
Regarding NOP: dictionary.com's full definition of "expression" is: "Mathematics. a symbol or a combination of symbols representing a value, relation, or the like." I whitewashed it down to a "combination of symbols". Timhowardriley 22:51, 20 October 2007 (UTC)
Additional thought: NOP is a combination of those three symbols. Timhowardriley 22:58, 20 October 2007 (UTC)
OK. I changed the expansion of Knuth's use of "expression" to "a symbol or combination of symbols". Timhowardriley 23:07, 20 October 2007 (UTC)
A few things: All of that simply means that you are synthesizing your own meaning, i.e. original research. You didn't answer my question about why Knuth's statement cannot be used verbatim. The NOP instruction hasn't any symbols whatsoever. The mnemonic "NOP" uses the symbols "N", "O" and "P". Here is another representation of the "Intel" NOP instruction: 10010000. Here is another: +Vcc G G +Vcc G G G G. On a different machine, it will probably be different. The instruction hasn't anything to do with symbols and symbols are unnecessary for instructions to exist. The state of a machine may be expressed symbolically, but the machine state itself is neither composed of symbols nor requires them to operate. Metrax 00:13, 21 October 2007 (UTC)
Regarding "You didn't answer my question about why Knuth's statement cannot be used verbatim." Knuth's statement should not be used verbatim because it is confusing. It is confusing because it uses jargon. Here is the proof that my expanded version of Knuth's definition is logically equivalent to Knuth's:
expression ::= a symbol or combination of symbols [forming ...]
computational method ::= an algorithm that may or may not terminate
in a computer language ::= written in a programming language
program ::= computer program
An expression of a computational method in a computer language is called a program. ::= A symbol or combination of symbols forming an algorithm that may or may not terminate written in a programming language is called a computer program.
As posted ::= Specifically, it is a symbol or combination of symbols forming an algorithm that may or may not terminate, and that algorithm is written in a programming language.
I think you're missing the point. What you have done above is a synthesis. It is your own work. It is by definition, original research. And the fact is that Knuth does not say at all that a "computer program" is anything. It doesn't really matter how you would reword it, the logic of his statement is simply that all A are B. It cannot be turned around to say that therefore all B are A. Metrax 04:18, 21 October 2007 (UTC)
It is my interpretation that Knuth is making an if-and-only-if definition. Therefore, the subject can be swapped with the predicate. It's unfortunate that Knuth didn't put the subject first. Again this is just my interpretation. Timhowardriley 16:22, 21 October 2007 (UTC)
Regarding "The NOP instruction hasn't any symbols whatsoever." and your other examples: I can't agree nor disagree with these — I don't know. I would surmise that they are exceptions that could be expanded upon in the second paragraph. Timhowardriley 00:56, 21 October 2007 (UTC)
Well, NOP isn't the only instruction. The plain fact of the matter is that NO instructions require symbols whatsoever. If you went to work and your boss told you to take the day off, then when you got home, would you call him on the phone and ask him to tell you in writing? You didn't need any symbols to follow his instruction. Sure, you could say that he "told" you and therefore used English, right? Okay, so do you go to work on days that you already know are holidays? Okay, sure you can say that those are written somewhere in the employees handbook. So... do you need to read those lines in the handbook each and every time you take a holiday? You see, the instruction is NOT the writing. The instruction is what determines your action. Metrax 04:29, 21 October 2007 (UTC)

[edit] Regarding "Only imperative programs describe algorithms"

Declarative programming says, "In short, imperative programs explicitly specify an algorithm to achieve a goal, while declarative programs explicitly specify the goal and leave the implementation of the algorithm to the support software (for example, a SQL select statement specifies the properties of the data to be extracted from a database, not the process of extracting the data)." Timhowardriley 02:12, 21 October 2007 (UTC)

The set of all algorithms is not the superset of all computer programs. Likewise, the set of all computer programs is not the superset of all algorithms. At best, there is an intersection between the sets which is of popular interest to many people (i.e. computer programs that are algorithms). But there are many algorithms that are not even computer related and there are many computer programs that aren't even near satisfying the requirments of an algorithm. Metrax 04:35, 21 October 2007 (UTC)


[edit] Are algorithms the superset of computer programs?

{Computer program} is a subset of {Algorithms} by edict, not by physical properties subject to experimentation. This relationship is defined, I believe, to provide an axiom for the Theory of algorithms. This theory says that if you have an algorithm that will end, then it can be executed on a Turing Machine. And anything that can be executed on a Turing Machine can be executed on a computer, providing infinite memory. And of course, computer programs are needed to execute a computer. Perhaps your objection is the expansion of "expression" to "a symbol or combination of symbols". Or perhaps your objection is Knuth's requirement that a computer program be written in a computer language. After all, Eniac was programmed by moving cables and flipping switches. And Eniac ran algorithms. Timhowardriley 16:11, 21 October 2007 (UTC)
Logically speaking, just because all A are B does not imply that all B are therefore A. At best, you have simply reiterated that there is an intersection of the two sets {all algorithms} and {all computer programs}. The statement "All dogs are animals" does not imply that all animals are therefore dogs. You misquote when saying that Knuth had a requirement that computer programs be written in a computer language. It is not what he said. He said that the expressions written in computer languages are programs, not the reverse.
Here is a small computer program that is not an algorithm:
again:  mov eax,ebx
        xor ecx,ecx
        loop again

Here it is in the C language:
void main(void) {
register unsigned int a,b,c;
    do {
      a=b;
      c^=c;
    } while (!(c));
}

Here it is in BASIC:
1 A=B
2 C=C XOR(C)
3 IF (C=0) THEN GOTO 1

So can you see that Knuth's statement holds true, that an expression in a language is a program while at the same time he did not say that all programs are algorithms. The other thing is, even though there are three different representations listed here, they all describe only one program meaning. Metrax 21:36, 21 October 2007 (UTC)

[edit] Proof Knuth's definition is posted

I reworded Knuth's definition of computer program because Knuth's version is confusing and jargon filled.

Yikes! I was just about willing to settle for a definition penned by Knuth and was about to ask for a page number (my quick scan through vol 3 failed to find it) so I could check the surrounding context. If you find Knuth's version confusing then who is to say that your translation is confusion free (or even that a confusion free translation is possible?) Knuth uses words in a very precise way and what you call jargon is probably essential to the meaning he is trying to convey. Given the substantial number of changes you have made to the original text I don't think it can be claimed to have been written by Knuth. Derek farn 17:49, 21 October 2007 (UTC)

Here is the proof that the posted definition is logically equivalent it Knuth's definition:

expression ::= a symbol or combination of symbols [forming ...]
computational method ::= an algorithm that may or may not terminate
in a computer language ::= written in a programming language
program ::= computer program
A symbol or combination of symbols forming an algorithm that may or may not terminate written in a programming language is called a computer program ::= An expression of a computational method in a computer language is called a program.
As posted ::= Specifically, it is a symbol or combination of symbols forming an algorithm that may or may not terminate, and that algorithm is written in a programming language.

Submitted by Timhowardriley 16:30, 21 October 2007 (UTC).

But it is YOUR work, i.e. a synthesis, and your own original synthesis. It is by defintion, original research. You are not Knuth and are not published. If you were published, then that of course would open an entirely new can of worms and you would more than likely want to keep that to yourself. Knuth's statement does not define "computer program" at all, but only defines expressions in computer languages. As such, it could not be used, even verbatim, to achieve the purpose of definition. Metrax 21:44, 21 October 2007 (UTC)
Above you have "computational method ::= an algorithm that may or may not terminate". All algorithms terminate. Formally, algorithms have six characteristics: Precision, Uniqueness, Finiteness, Input, Output, and Generality. Of those, the characteristic of finiteness is such that an algorithm stops after finitely many instructions have been executed. This definition may be found in "Discrete Mathematics" by Richard Johnsonbaugh on page 136, and agrees with the current definition in place on Wikipedia for algorithm. Metrax 05:39, 22 October 2007 (UTC)

[edit] Three definitions

I now understand User:Metrax's assertion that computer programs and algorithms intersect each other. The set of computer programs is a subset of algorithms, and the set of computer programs is a subset of some other superset. I also understand User:Derek farn's assertion that properties of declarative programs contradict algorithms. However, Knuth clearly defines computer programs in terms of algorithms, and I would imagine two standard deviations of the computer programs out there run algorithms. So, here is my suggestion: 1) Have the article's first paragraph be, "A computer program consists of one or more instructions that are intended for execution by a computer." 2) Have the article's second paragraph begin with something like, "Very low level computer programs ..." Then an explanation of very low level programs. 3) Have the article's third paragraph begin with Knuth's definition as expanded by me (see Wikipedia:No original research#Synthesis of published material serving to advance a position). Then an explanation of computer programs as they relate to algorithms. 4) Have the article's fourth paragraph begin with something like, "Very high level computer programs ..." Then an explanation of declarative computer programs. Timhowardriley 02:44, 22 October 2007 (UTC)

You wrote "The set of computer programs is a subset of algorithms". Did you mean: a subset of computer programs is a subset of algorithms? If you did, then yes, you understand my assertion about intersection. There are algorithms that are not computer programs like Adlai Stevenson's recipe for carp. There are computer programs that are not algorithms, I gave three examples above. AND there ARE some computer programs that are algorithms and likewise THOSE are also algorithms that are computer programs. Metrax 05:43, 22 October 2007 (UTC)
Yes, the subset is a subset. What do you think of my idea of having three definitions of computer program, one in each paragraph. Maybe we should setup a sandbox to hack away. (Derek and HappyDog?) Timhowardriley 15:59, 22 October 2007 (UTC)
Feel free, but you know my opinion is that a simple definition can cover all. Metrax 02:17, 23 October 2007 (UTC)

[edit] GA Failed

Parts of this article are pretty good, and I can tell from previous entries on this talk page that it has been a bit of a battle getting it to this point. However I think it still has too many problems to meet the standards for a GA. These problems include:

  • The following sentence makes no sense to me: "A computer program in source code form may be combined with its corresponding algorithm to form computer software." A program in source code form may be processed by another program (compiler or interpreter) to make software, and a program may certainly contain algorithms, but I have no idea what "combined with its corresponding algorithm to form coumputer software" might mean.
    • The statement was removed until a better worded source can be found. Timhowardriley 20:17, 5 November 2007 (UTC)
  • The following text cites no source: "Computer programs may be categorized along programming methods. Computer programs are generally specified using the imperative, declarative, or visual programming method. With the imperative method, an algorithm is specified. With the declarative method, the output is specified and the implementation details are hidden. With the visual method, program elements are graphically manipulated rather than textually specified." Perhaps even more importantly it doesn't really make sense to me to categorize programs this way. It seems like something that would fit better in the section on programming. If you do include it there you should probably briefly mention genetic programming for completeness, but it might be best to avoid too much digression on programming techniques altogether as it might be excessive detail for this topic.
    • Whereas this paragraph has no source, it was developed through extensive consensus. I believe it's a good way to categorize computer programs because the divisions are clear. It would seem that programming language would be a better place for these categories of programming language methods; however, that article covers programming languages from its mathematical roots, not exactly the same audience as this article. On the other hand, this article covers computer programs from an entry-level perspective, and the programming language method divisions of computer programs is an entry-level subject. Also, it would be OK to have these programming language methods appear in both articles. Regarding genetic programming: this looks like a well defined algorithm which would fit nicely in a paragraph of algorithms as a branch off of this paragraph. Timhowardriley 18:05, 6 November 2007 (UTC)
    • I changed "programming method" to "programming language method" because these really are divisions of the language chosen. So now visual approach doesn't seem to fit. (?) Timhowardriley 18:12, 6 November 2007 (UTC)
    • I found an article to wikilink to that describes these categories: Programming_paradigm. Timhowardriley 16:53, 7 November 2007 (UTC)
    • I found a textbook to cite that describes these categories. Timhowardriley 18:14, 8 November 2007 (UTC)
  • "These functional categories include system software, application software, video games, and compilers, among others." is misleading because most definitions I have read would classify video games and compilers as application programs. I think something like: "These functional categories are system software, and application software. Application software includes computer games, compilers, word processors, web browers etc." I think your text on system software is pretty good.
  • "to switch the CPU among processes so frequently that users can interact with each program while it is running" should probably be "to switch the CPU among processes frequently so that users can interact with each program while it is running"
  • The text of the article talks about "firmware", and the caption of the photograph talks about "embedded software" but no where does the article make a connection between the two terms. I understand that there is one, but many other readers might not. A more general question is whether or not "computor programs" encompasses embedded system software for things such as USB flash drives (or microwave ovens). If it does then you should probably mention this fact somewhere in the main text of the article (probably with its own small section) rather than just in a photo caption.
    • Replaced "computer program" with "firmware" in caption. Timhowardriley 19:14, 7 November 2007 (UTC)

I hope these comments help improve the article. I may pitch in and help a little myself. I don't think it is that far from GA. Rusty Cashman 03:58, 4 November 2007 (UTC)

Sadly I agree with your assessment. The article has recently been the subject of intense editing by group of people with a poor writing skills and a very narrow view of the subject. I think a revert to the article of a few months ago would be a big improvement. Derek farn 12:04, 4 November 2007 (UTC)
Maybe we should revert back to this version? Timhowardriley 17:38, 9 November 2007 (UTC)
Rusty Cashman, please don't pitch in as it will exclude you from future assessment. Your remarks are constructive, and the editors of this article will study them carefully. For the sake of continuity, I would like your review upon renomination. Timhowardriley 22:46, 4 November 2007 (UTC)

[edit] GA Passed

This article has improved greatly since I failed it for GA less than a week ago. I believe it now easily meets the GA criteria. It is quite readable. It is informative, and I believe given the level of detail appropriate for such an article, it is reasonably comprehensive. The information is tracable through appropriate citations to reliable sources, and it is presented in a NPOV manner. It is illustrated with appropriate and informative images that have no license issues. I am happy to pass it this time.Rusty Cashman 03:18, 9 November 2007 (UTC)

I'm sorry I disagree. I've listed the article for re-assessment: Wikipedia:Good article reassessment#Computer program--Sir Anon 00:29, 10 November 2007 (UTC)
After carefully reviewing the article and the comments in the delisting thread I have come to the conclusion that there were indeed problems with the article (mostly involving the article's organization rather than the content), and that I passed it prematurely. However, I believe that Timhowardriley and I have made a number of edits that address these problems.Rusty Cashman 20:22, 10 November 2007 (UTC)
I've closed the discussion as a delist. Editors here need to regroup after recent instability and get the article back on track. Good luck! Geometry guy 21:05, 17 November 2007 (UTC)

[edit] Consensus introduction is the best

A previous version of the introduction was developed by a consensus of three editors: Metrix, Timhowardriley, and Rusty Cashman. However, the introduction has since been completely rewritten by one editor. The rewritten introduction is vague ("The terms computer program ... are used to refer to..."), contains irrelevant information ("by both lay people and computer programmers"), and contains a run-on sentence with too many thoughts ["Programs may also be executed by software (e.g., a scripting language may be said to be executed by an interpreter); such programs may consist of a sequence of instructions or may have a declarative form where the software provides the how information."]

Therefore, I recommend we revert the introduction back to the version formed by a consensus. It read:

  • A computer program is one or more instructions that are intended for execution by a computer. A computer requires programs to function, and a computer program does nothing unless its instructions are executed by a central processor. [1] Computer programs are the result of the compilation or interpretation of instructions (source code) written in a programming language. Programs may be embedded into hardware, loaded by other programs from a storage device, or may be manually inputted to the central processor of a computer.

Please post comments below. This post was submitted by Timhowardriley (talk) 22:11, 7 December 2007 (UTC)

Ok, here's my comment. (I may actually do some editing on this article, but for now I've just been reading this talk page a bit.) To begin with, will all the talk about Knuth, I'm surprised no one has mentioned Structure and Interpretation of Computer Programs by Ableson and Sussman. If you (like me) have ever referred to Knuth as "the bible", this book will change your religion. An intro text, it uses Scheme to go from "hello world" level to advanced optimizing compilation technique, passing thru such obscure stuff as Huffman coding on the way, and always remains as lucid and easy to read as anything Patrick Winston ever dreamed of writing. But, I digress. :)
Here is their definition of a program, from page 1 of their 2nd edition (back in the 80s):

Computational processes are abstract beings that inhabit computers. As they evolve, processes manipulate other abstract things called data. The evolution of a process is directed by a pattern of rules called a program. People create programs to direct processes. In effect, we conjure the spirits of the computer with our spells.

I present this just as food for thought; in particular, the "pattern of rules" formulation is (imho) very good, as it covers both declarative and imperative, ad doesn't have the CS baggage of set or collection or list or etc. Eaglizard (talk) 17:33, 25 December 2007 (UTC)

[edit] Must be me

"The terms computer programs, software program, or just program are the instructions for a computer." Does this seem just a little vague to anyone or is it just me? As I read this I'm looking at the instructions for an 8088-based computer in a book (the instructions look similar to this - [5]) and wondering where the "program" from this definition is located on the page. SqlPac (talk) 03:58, 17 March 2008 (UTC)

The definition is vague because of all the compromises that took place to get the article steady. Your point is well taken that a reference book containing an alphabetical listing of assembly language instructions does not constitute a computer program. (Or maybe it does, just not a meaningful computer program.) Instructions are implied to be executed sequentially in the definition. So by not saying, "are the sequence of instructions ...", but instead saying, "are the instructions ..." is not too far-fetched. Leaving out the word "sequence" accounts for declarative languages where the algorithm sequence is hidden. Timhowardriley (talk) 05:29, 17 March 2008 (UTC)
I understand a lot of compromises took place to get the intro to where it is, but compromise does not necessarily make good art, science, or writing ("a camel is a horse designed by committee".) A definition that is supposed to "imply" something, but cautiously avoids stating it outright seems a bit "weaselly". As you point out in your wording above, I think a big part of the problem is the fact that people still like to equate "order" with "sequential". I haven't seen a convincing argument on this talk page (or anywhere else for that matter) that the instructions in a computer program are not executed in an "orderly" fashion, whether sequential or otherwise.
The question of orderly execution aside, which "instructions for a computer" does the definition refer to? Probably not a list of instructions for a programming language from a reference guide somewhere. Case in point, SQL Server BOL lists all the T-SQL statements supported by SQL Server, but that list couldn't really be called a computer program could it? After all, typing in that list of statements as it appears: "ALTER TRIGGER ALTER TABLE ALTER SCHEMA" will just result in an error message.
Maybe a computer program is actually something more specific than a random list of instructions. Maybe it's more like a <insert collective noun here> of instructions submitted to a computer for the purpose of performing a specific task or tasks? Arguments over collective nouns could be avoided with a weaselly replacement for the collective noun, like "one or more" (assuming consensus could be reached that a computer program is always a minimum of one instruction in length, which I'm sure someone would want to argue.) SqlPac (talk) 04:20, 18 March 2008 (UTC)
I don't see why instructions contained in a book cannot be considered to be a computer program. It is a computer program that is not represented in an executable form, ie, a form of source code. Derek farn (talk) 11:33, 18 March 2008 (UTC)
If you could reconcile your definition of source code with these "instructions contained in a book" that I previously posted: "ALTER TRIGGER ALTER TABLE ALTER SCHEMA" it would help quite a bit. Although these three instructions are all valid instructions on SQL Server, pulled directly from a list of instructions in Microsoft's official documentation and reference guide, they seem to generate nothing but errors when they are run.
SQL Server CE DML statement list from Microsoft Books Online (BOL):
Statement Function
INSERT Adds a new row to a table.
UPDATE Changes existing data in a table.
DELETE Removes rows from a table
Result of running this source code as you call it:
 Msg 156, Level 15, State 1, Line 2 Incorrect syntax near the keyword 'UPDATE'.
In addition, see my previous example of "instructions copied from a book" above. If you can, please feel free to address the specific examples, or I can provide you with several more if necessary. Like this complete computer program in C++ which consists of valid instructions, but for some reason won't even compile:
 i++;
 i--;
Curious. SqlPac (talk) 14:42, 18 March 2008 (UTC)
BTW, while I don't particularly like the definition given on the source code page, for similar reasons to my dislike of the definition of computer program here, if you're going to equate "source code" with "computer program" as you did in your previous statement then you should have absolutely no problem using the word "sequence" in your definition as they did on the source code page. SqlPac (talk) 14:51, 18 March 2008 (UTC)
Perhaps the element missing from the current definition is syntax, which is after all the set of rules that define a well-formed (if not semantically correct) arrangement of instructions. That seems to be the part that you are taking issue with. --Allan McInnes (talk) 17:31, 18 March 2008 (UTC)
The part I'm taking issue with is that any "list of instructions" constitutes a "computer program". There are plenty of lists of computer instructions available in thousands of references all over the place, but this is the first time I've heard the claim that, for instance, a list of instructions ordered alphabetically for reference can be considered a program. The following are 100% syntactically valid individual instructions in C++:
 i++;
 i--;
Yet I would not define them as a computer program, and I don't personally know any C++ programmers who would define these syntactically valid instructions as a computer program. Can anyone here explain how the preceding syntactically valid instructions are in fact an actual honest-to-goodness C++ program, per the definition in the article?
If not, then you need to find a good definition. SqlPac (talk) 18:13, 18 March 2008 (UTC)
Sorry, I should have been more clear. The examples you give might be syntactically valid instructions, but they don't constitute a syntactically valid program. The grammar of a language defines the valid sequences of symbols that constitute a "program" in that language. Even binary executables must follow some kind of defined structure in order to constitute a program instead of just a chunk of arbitrary bits. --Allan McInnes (talk) 20:56, 18 March 2008 (UTC)
And yes, I know that I've mentioned the evil word "sequence" there. But even a declarative language like Haskell, or a concurrent language like occam, stores (source code) programs as a linear sequence of symbols. However, in those languages there's a difference between sequence of definition and sequence of execution (which is perhaps the distinction that needs to be drawn out here). I suppose that if we want to get pedantic, there are esoteric languages in which the program is a 2D array (Befunge being the example that comes to mind). But even those languages define a syntactic structure for the programs (see the Funge-98 spec for an example). --Allan McInnes (talk) 21:14, 18 March 2008 (UTC)
I don't begrudge you the word "sequence" here, although I think "ordered" is a better description of execution, since it encompasses a wide variety of possible scenarios. I find it interesting that people here who are going out of their way to avoid implying that programs have any order at all, yet they point you to articles that use the word "sequence" in their definitions (source code) and they believe it's implied in the definition given here (which it is not). I also think it's important to define the purpose of a computer program, which would make a much better definition I think. People get so caught up in trivial little details that they miss the big picture. I understand that this intro. was reached through a lot of compromise with a lot of different personalities, but the problem is that this intro. reads like it was reached through a lot of compromise with a lot of different personalities. Honestly, the intro. may be "safe", it's definitely "vague", and it's fairly useless to the target audience. SqlPac (talk) 21:46, 18 March 2008 (UTC)
We are, I think, in agreement. I agree that the present intro is vague to the point of uselessness. I also agree that "order" is a better term when discussing execution. As you rightly point out, "order" can encompass a variety of scenarios (including partial orders for concurrent and distributed execution :-) --Allan McInnes (talk) 01:37, 19 March 2008 (UTC)
I agree completely, especially since a program can be executed under a preemptive multitasking or parallel O/S, in which case the O/S controls order of execution of the program but still it ensures orderly execution :) It seems to me that it's important to nail down a solid definition of computer program because there are other aspects that haven't even been addressed yet. For instance, the second sentence is just slightly less vague than the first! I assume this was an intentional compromise of some sort as well. Also, I don't see where the difference between a "program" and a "subroutine" is explained. To be honest I may have missed it somewhere in the body of the text, but that's a fairly important distinction that should be pointed out early on. I avoided mentioning these items initially to keep the focus on fixing the first sentence. SqlPac (talk) 02:51, 19 March 2008 (UTC)
Does a set of instructions (in a sequence or otherwise) have to conform to some language syntax, or semantics, or perform some meaningful operation to be considered a program? There is a line to be drawn somewhere, but where? An alphabetic list of assembly instructions might prossibly be assembled and executed, who know what the result would be. The code i++; might be accepted by some basic-like language interpreter, even if it is not syntactically valid C or C++. The current wording avoids the issue, which is probably the safest thing to do in an introduction. Derek farn (talk) 19:10, 18 March 2008 (UTC)
The code i++; might be accepted by some basic-like language interpreter, even if it is not syntactically valid C or C++. Actually it is 100% Syntactically Valid C++. That is not even up for debate at this point. The question is "does 'i++;' constitute a computer program?" I'm not sure why you feel so compelled to cling to vagueness in your intro. Is there a Wikipedia policy on keeping the intro. to articles on technical topics vague and unclear for "safety" reasons? If so, can you give me that link? BTW, the alphabetic list of assembly instructions I provided previously, though it is a complete and accurate list of instructions, will not assemble; and it will not run (I tried it as I figured someone would say something to that effect). SqlPac (talk) 20:04, 18 March 2008 (UTC)
  1. Regarding, "Does a set of instructions (in a sequence or otherwise) have to conform to some language syntax, or semantics, or perform some meaningful operation to be considered a program?": This came up in the debate. The argument was that even a meaningless computer program was still a computer program. See this thread. User:Metrax observed that even starting a loop on an uninitialized variable constituted a computer program. However, I believe this 0.00001% nuance could be ignored. Instead, I placed my personal definition of a computer program on my talk page here. I'll address syntax below.
  2. Regarding, "I haven't seen a convincing argument on this talk page (or anywhere else for that matter) that the instructions in a computer program are not executed in an "orderly" fashion, whether sequential or otherwise.": I like sequence because I'm always drawn down to the program-counter register being incremented by one to get the next instruction. But orderly works for me too. One frequently proposed adjective that I object to is 'set'. 'Set of instructions' is no good because elements in a set cannot be duplicated. I chose the current definition because it could be sourced. However, I did modify the definition from the original author to appease some editors. Stair says on page 132 of "Principles of Information Systems" that a computer programs are "sequences of instructions for the computer."
  3. Regarding, "BTW, the alphabetic list of assembly instructions I provided previously, though it is a complete and accurate list of instructions, will not assemble; and it will not run (I tried it as I figured someone would say something to that effect)": I agree that computer programs must be in a proper syntax. But I'm not sure what to do about it. Can a definition with the word 'syntax' be sourced? Would you like to start a new thread to see if we can come up with a consensus on a definition that includes the word 'syntax'?

Please post replies below. The preceding was submitted by Timhowardriley (talk) 16:42, 19 March 2008 (UTC)

Regarding, "Does a set of instructions (in a sequence or otherwise)... You're combining multiple questions into one here, which is why you end up with your 0.00001% to begin with. The link you posted, unfortunately, has nothing to do with whether or not a program has to conform to a specific syntax. In fact, at that link, User:Metrax demonstrates with code samples that programs do conform to a specific syntax, language-defined. So that answers the first question.
The next quesion is about semantics. Most languages I can think of define semantics at the instruction level, not at the program level; so this is a non-issue to me. Those languages that define semantics for an entire program will vary widely in their specifics. So this, I think, is a non-issue anyway.
Now the third question is "does a program have to perform some meaningful operation?" This is a poorly worded question to begin with, and here's why: The word meaningful is completely subjective. You might consider a program that simply performs a bunch of NOPs in a loop to be completely meaningless. However, to a person doing performance testing of a processor or I/O subsytem this might be a perfectly reasonable and meaningful program. Get rid of the word meaningful, which is useless in an objective definition of a program, and instead just say that the program instructs the computer to perform specific tasks.
Regarding, "I haven't seen a convincing argument on this talk page ... Dictionary.com provides a few definitions of (computer) program, some involve the word "sequence" and others involve "set". I think that the word "sequence", when talking about execution order, might be too restrictive since you have programs that can be executed in non-sequential order (JMP statement can cause the program counter to go back by negative offsets or forward by larger than one offset, etc.), and order of execution can be controlled by the O/S and CPU (or CPUs) as well. Programs are, however, executed in an "orderly" fashion, with the order being controlled by various factors like the CPUs, O/S, etc. I think trying to define every possible order of execution would be a phenomenal waste of time and wouldn't add much value to the definition or the article as a whole. Plus, as soon as you think you've nailed down every possible order of execution, someone will come up with a new one for you.
Regarding, "BTW, the alphabetic list of assembly... Syntax is important, especially for source code. Syntax definitely needs to be included, but I think a major hurdle to getting the definition right would be to define what a program actually does. What is the purpose of a computer program? Then work backwards from there to fill in the blanks with the proper collective nouns and adjectives, etc. I think it's important here to start by defining a computer program in terms of what it does, since it's a somewhat abstract concept. And the expected/end result is often a good place to start when defining abstract concepts. And if you look at the Dictioanry.com defintions, you'll notice they have something in common. Whether they're talking about "sequences" or "sets", they all indicate that the program directs the computer to "solve problems", "perform tasks", basically to do something specific. SqlPac (talk) 18:18, 19 March 2008 (UTC)
A computer program might do something. If executed on a cpu it at least consumes electricity, if read by a person it alters the connection between some neurons in their brain. If a program generates another program that is never executed on a cpu or read by a person, is it a program? What is the sound of one hand clapping?
The sound of one hand clapping is immaterial, as is whether or not printed text fires a spark in your brain. The thing about "computer" programs is that they are designed to instruct a "computer" to do something. A Buddhist koan may not be the best place to start a definition of "computer program"; perhaps a slightly better starting point is with what exactly does a computer program do. And maybe we should try to separate the definition of source code from the definition of computer program? Or, if they are the same thing, then perhaps the two articles should be merged to reflect this reality?
What is the purpose of a computer program? I might write a program to show a perspective employer that I can program in language X, or as part of a requirement of a course I am on, or to sell to customers, or to be put in an advertising brochure (I was one asked to do this), the list goes on and on. Derek farn (talk) 19:01, 19 March 2008 (UTC)
What is the ultimate purpose of a computer program? Is it perhaps to instruct a computer to perform specific tasks? Or is that definition too narrow and Zen-less? SqlPac (talk) 02:46, 21 March 2008 (UTC)
Regarding, "The link you posted, unfortunately, has nothing to do with whether or not a program has to conform to a specific syntax.": You are right. That link has to do with a computer program having the correct syntax but is not meaningful. Timhowardriley (talk) 20:05, 19 March 2008 (UTC)
Yes, and meaningful is a meaningless term for this defintion :) "Computer program" should have an objective definition, and meaningful is a completely subjective adjective. Who's to say the program that I find meaningful will be meaningful to you as well, or vice versa? SqlPac (talk) 02:46, 21 March 2008 (UTC)

[edit] Computer program definition sandbox

Here is the current definition of computer program: The terms computer programs, software program, or just program are the instructions for a computer. What are your suggestions to change it? Should the word 'syntax' be included? Should the word 'sequence' be included? Should the word 'set' be included? Should the word 'order' (or 'orderly') be included? Does a computer program have to be executed at all, or could it be on paper for someone to read? Do computer programs have to be meaningful? Are computer programs the source code in sequential format (imperative), the source code in abstract format (declarative), the object code that finally gets generated after all the translations take place, or a combination of all three? If an optimizer changes the order the programmer requested, is the programmer's order no longer in sequence? Timhowardriley (talk) 20:05, 19 March 2008 (UTC)

I believe the definition of a computer program should be, "computer programs are instructions a syntax that can be parsed by a compiler, interpreter, virtual machine, or CPU." The word 'sequence' is left out but implied. After all, all instructions are assumed to be executed sequentially. (Think recipes or bike assemblies.) Then declarative languages are represented, and object code is represented. Optimizations need not be considered because the instruction are looked at from the author's point of view, not from the translator's point of view which may be different. This definition also includes meaningless programs in that it omits any reference to algorithms, which must be meaningful. Finally, this definition works well for both paper and actual source code. Timhowardriley (talk) 20:36, 19 March 2008 (UTC)
I think that nothing should be both left out and implied. I also think that the definition does not imply any order, least of all sequential. I think your definition above is a lot closer than what is currently on the page; although it doesn't tell me what a program does. This definition is unsatisfying in much the same way that "an objects with wheels and a motor" is an unsatisfying definition of automobile. It doesn't really tell you anything useful about it. What's it do? What's it for? What's it's purpose? The purpose of a "computer program" is really extremely obvious once you remove all the obfuscatory Buddhist koans, metaphysics, and analysis paralysis. A computer program instructs a computer to perform tasks, plain and simple. Once you know what it's for, you can work backwards to include all the hypertechnical details about parsing, compilation, interpretation, etc., and hypothetical posturing you want.
I mean if you really want to get into hypertechnical details, are machine language instructions actually "parsed"? If so, what model of parsing is it? LL, LR, SLR, LALR? Do machine language instructions really go through lexical analysis, conversion to tokens, and syntactic analysis (possibly with creation of a parse tree/AST), all before being executed by the CPU?
I suggest that a decision be made as to what a computer program actually does before you try to redefine it. That, or just use the definition straight out of the dictionary, which is actually looking better by the minute. SqlPac (talk) 03:11, 21 March 2008 (UTC)
  1. I plead ignorant regarding the hypertechnical details of machine language instructions. I can only go by what Tanenbaum (he wrote minix) says in his book, "Structured Computer Organization." He says, "When the source language is essentially a symbolic representation for a numerical machine language, the translator is called an assembler and the source language is called an assembly language." He later explains, that there is a one-to-one mapping between assembly language instructions and machine instructions. To go from the assembly language to the machine instructions, pass one of the process is to take the symbolic representation and build a symbol table. I interpret building the symbol table as parsing each assembly language instruction.
  2. Regarding an automobile being an object with wheels and a motor. I think that's a satisfying definition. I would add that it's an object with wheels and a motor used to transport people (as opposed to being used to transport animals or things, like a truck). Actually, your definition is more specific than the automobile article. The article vaguely calls an automobile, "a vehicle that moves itself rather than being moved by another vehicle or animal." It doesn't even mention motor. Anyway, I don't believe that a definition needs to contain all of the characteristics of the object it's defining, just the essence of it. The article itself can then expand on the essence.
  3. Regarding starting with a dictionary's definition, I say throw it in this sandbox. My bias is for the definition to contain the word "syntax" in it.
  4. Regarding "I think that nothing should be both left out and implied." If you look closely at the vast history of this talk page, you'll notice that there's been an objection to every word ever suggested to be added to the definition of computer program. The objections vary in weight; nontheless, everyone has revert power. I've concluded that if we were still in the 1970s, defining computer program would be easier. But hardware has since increased so much that computer instructions are too varied to capture all of the meanings into a single, clear sentence.
Please post you replies below. The preceding was submitted by Timhowardriley (talk) 16:57, 21 March 2008 (UTC)
I interpret building the symbol table as parsing each assembly language instruction. Converting assembly language to machine language is not really the question at hand. The question is this: once you've assembled your source code and begin feeding those assembled machine language instructions into the CPU, is the CPU "parsing" at that point? There's already an article for source code, which should cover parsing of source code (a category that assembler code falls into). Again, let's not confuse source code with program. An assembled or compiled program is a computer program, but it is not source code. Source code is a subset of program, since a program can also be the compiled/assembled binary.
Regarding an automobile... Actually I believe it mentions motor in the next sentence or two. It also mentions being able to move without the aid of an animal or another vehicle, and it mentions what it transports. It clearly defines an automobile in terms of its purpose and characteristics assigned to it, without getting into the hypertechnical details. In the opening definition you'll notice a conspicuous absence of a detailed discussion of drive trains, the internal workings of transmissions, fuel-injection versus carburetors, etc. You're absolutely right that you don't need to pack all the characteristics of a thing into the first sentence of its definition, which is why I recommend taking two steps back and start by answering the questions "At it's most basic level, what does a computer program do? What is the purpose of a computer program?" That in itself will quickly lead to a decent opening for your article and a much better definition.
Regarding starting with a dictionary's definition... I put a link to it in the page earlier, there are actually a few slightly different definitions on the page. Personally I think mentioning syntax would be great in the second, third, or fourth sentence of the introduction. As you said, you don't need to jam every characteristic of an object into the first sentence of the definition. Start simple. What is the purpose of a computer program? Add all the hypertechnical discussion later.
Regarding "I think that nothing should be both left out and implied." What's happened on this page is that the posters have lost sight of the forest because they're standing face to face with a tree. Not to disparage anyone, but the discussion here has focused on hypertechnical details about whether source code on a printed page is a computer program because it changes your brain wave pattern when you read it. No offense, but who cares? Check the article on television. Is there a discussion of how watching TV changes your brain waves? Would it really add to the article? Would a discussion of photons, LCD, and plasma in the first sentence add a lot of value to the article? Or would it just confuse readers and provoke arguments on the talk page about hypertechical trivia?
No one has sat down to really think about what a computer program actually is; perhaps because it's way too obvious. A computer program in the '70s, '80s, and '90s was simply a means of instructing a computer to perform one or more tasks. In 2008 is a computer program something different from that? Is a computer program no longer a means of instructing a computer to perform one or more tasks? Is it something more important than that? Is it really more complex than that? Can someone here prove that a computer program is more than that? Everything above and beyond that is what I consider technical, and completely unnecessary in the opening sentence. SqlPac (talk) 02:17, 22 March 2008 (UTC)

The terms ill-formed program (C++ Standard, Clause 1.3.4: "input to a C++ implementation that is not a well-formed program.") and the commonly heard syntactically incorrect program both suggest that program can apply to (set|bag|sequence|collection) or instructions that do not completely obey rules of syntax or semantics. I say completely because I would suggest that a sequence of characters ought to have some semblance of looking like a program in some language and not just a random jumble. Derek farn (talk) 20:56, 19 March 2008 (UTC)

So, you're saying that the C++ standard says a computer program need not be in a proper syntax. Boy is that counter-intuitive. That's like a grammar book saying that an English sentence need not be grammatically correct. Please finish the sentence in the standard: "input to a C++ implementation that is not a well-formed program ..." what? Timhowardriley (talk) 21:08, 19 March 2008 (UTC)
The C++ Standard is saying that here are various kinds of programs, one of which is ill-formed. "The grass green is" is an ungrammatical English sentence, but it is still a sentence, written using English words. I can write a program using C++ keywords & tokens that looks like C++ but contains syntax errors. Derek farn (talk) 21:51, 19 March 2008 (UTC)
I don't think "The grass green is" will pass as a sentence in any English grammar book. I also believe that a C++ program that violates the C++ Backus–Naur form of grammar is not a computer program. Again, please finish the sentence in the C++ standard that begins, "input to a C++ implementation that is not a well-formed program ..." what? Timhowardriley (talk) 22:17, 19 March 2008 (UTC)
I find the diff history option useful for spotting when people make small changes. Reread what I wrote, we agree on the status of the sentence. Derek farn (talk) 02:11, 20 March 2008 (UTC)
OK. I see the period now. However, this statement is not a sentence: "input to a C++ implementation that is not a well-formed program." It lacks a verb. Maybe the sentence is meant to be, "Input to a C++ implementation that is not a well-formed program is still a computer program." Anyway, it seems like Derek is rejecting the idea that 'syntax' should be in the definition. Timhowardriley (talk) 05:57, 20 March 2008 (UTC)
This is some more of that hypertechnical trivia that is unnecessary to even address, but since we're veering off track let me go ahead and throw in my 2 cents. The C++ standard definitions are C++ specific. Their maximum effective range ends on the last page of that document. The definitions in the C++ standard do not map one-to-one with every other programming language in existence, and many have their own definitions for different concepts. While we're on the topic of hypertechnical trivia, you'll notice that the title of this article is computer program, not C++ "well-formed program" or "ill-formed program". This is distracting superfluous trivia with no bearing on the discussion at hand. SqlPac (talk) 02:17, 22 March 2008 (UTC)

[edit] RE: "... used to produce them"

In this paragraph, the phrase, "used to produce them", in the sentence, "Computer programs can be categorized by the programming language paradigm used to produce them", produces several problems.

  1. "Them" is supposed to be a pronoun that represents a group of people: "Give them the money." Dictionary.com says "them" is nonstandard for those: "He don't want them books." The sentence in question lacks a group of people to which "them" is supposed to represent.
  2. "Them", even if meant to mean "those", is a dangling modifier. "Them" is a pronoun that seems to represent the "programming language paradigm" because it most closely follows it. As a result, the pronoun gives the reader pause to think how do computer programs produce programming language paradigms? The correct reality is *people* use programming language paradigms to produce computer programs. So is "them" meant to represent "computer programs"? If so, then "them" is too far away in the sentence from the noun it supposedly represents. (I stand corrected after reading User:Koavf's posts.)
  3. "Them" is plural and "programming language paradigm" is singular. Rule: a pronoun must agree in number with the noun it represents. Example: "Many students got A's, giving them motivation to continue studying." Not, "John got an A, giving them motivation to continue studying." (I stand corrected after reading User:Koavf's posts.)
  4. The sentence in question implies that paradigms produce computer programs. The correct reality is *people* use programming language paradigms to produce computer programs. (Added subsequent to original post.) Timhowardriley (talk) 17:45, 4 April 2008 (UTC)

Since "them" does not represent any noun in the sentence, the sentence loses no meaning and gains clarity when the phrase, "used to produce them" is removed.

Please post replies below. The preceding was submitted by Timhowardriley (talk) 06:30, 16 March 2008 (UTC)

Them means something "Them" refers to the computer programs. If I wrote "Contestants in the Olympics are categorized by the countries that sent them," the word "them" would clearly refer to the contestants. Even if this is in fact a non-standard usage of the word "them," it does convey meaning and deleting that phrase would make the sentence unintelligible (what would "Computer programs can be categorized by the programming language paradigm" even mean?) If you want to re-word the sentence while maintaining all of the information in it, be my guest, but your assertion does not match reality. -Justin (koavf)TCM☯ 21:24, 3 April 2008 (UTC)
Furthermore You first claim is simply untrue as well. Dictionary.com states that them is "the objective case of they..." and they is the "nominative plural of he, she, and it" (emphasis added.) "Them" does not necessarily refer to persons (rather than "people" which actually is misused in your sentence.) -Justin (koavf)TCM☯ 21:27, 3 April 2008 (UTC)
  1. Regarding, "the word 'them' would clearly refer to the contestants": Yes, "them" is a pronoun representing a group of people, and contestants are a group of people. "Those" is the pronoun representing a group of things. Computer programs are things, not people. So if a pronoun is needed, then it would be "those", not "them".
  2. Regarding, "... deleting that phrase would make the sentence unintelligible. What would 'Computer programs can be categorized by the programming language paradigm" even mean?'": The sentence wouldn't be written exactly as that. Instead, it would be, "Computer programs can be categorized by programming language paradigm." By removing the article "the", the sentence makes a general statement of fact.
  3. Regarding, "You first claim is simply untrue as well.": OK. It seems like "them" can be an abstraction of "it", if you dig deeper than I did. But I still stand by my first claim that, "'Them' is supposed to be a pronoun that represents a group of people." Again, "those" is the pronoun representing a group of things. I would still argue that upon reading "... used to produce them", the reader of the sentence would have to think, "... used to produce whom?".
  4. Regarding, "rather than 'people' which actually is misused in your sentence.": Could you expand on this?
Please post your replies below. The preceding was submitted by Timhowardriley (talk) 23:24, 3 April 2008 (UTC)
People v. persons People is a group of persons or a nation with a common ethnicity or a folk. "Persons" is the plural of person. I think the phrase "Computer programs can be categorized by programming language paradigm" is too vague and it still omits information that is important in the original phrase - namely, that these programming language paradigms produced them. I think that in the vernacular as well as in definitional usage, "them" is completely appropriate. -Justin (koavf)TCM☯ 23:40, 3 April 2008 (UTC)
Regarding "namely, that these programming language paradigms produced them."
  1. This inference is exactly why the phrase should be removed. It adds information that is not true, namely that paradigms produce computer programs. A paradigm is simply a category -- it has no power to produce anything. People produce computer programs, and the resulting programs fall into one of two paradigms.
  2. If "them" is an appropriate pronoun for a group of things, then "those" should also be an appropriate pronoun for a group of things. "Give those to them." OK, "them" does have a vernacular acceptance for a group of things, now that I think of it more. "Some pencils need sharpening. Sharpen them now." But whether "them" or "those" is used as the pronoun in the sentence in question, it should be removed along with it's supporting verb, "used to produce ..." Again, paradigms do not produce computer programs.
  3. The sentence in question should be a simple topic sentence, "Computer programs can be categorized by programming language paradigm. Two of the main paradigms are ..." Another topic sentence in this same paradigm (pardon the pun) is, "Businesses can be categorized by output paradigm. Two of the main paradigms are product and service." Still another topic sentence, "Animals can be categorized by behavioral paradigm. Two of the main paradigms are aggressive and passive." You wouldn't expect any additions, like "used to [anything] them", in these topic sentences.
Submitted by Timhowardriley (talk) 16:25, 4 April 2008 (UTC)
Thanks to Justin (koavf) for such a detailed analysis of the grammar issues surrounding the use of this in a particular sentence. Timhowardriley and I have been involved in protracted discussions before on the use of particular terms and phrases, and I know he sometimes gets set on the use of some term. I objected to the original edit purely because it produced a nonsensical sentence. I am happy with any introductory sentence that clearly expresses the intent and keeps people happy. Derek farn (talk) 19:38, 4 April 2008 (UTC)
Derek, are you following the thread? The word "this" is not the issue. Assuming you mean "them", the issue is do paradigms produce computer programs? The sentence having the phrase, "used to produce them", implies that paradigms produce computer programs. Paradigms do not produce programs, people (persons) do. Your comment for this revert was, "POintless grammar rule ruins ease of understanding". I think the grammar rule you're referring to is pronouns must not dangle; instead, they must unambiguously refer to a corresponding noun. This grammar rule is not pointless. Yes, a consensus is forming to conclude that "them" refers to "computer programs" and is, therefore, not dangling. However, the phrase in question implies something nonsensical and should be removed. As an aside, if you're going to contribute to the talk, stick to the subject at hand. Do not interject any personal generalizations like, "... he sometimes gets set on the use of some term." Timhowardriley (talk) 00:38, 5 April 2008 (UTC)

[edit] Yes but... is that C?

The code in the article figure:

main()
   {
   output_string("Hello, Wikipedia!");
   return 0;
   }

will most certainly not compile on ANSI C (for two reasons). It might be some sort of proprietary subdialect. It's been a long time since I wrote anything in C, but it might look a lot more like:

#include <stdio.h>

int main(void)
   {
   puts("Hello, Wikipedia!");
   return 0;
   }

--Xyzt1234 (talk) 09:55, 25 April 2008 (UTC)

Maybe somebody left out the function definition for output_string(). :) SqlPac (talk) 02:34, 6 May 2008 (UTC)