Talk:Computer program

Latest comment: 4 months ago by Timhowardriley in topic Is Prolog section too detailed?
Former good articleComputer 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
DateProcessResult
November 4, 2007Good article nomineeNot listed
November 9, 2007Good article nomineeListed
November 17, 2007Good article reassessmentDelisted
October 28, 2021Good article nomineeNot listed
June 7, 2022Good article nomineeNot listed
June 25, 2022Good article nomineeNot listed
Current status: Delisted good article


Correct results for Prolog numeric grade example

edit

The displayed results for Prolog's numeric grade example is not what the user would expect. The article says the results will display: X = 'A'. The expected results should display: X = 4. Timhowardriley (talk) 19:59, 16 August 2023 (UTC)Reply

The example in its current form has two relations, which can be queried in isolation, or which can be queried in combination (like a join in a relational database). For example:
numeric_grade('A', 4).
numeric_grade('B', 3).
numeric_grade('C', 2).
numeric_grade('D', 1).
numeric_grade('F', 0).
numeric_grade(X, -1) :- not X = 'A', not X = 'B', not X = 'C', not X = 'D', not X = 'F'.
grade('The Student', 'A').
?- grade('The Student', X), numeric_grade(X, Y).
X = 'A',
Y = 4
Alternatively, the query could be used to define a new relation, which gives the grade of a student as a number:
numeric_grade('A', 4).
numeric_grade('B', 3).
numeric_grade('C', 2).
numeric_grade('D', 1).
numeric_grade('F', 0).
numeric_grade(X, -1) :- not X = 'A', not X = 'B', not X = 'C', not X = 'D', not X = 'F'.
grade_as_number(Student, Number) :- 
        grade(Student, Letter), numeric_grade(Letter, Number).
grade('The Student', 'A').
?- grade_as_number('The Student', Number).
Number = 4

Robert Kowalski (talk) 08:18, 18 August 2023 (UTC)Reply

Followup: It would be nice to learn Prolog's syntax for forming functions. Could this example be converted to a function? If so, then how would the the driver program execute it? Timhowardriley (talk) 20:33, 16 August 2023 (UTC)Reply

Here is the example in Ciao Prolog's functional syntax:
numeric_grade('A') := 4.
numeric_grade('B') := 3.
numeric_grade('C') := 2.
numeric_grade('D') := 1.
numeric_grade('F') := 0.
numeric_grade(X) := -1 :-  X \= 'A', X \= 'B', X \= 'C', X \= 'D', X \= 'F'.
grade_as_number(Student) := numeric_grade(grade(Student)).
grade('The Student') := 'A'.
grade(bob) := good.

?- ~grade_as_number(Student) = Number.
Number = 4,
Student = 'The Student' ;

Number = -1,
Student = bob
Just for fun, the query asks for all input-output pairs that satisfy the functional relationship "grade_as_number". Good for debugging.
Ciao executes the functional program by transforming it into the relational representation, with the value of the function as the last argument of the relation.

Prolog example use of word "clause"

edit

The comprehensive example uses the word "clause" twice: "third clause" and "fourth clause". What are the first two clauses? Perhaps the clauses could be labeled in comments. Timhowardriley (talk) 12:33, 18 August 2023 (UTC)Reply

Good idea. Thanks. Robert Kowalski (talk) 15:02, 18 August 2023 (UTC)Reply

Prolog rule 4 a subclass or superclass?

edit

@Robert Kowalski Rule 4) seems to define a superclass, not a subclass: A thing is a creature if the thing is a dragon:

is_a_creature(X) :-
    is_a_dragon(X).

Combining Rule 2) to Rule 4) constrains a creature to be a dragon if one parent is a dragon. I'm trying to wrap my head around the possibility of introducing a monster to the mix. A monster is a creature that doesn't billow fire.

is_a_monster(X) :-
    is_a_creature(X),
    not billows_fire(X).

