Talk:Computer program

From Wikipedia, the free encyclopedia
Jump to: navigation, search
          This article is of interest to the following WikiProjects:
WikiProject Computing (Rated B-class, Top-importance)
WikiProject icon This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
B-Class article B  This article has been rated as B-Class on the project's quality scale.
 Top  This article has been rated as Top-importance on the project's importance scale.
 
WikiProject Computer science (Rated B-class, Top-importance)
WikiProject icon This article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
B-Class article B  This article has been rated as B-Class on the project's quality scale.
 Top  This article has been rated as Top-importance on the project's importance scale.
 
WikiProject Software / Computing  (Rated B-class, Top-importance)
WikiProject icon This article is within the scope of WikiProject Software, a collaborative effort to improve the coverage of software on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
B-Class article B  This article has been rated as B-Class on the project's quality scale.
 Top  This article has been rated as Top-importance on the project's importance scale.
Taskforce icon
This article is supported by WikiProject Computing.
 
Former good article Computer program was one of the Engineering and technology good articles, but it has been removed from the list. There are suggestions below for improving the article to meet the good article criteria. Once these issues have been addressed, the article can be renominated. Editors may also seek a reassessment of the decision if they believe there was a mistake.
Article milestones
Date Process Result
November 4, 2007 Good article nominee Not listed
November 9, 2007 Good article nominee Listed
November 17, 2007 Good article reassessment Delisted
Current status: Delisted good article

New introduction (Suggestion v 2.2)[edit]

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)
I'd say not - just because Timhowardriley has only one come to mind doesn't mean there aren't more. 24.68.148.215 (talk) 05:55, 18 December 2009 (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)

The definition should be changed to include interrupters. What do you call something in JAVA? Not a program?. A lot of PASCAL programs were compiled to P-Code. --Steamerandy (talk) 20:50, 28 September 2014 (UTC)

Must be me[edit]

"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 - [1]) 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)

Computer program definition sandbox[edit]

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)

A program does not have to be a sequence of instructions nor have to be executed by a processor. A computer program could be a set of rules.

The most general definition is: A computer program directs the operations a computer performs.

Programs are instruction given to a computer (or interrupter, program) directing it's actions.

You can not write a computer program in JAVA sense it is not run buy the computer? Right?

Does not a spreadsheet provide programming

--Steamerandy (talk) 22:03, 28 September 2014 (UTC)

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

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)

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

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)

Made a standard conforming variant. --Sebbb-m (talk) 13:47, 26 August 2008 (UTC)

Self-reference[edit]

The reference to Wikipedia in the example code is unwarranted (Wikipedia:Avoid self-references); the usual "Hello world" would be better. I'd also suggest the use of embedded text instead of an image, as in spell checker. Dcoetzee 21:35, 20 June 2008 (UTC)

Programmable machines[edit]

The article should address the idea that there are programmable machines that are not computers. Calculators and robots aren't computers according to their definitions in Wikipedia, so I think they work as examples.Diego (talk) 06:29, 31 July 2008 (UTC)

I don't think it's up to this article to define a computer. Is a CPU required? What about the IBM tabulating machine and other calculators before the Von Neumann architecture? Moreover, wp:lead says, "The lead serves both as an introduction to the article below and as a short, independent summary of the important aspects of the article's topic." And nuances like are calculators computers is not covered in the article. Timhowardriley (talk) 15:58, 31 July 2008 (UTC)
I don't mean to define what a computer is , but I think that those questions you ask should be addressed as relevant context of this article, because programs can also be written for those kinds of machines. I'll try to find some relevant sources that explore the meaning of "programming" and its limits - probably something from Douglas Hofstadter will give some insights. Diego (talk) 16:07, 31 July 2008 (UTC)
Also, keep in mind that there should be paragraph in the article if the lead is to continue to be an independent summary. Timhowardriley (talk) 16:13, 31 July 2008 (UTC)

