Computer program: Difference between revisions

Content deleted Content added
m Reverted edits by 1.46.206.61 (talk) (HG) (3.4.13)
Reverted 1 edit by 1.1.250.125 (talk): Using Wikipedia for advertising/promotion
 
(7 intermediate revisions by 6 users not shown)
Line 3:
[[File:JavaScript_code.png|thumb|[[Source code]] for a computer program written in the [[JavaScript]] language. It demonstrates the ''appendChild'' method. The method adds a new child node to an existing parent node. It is commonly used to dynamically modify the structure of an HTML document.]]
{{Program execution}}
 
{{merge from|Software|discuss=Talk:Computer program#Merge with Software|date=June 2025}}
 
A '''computer program''' is a [[sequence]] or set{{efn|The [[Prolog]] language allows for a database of facts and rules to be entered in any order. However, a question about a database must be at the very end.}} of instructions in a [[programming language]] for a [[computer]] to [[Execution (computing)|execute]]. It is one component of [[software]], which also includes [[software documentation|documentation]] and other intangible components.<ref name="ISO 2020">{{cite web
Line 18 ⟶ 16:
}}</ref>
 
A ''computer program'' in its [[human-readable]] form is called [[source code]]. Source code needs another computer program to [[Execution (computing)|execute]] because computers can only execute their native [[machine instructions]]. Therefore, source code may be [[Translator (computing)|translated]] to machine instructions using a [[compiler]] written for the language. ([[Assembly language]] programs are translated using an [[Assembler (computing)|assembler]].) The resulting file is called an [[executable]]. Alternatively, source code may execute within an [[interpreter (computing)|interpreter]] written for the language.<ref name="cpl_3rd-ch1-7_quoted">{{cite book
| last = Wilson
| first = Leslie B.
Line 48 ⟶ 46:
}}</ref>
 
If the source code is requested for execution, then the operating system loads the corresponding interpreter into memory and starts a process. The interpreter then loads the source code into memory to translate and execute each [[Statement (computer science)|statement]]. Running the source code is slower than running an [[executable]].<ref name="cpl_3rd-ch1-7">{{cite book
| last = Wilson
| first = Leslie B.
Line 60 ⟶ 58:
==Example computer program==
 
The [["Hello, World!" program]] is used to illustrate a language's basic [[Syntax (programming languages)|syntax]]. The syntax of the language [[Dartmouth BASIC|BASIC]] (1964) was intentionally limited to make the language easy to learn.<ref name="cpl_3rd-ch2-30_quote1">{{cite book
| last = Wilson
| first = Leslie B.
Line 207 ⟶ 205:
===ENIAC===
[[File:ENIAC-changing_a_tube.jpg|thumb|right|Glenn A. Beck changing a tube in ENIAC]]
The [[Electronic Numerical Integrator And Computer]] (ENIAC) was built between July 1943 and Fall 1945. It was a [[Turing complete]], general-purpose computer that used 17,468 [[vacuum tube]]s to create the [[Electronic circuit|circuits]]. At its core, it was a series of [[Pascaline]]s wired together.<ref name="eniac-ch5-p102">{{cite book
| last = McCartney
| first = Scott
Line 368 ⟶ 366:
}}</ref> The MOS transistor is the primary component in ''integrated circuit chips''.<ref name="digital_age"/>
 
Originally, [[integrated circuit]] chips had their function set during manufacturing. During the 1960s, controlling the electrical flow migrated to programming a [[Diode matrix|matrix]] of [[read-only memory]] (ROM). The matrix resembled a two-dimensional array of fuses. The process to embed instructions onto the matrix was to burn out the unneeded connections. There were so many connections, [[firmware]] programmers wrote a ''computer program'' on another chip to oversee the burning. The technology became known as [[Programmable ROM]]. In 1971, Intel [[stored-program computer|installed the computer program onto the chip]] and named it the [[Intel 4004]] [[microprocessor]].<ref name="intel_4004">{{cite web
| url=https://spectrum.ieee.org/chip-hall-of-fame-intel-4004-microprocessor
| title=Chip Hall of Fame: Intel 4004 Microprocessor
Line 390 ⟶ 388:
===x86 series===
[[File:IBM_PC-IMG_7271_(transparent).png|thumb|right|The original [[IBM Personal Computer]] (1981) used an Intel 8088 microprocessor.]]
In 1978, the modern [[software development]] environment began when Intel upgraded the [[Intel 8080]] to the [[Intel 8086]]. Intel simplified the Intel 8086 to manufacture the cheaper [[Intel 8088]].<ref name="infoworld_8-23-82">{{cite web
| url=https://books.google.com/books?id=VDAEAAAAMBAJ&pg=PA22
| title=Bill Gates, Microsoft and the IBM Personal Computer
Line 412 ⟶ 410:
==Programming paradigms and languages==
 
[[Programming language]] features exist to provide building blocks to be combined to express programming ideals.<ref name="stroustrup-ch1-10">{{cite book
| last = Stroustrup
| first = Bjarne
Line 498 ⟶ 496:
| page = 160
| isbn = 0-619-06489-7
}}</ref> ''Machine language'' requires the programmer to enter instructions using ''instruction numbers'' called [[machine code]]. For example, the ADD operation on the [[PDP-11 architecture|PDP-11]] has instruction number 24576.{{efn|Whereas this is a decimal number, PDP-11 code is always expressed as [[octal]].}}<ref name="sco-ch7-p399">{{cite book
| last = Tanenbaum
| first = Andrew S.
Line 643 ⟶ 641:
| page = 19
| isbn = 0-201-71012-9
}}</ref> Emerging from a committee of European and American programming language experts, it used standard [[mathematical notation]] and had a readable, structured design. Algol was first to define its [[Syntax (programming languages)|syntax]] using the [[Backus–Naur form]].<ref name="cpl_3rd-ch2-19"/> This led to [[Syntax-directed translation|syntax-directed]] compilers. It added features like:
* [[Block (programming)|block structure]], where variables were local to their block.
* arrays with variable bounds.
Line 1,920 ⟶ 1,918:
The levels of coupling from worst to best are:<ref name="se-ch8-226"/>
 
* ''Content Coupling'': A module has content coupling if it modifies a [[local variable]] of another function. COBOL used to do this with the ''alter'' verb.
* ''Common Coupling'': A module has common coupling if it modifies a global variable.
* ''Control Coupling'': A module has control coupling if another module can modify its [[control flow]]. For example, <code>perform_arithmetic( perform_addition, a, b )</code>. Instead, control should be on the makeup of the returned object.