Yet, the new rule would seem to contradict rule 4), unless rule 4) defines a superclass. Timhowardriley (talk) 00:54, 22 August 2023 (UTC)Reply

@Timhowardriley Hm... You are right that rule 4 is not a definition of dragon as a subclass of creature. Nor is it a definition of creature as a superclass of dragon. At best, it is only a partial definition of the superclass creature, because there might be other creatures, such as monsters, which do not billow fire, and which therefore are not dragons. Good catch! Robert Kowalski (talk) 08:56, 22 August 2023 (UTC)Reply

Illustration

edit
#include <stdio.h>

int
main (void)
{
  puts ("Hello, world!");
}
A "Hello, World!" program in the influential programming language C

I just removed the image from the lead sentence of this article as I think it is quite uninformative. It's a stock-photo-like photo of HTML and JavaScript on a website, which, while it could be considered a computer programme, is hardly a prime example thereof. The formatting is also clearly for aesthetic rather than functional reasons, making it rather misrepresentative of how code actually looks. Now I'd like to discuss what if anything we should use to illustrate this article. I personally would probably prefer some kind of schematic representation, but I don't know if we have any good ones – one was removed above for being too complicated. Another option could be to include an {{image frame}} with some actual code, like to the right. We could include multiple languages to illustrate different paradigms. However, this may be going too much into the territory of programming languages, rather than the abstract conept of a computer programme. Any ideas? -- Maddy from Celeste (WAVEDASH) 17:10, 5 December 2023 (UTC)Reply

True, the prior image worked as eye-candy (aesthetic reason). Perhaps this JavaScript eye-candy shows more function: [1]. Otherwise, the above image-frame works -- without the word "influential" in the caption. Maybe an image-frame of a JavaScript snippet is a good compromise. Timhowardriley (talk) 20:23, 5 December 2023 (UTC)Reply
I wanted to try out the image frame thing because I assume it's better for accessibility and semantic Web, but I also realize an image can have certain advantages. I'd still like to explore the possibility of some simple conceptual illustration, but I'm not sure I'm the best qualified to say how one should illustrate this concept. Something I think we also should consider, is that most readers will not be interacting with programmes in source code form; that is not to say that a user interface is the best choice of image either, but maybe that speaks for a more conceptual illustration as well? -- Maddy from Celeste (WAVEDASH) 19:13, 6 December 2023 (UTC)Reply

This article has major problems

edit

First, it's waaaaaaaaaaaaaaaaaaaaaaaay too long. It seems try to cover everything known to man about software. Too much. Most of the content should be removed or moved to other pages.

You have made a mess by replying to my comment in the middle of it. I can't tell what you said vs. what I said. Well intentioned, but poorly executed. I can say the same of your writing style in the article. Stevebroshar (talk) 14:16, 30 June 2024 (UTC)Reply

Second, just focusing on the leader, it's way off base...

"It is one component of software, which also includes documentation and other intangible components" I guess not wrong seems lame and begs the question: what intangible components?

  • Hover over the citation to see the quote. The citation's quote says, "[Software includes] all or part of the programs, procedures, rules, and associated documentation of an information processing system." Procedures, rules, and associated documentation constitute intangible components. Timhowardriley (talk) 22:37, 5 February 2024 (UTC)Reply

"A computer program in its human-readable form is called source code" yah. no. Programs _are_ executables –} machine code. They are not human-readable. The source code from which you build a program is not a program.

The original statement A computer program in its human-readable form is called source code is not completely wrong, but it's misleading and overly folky for my taste and IMO for WP. ... Regardless, the concept of source code does not include machine code. Source code specifically means code that can be used to generate machine code. It is the source of machine code. ... Interpreted code (which is not translated to machine code) is also called source but that's a different story. Stevebroshar (talk) 14:12, 30 June 2024 (UTC)Reply

"language's compiler" Languages don't have compilers. A compiler is for a certain language; compiles code of a certain language.

"source code may execute within the language's interpreter." nope. The interpreter is a program. The source code that it runs is simply input; not a program itself. Interpreted source code is sometimes called a script – which is similar to a program but has the special distinction that it's not compiled; is human readable.