Relationship between computer program and algorithm[edit]

I see a strong coupling between computer programs and algorithms. There should be a paragraph that compares and contrasts these subjects. One is started here, and it should be expanded upon and maybe even be moved up to the top of the article. But this edit added a nuance in the introduction that isn't covered in the article. To repeat my previous post: wp:lead says, "The lead serves both as an introduction to the article below and as a short, independent summary of the important aspects of the article's topic." —Preceding unsigned comment added by Timhowardriley (talkcontribs)

If you keep reading, right below it states "This should not be taken to exclude information from the lead, but to include it in both the lead and body" ;-) Since covering that subject is important, I think it's better to keep that edit in the lead even if it's inconsistent, until it can be expanded, instead of deleting it. Otherwise that information could never be added in the future, not having a 'hook' on which to expand it. Diego (talk) 17:37, 31 July 2008 (UTC)
I agree there's enough ambiguity to allow for judgement. Timhowardriley (talk) 17:42, 31 July 2008 (UTC)

Self modifying code: out-of-scope facts[edit]

I moved the following sentences from the Self Modifying Code paragraph to this talk page. I don't understand the technology that's being described; however, caching has a clear definition, separate from Self modifying code. These facts either are dubious or belong someplace else. If my characterization is wrong, please revert this edit.

  • "Sometimes self modification is used as a form of dynamic optimization where the code becomes more efficient through caching or similar techniques. The technique is also often used to nullify all overhead of already embedded debugging code after a 'one time' test decides that debugging should be 'switched off' for the run. Early mainframe operating systems allowed program overlays as a normal practice for application programs, to conserve memory." Timhowardriley (talk) 20:46, 20 February 2009 (UTC)

Script vs Program[edit]

I think that script ends in time while program runs indefinitely (if not terminated). — Preceding unsigned comment added by 89.31.161.101 (talkcontribs) 04:43, 13 November 2009

Any citation for that?
It's not a definition I have ever come across, and it contradicts the ones I have come across. JöG (talk) 10:02, 25 November 2012 (UTC)
This is not correct. As a computer programmer and a student studying software at UC Berkeley, a script is an easily understandable program written in a flexible programming language, such as Python. A regular program is a rough, probably compiled executable file, most likely written in a more difficult to understand language such as C. --Carrot Lord (talk) 09:00, 20 January 2013 (UTC)

Examples and history[edit]

Could we get a few more examples? Hello, world is interesting to me as a professional, but I think non-programmers would be thinking, "What's the point?" I'd like to see some actual calculations.

Also, some historical examples would be nice. How about some of the first actual computer programs used for the Mark I that Grace Hopper and her colleagues wrote? I'd like to see how their source code contrasts with modern source code. --Uncle Ed (talk) 21:29, 4 April 2011 (UTC)

I added a generic source code image to the top of the page (a while ago). It is not written in a real programming language. However, the code is more like a mixture of JavaScript and Ruby. I'm not sure. I just invented the fictional code. It is however, based off a personal project where I actually invent syntax for a real language. Even so, the image does NOT contain the code of a real programming language, making it very generic and easy to understand. --Carrot Lord (talk) 08:59, 20 January 2013 (UTC)

More names[edit]

Computer programs, besides being called apps and software, can also be called tools, utilities, and gadgets. --Carrot Lord (talk) 15:49, 20 January 2013 (UTC)

Spelling note[edit]

If I understand correctly, program is the American spelling of programme, so there should be some disambiguation here (from Computer Programme, the TV show). However, while it is the correct spelling, it is seldom used in British English. It appears like billion, though, that "computer program" now dominates in British English as well. Shouldn't the article reflect this? Ema--or (talk) 21:35, 1 November 2014 (UTC) PS That has already been addressed before I asked.Ema--or (talk) 23:13, 31 March 2015 (UTC) PPS This search bears this out.Ema--or (talk) 23:31, 31 March 2015 (UTC)