"If the executable is requested for execution, then the operating system loads it into memory and starts a process. The central processing unit will soon switch to this process so it can fetch, decode, and then execute each machine instruction." not wrong, but very ham-handed. How about: Generally, the operating system copies a program from permanent storage into memory (i.e. RAM) and starts executing its instructions, starting at the entry point, as what is called a process. The OS executes instructions in sequence and sometimes in parallel with conditional branching logic that directs the flow of logic. In some cases, a program is run directly from permanent storage – without copying instructions to RAM.

  • All of your criticisms are with the lead section, where a lot of thought went into every sentence. The lead section is not intended to be fully nuanced. It is just generalities, and the rest of the article drills down to the details. Timhowardriley (talk) 22:37, 5 February 2024 (UTC)Reply
    Yeah. you are not getting my point. And, you seem defensive. You disagree with everything I've said. I guess I'll just leave the article as-is since you would probably make a stink if I try to make improvements. You seem like that sort of person.
  • But, I will respond to your comments since you took the time to respond to me.
    I went into detail on the lead as a start. It would take a long time (too long) to describe in detail the issues I have with the rest.
    Broad subject: yes. As broad as this article: nope. I see no point in describing the history of computing just to describe the program. For example, how does telling me that Charles Babbage spent £17000 on his failed machine help me understand the program? Interesting: yes; correct: if you say so; cited: sure, good job. Relevant? nope.
  • This is an article about computing in general, but it's supposed to be about the program. For example, it says "The waterfall model is an implementation of a systems development process". I somewhat randomly picked that sentence from the body to prove a point. The body is not about the program.
  • Analogy: To describe what a carburetor is, I don't need to understand the history of the auto industry or how much Henry Ford spent to build this his first Model T plant.
    ...
    About the first sentence and footnote:
    Burying important info in a footnote is not a good writing technique. References allow the reader to verify the content. The text of the reference should not be the content. ... This is my opinion about good writing. I learned it in college.
    Further, I wouldn't say that "Procedures, rules, and associated documentation" are "intangible components". Seems like an off-the-mark categorization. IOW confusing.
    This is the first sentence -- basically the definition of the term computer program. It should be super tight! It's what shows when you hover over a link in another page. This says that a program is part of something that includes intangible components. Is that one of the most important aspects of program? Deserving of sentence #1? I think not. ... It's not wrong, but it's off the mark.
    If you wrote that, then I understand that that critique may sting. Sorry if I touch a nerve. But, come on. It's not good.
    ...
    This article is for the curious reader? The intent may be to delight the curious reader, but the result is to torture the reader. It holds them captive while they read through irrelevant details searching for the useful parts.
    I was curious to learn about program -- including its history. But, after a few pages I was bored! I thought: this is not about the program. It's about computing.
    An author has the power to engage a reader or to bore them to death.
    ...
    "Source code has many levels, from machine code on upward" Well. no. Machine code is definitely _not_ source code. Source code is human readable text and machine code is a stream/block of numeric/binary data. Further, source code is not the same as a program. A program can be built from source code. Analogy: A book consists of text, but a block of text is not a book.
    ... but on that point ...
    After reading about older variants of BASIC, I now see how interpreted source code can be a program. It's a challenging concept for me. For example, int main(){printf("hello");} is not what I'd call a program. I can build a program from it, but that text is not a program. But in the context of old BASIC 10 PRINT "hello" is a program. Or maybe it's not. Maybe a program is more conceptual. I can define the behavior of a program with source code or machine code.
    A program seems to be the encoding of machine behavior in some language (source or machine). And it must have an entry point since since without that the encoding is a library which is different.
    I'm curious to learn more about what makes something a program -- the defining characteristics. For example, how can very different things like interpreted BASIC and an app on my phone both be programs. Sadly, I don't see that in the article.
    ...
    Is the info of the article researched and well cited? sure. Didn't say it wasn't. Why did you jump to that?
  • Just because something is researched and well cited does not make it well-suited for the context, and writing is all about context. The context here is an encyclopedia entry for the computer program; not the computer or software or programming or programmers or programming languages...
    I stand by my suggestion to remove most of this article. Not saying it should be thrown out the window. Move it into other articles where it's more appropriate.
    You seem to be a programmer. This article is like a class with too many lines of code. It should be re-factored into several smaller classes.
    ...
    A language does not have/own a compiler. A compiler is for a language or languages or version(s)/variant(s) of a language or something like that.
    A C compiler is not owned by the C language. A C compiler is designed for a specific version and dialect of C; probably a super or sub set. I think "C's compiler" _implies_ various incorrect things like there is only one C compiler and/or the compiler defines the language. A compiler does what it does regardless of how a language is defined. Also, people don't use that verbiage. Seems invented in this article.
    ...
    "Looking down from 10,000 feet, this sentence correctly describes the context switch. Further on in the kernel program subsection, it details the context switch."
    Context switch. OK. Seems important. Use that term. As a reporter says: Don't bury the lead.
    And, that's the point of this sentence? I had no idea. I stand by my classification of ham-handed. Not saying it wrong. But, yikes. It is poorly written.
    Also, it is so particular to a modern computer which is in stark contrast to the rest of the article that talks about history. Did Charles Babbage's computer do this too?
    Further, some computers do not load the program into RAM. So, it's also misleading even for modern computers.
    Further, not all computers have an operating system. Does such a computer have programs? I'm curious.
    ...
    "The lead section is not intended to be fully nuanced. It is just generalities, and the rest of the article drills down to the details" I get that. but ... one should be able to read the lead without wondering: what does that mean? It should leave the reader thinking: that's interesting; I want to learn more. I was so turned off by the poor writing and inaccuracies of the header that I didn't want to press on. I did scan the rest of the article a few times so that I could talk about it here. But, I don't really want to read it in depth. I am not engaged. My curiosity died.
    - Stevebroshar (talk) 07:43, 7 February 2024 (UTC)Reply

Stevebroshar (talk) 20:33, 5 February 2024 (UTC)Reply

  • Thank you for your feedback. This was the state of the article when I started editing it. Throughout the decades, I kept all of my college textbooks. Working on this article forced me to dig through them with a new perspective. Timhowardriley (talk) 14:57, 7 February 2024 (UTC)Reply
    Much of the info that you added is very good, but much of it is not appropriate for this context -- for 'computer program'. And for writing, context is so important.
    IMHO much of the content of this page should be moved to other pages. Like for computer, software engineering, software development, software and so on. As this seems to be a labor of love for you, maybe you would like to do that.
    Please do not be offended ... but that old version is better. It's not perfect, but is much more focused and reads better.
    I see that you added a lot of content that is clearly well-researched and I applaud your effort. Stevebroshar (talk) 21:43, 7 February 2024 (UTC)Reply

Thanks

edit

Dear @Timhowardriley I tried working with you, but you have no interest in that. You are close-minded, and disagreeable. Not a team player. You shot down all the concerns and suggestions I made, horked up the comments I made above and now reverted my careful, well considered and IMO valuable edits. You are a hack and a bully. This article is terrible, yet you seem to think it's your pet and cannot live without one precious word of it. Thanks very little. Stevebroshar (talk) 16:16, 30 June 2024 (UTC)Reply

Please be polite. Timhowardriley (talk) 18:59, 30 June 2024 (UTC)Reply

Is Prolog section too detailed?

edit

This edit has merit. I reverted it because such a big change should first be talked about. The edit trimmed Prolog's second and third examples. These examples were added by Robert Kowalski himself. Given his stature as a pioneer of the language, it's an honor to collaborate with him. Nonetheless, the first example alone gives the reader enough information to decide whether or not to dig deeper. Timhowardriley (talk) 02:26, 1 July 2024 (UTC)Reply