Content deleted Content added
Alexeyevitch (talk | contribs) rv test |
No edit summary Tags: Mobile edit Mobile web edit |
||
(50 intermediate revisions by 29 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}}
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
| title=ISO/IEC 2382:2015
Line 15 ⟶ 16:
}}</ref>
A ''computer program'' in its [[
| last = Wilson
| first = Leslie B.
Line 45 ⟶ 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
| last = Wilson
| first
==Example computer program==
The [["Hello, World!" program]] is used to illustrate a language's basic
| last = Wilson
| first = Leslie B.
Line 191 ⟶ 186:
| page = 234
| isbn = 978-0-669-17342-0
}}</ref> All present-day computers are [[
| last = Linz
| first = Peter
Line 204 ⟶ 199:
===ENIAC===
[[File:ENIAC-changing_a_tube.jpg|thumb|right|Glenn A. Beck changing a tube in ENIAC]]
The [[
| last = McCartney
| first = Scott
Line 252 ⟶ 247:
| isbn = 978-0-8027-1348-3
| url = https://archive.org/details/eniac00scot/page/118
}}</ref> [[
| last = McCartney
| first = Scott
Line 270 ⟶ 265:
| isbn = 978-0-8027-1348-3
| url = https://archive.org/details/eniac00scot/page/123
}}</ref><ref>{{Citation |last=Huskey |first=Harry D. |title=EDVAC |date=2003-01-01 |encyclopedia=Encyclopedia of Computer Science |pages=626–628 |url=https://dl.acm.org/doi/10.5555/1074100.1074362 |access-date=2025-04-25 |place=GBR |publisher=John Wiley and Sons Ltd. |isbn=978-0-470-86412-8}}</ref>
The [[IBM System/360]] (1964) was a family of computers, each having the same [[
| last = Tanenbaum
| first = Andrew S.
Line 282 ⟶ 277:
| url = https://archive.org/details/structuredcomput00tane
| url-access = registration
}}</ref> The [[IBM System/360 Model 195|Model 195]] was the most premium. Each System/360 model featured [[
IBM planned for each model to be programmed using [[PL/1]].<ref name="cpl_3rd-ch2-27">{{cite book
Line 292 ⟶ 287:
| page = 27
| isbn = 0-201-71012-9
}}</ref> A committee was formed that included [[COBOL]], [[Fortran]] and [[ALGOL]] programmers. The purpose was to develop a language that was comprehensive, easy to use, extendible, and would replace Cobol and Fortran.<ref name="cpl_3rd-ch2-27"/> The result was a large and complex language that took a long time to [[
| last = Wilson
| first = Leslie B.
Line 315 ⟶ 310:
===Very Large Scale Integration===
[[Image:Diopsis.jpg|thumb|right|A VLSI integrated-circuit [[die (integrated circuit)|die]] ]]
A major milestone in software development was the invention of the [[Very Large Scale Integration]] (VLSI) circuit (1964).
[[Robert Noyce]], co-founder of [[Fairchild Semiconductor]] (1957) and [[Intel]] (1968), achieved a technological improvement to refine the [[Semiconductor device fabrication|production]] of [[field-effect transistor]]s (1963).<ref name="digital_age">{{cite book
Line 336 ⟶ 322:
| archive-url=https://web.archive.org/web/20230202181649/https://books.google.com/books?id=UUbB3d2UnaAC&pg=PA46
| url-status=live
}}</ref> The goal is to alter the [[electrical resistivity and conductivity]] of a [[
| url=https://www.osti.gov/servlets/purl/1497235
| title=Manufacturing of Silicon Materials for Microelectronics and Solar PV
Line 347 ⟶ 333:
| archive-url=https://web.archive.org/web/20230323163602/https://www.osti.gov/biblio/1497235
| url-status=live
}}</ref> The [[
| url=https://www.britannica.com/technology/integrated-circuit/Fabricating-ICs#ref837156
| title=Fabricating ICs Making a base wafer
Line 374 ⟶ 360:
}}</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.
| url=https://spectrum.ieee.org/chip-hall-of-fame-intel-4004-microprocessor
| title=Chip Hall of Fame: Intel 4004 Microprocessor
Line 393 ⟶ 379:
| access-date=February 5, 2022
}}</ref>
===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
| url=https://books.google.com/books?id=VDAEAAAAMBAJ&pg=PA22
| title=Bill Gates, Microsoft and the IBM Personal Computer
Line 427 ⟶ 400:
===Changing programming environment===
[[File:DEC VT100 terminal transparent.png|thumb|right|The [[Digital Equipment Corporation|DEC]] [[VT100]] (1978) was a widely used [[computer terminal]].]]
VLSI circuits enabled the [[
==Programming paradigms and languages==
| last = Stroustrup
| first = Bjarne
Line 456 ⟶ 429:
| isbn = 978-0-321-56384-2
}}</ref> For example, different paradigms may differentiate:<ref name="stroustrup-ch1-11"/>
* [[Procedural programming|procedural languages]], [[
* different levels of [[
* different levels of [[class hierarchy]].
* different levels of input [[
Each of these programming styles has contributed to the synthesis of different ''programming languages''.<ref name="stroustrup-ch1-11"/>
Line 507 ⟶ 480:
| isbn = 978-0-13-854662-5
| url = https://archive.org/details/structuredcomput00tane/page/17
}}</ref> Programming the EDSAC was in the first [[Programming language generations|generation of programming language]].<ref>{{Citation |last1=Wilkes |first1=M. V. |title=The EDSAC |date=1982 |work=The Origins of Digital Computers: Selected Papers |pages=417–421 |editor-last=Randell |editor-first=Brian |url=https://link.springer.com/chapter/10.1007/978-3-642-61812-3_34 |access-date=2025-04-25 |place=Berlin, Heidelberg |publisher=Springer |language=en |doi=10.1007/978-3-642-61812-3_34 |isbn=978-3-642-61812-3 |last2=Renwick |first2=W.|url-access=subscription }}</ref>
* The [[First-generation programming language|first generation of programming language]] is [[machine language]].<ref name="pis-ch4-p160">{{cite book
Line 517 ⟶ 490:
| 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 528 ⟶ 501:
}}</ref>
* The [[Second-generation programming language|second generation of programming language]] is [[assembly language]].<ref name="pis-ch4-p160"/> ''Assembly language'' allows the programmer to use [[Assembly language#Mnemonics|mnemonic]] [[Instruction_set_architecture#Instructions|instructions]] instead of remembering instruction numbers. An [[Assembler (computing)|assembler]] translates each assembly language mnemonic into its machine language number. For example, on the PDP-11, the operation 24576 can be referenced as ADD R0,R0 in the source code.<ref name="sco-ch7-p399"/> The four basic arithmetic operations have assembly instructions like ADD, SUB, MUL, and DIV.<ref name="sco-ch7-p399"/> Computers also have instructions like DW (Define [[Word (computer architecture)|Word]]) to reserve [[Random-access memory|memory]] cells. Then the MOV instruction can copy [[integer]]s between [[Processor register|registers]] and memory.
:* The basic structure of an assembly language statement is a label, [[Operation (mathematics)|operation]], [[operand]], and comment.<ref name="sco-ch7-p400">{{cite book
Line 563 ⟶ 536:
| page = 26
| isbn = 0-201-71012-9
}}</ref> Early languages include [[Fortran]] (1958), [[COBOL]] (1959), [[ALGOL]] (1960), and [[BASIC]] (1964).<ref name="pis-ch4-p160"/> In 1973, the [[
| last = Wilson
| first = Leslie B.
Line 582 ⟶ 555:
}}</ref> C has statements that may generate a single machine instruction.{{efn|[[Operators in C and C++|Operators]] like <code>x++</code> will usually compile to a single instruction.}} Moreover, an [[optimizing compiler]] might overrule the programmer and produce fewer machine instructions than statements. Today, an entire [[programming paradigm|paradigm]] of languages fill the [[imperative programming|imperative]], ''third generation'' spectrum.
* The [[Fourth-generation programming language|fourth generation of programming language]] emphasizes what output results are desired, rather than how programming statements should be constructed.<ref name="pis-ch4-p160"/> [[Declarative
===Imperative languages===
Line 662 ⟶ 635:
| 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
* [[Block (programming)|block structure]], where variables were local to their block.
* arrays with variable bounds.
Line 681 ⟶ 654:
* The 'run' command executed the program.
However, the Basic syntax was too simple for large programs.<ref name="cpl_3rd-ch2-30"/> Recent dialects added structure and object-oriented extensions. [[Microsoft
====C====
[[
* [[inline assembler]].
* arithmetic on pointers.
Line 692 ⟶ 665:
[[File:Computer-memory-map.png|thumb|right|Computer memory map]]
''C'' allows the programmer to control which region of memory data is to be stored. [[Global variable]]s and [[static variable]]s require the fewest [[
* The ''global and static data'' region is located just above the ''program'' region. (The program region is technically called the ''text'' region. It is where machine instructions are stored.)
Line 704 ⟶ 677:
| url-status = live
}}</ref> One region is called the ''initialized [[data segment]]'', where variables declared with default values are stored. The other region is called the ''[[.bss|block started by segment]]'', where variables declared without default values are stored.
:* Variables stored in the ''global and static data'' region have their [[Memory address|addresses]] set at compile
:* The global and static region stores the ''global variables'' that are declared on top of (outside) the <code>main()</code> function.<ref name="cpl-ch1-p31">{{cite book
Line 717 ⟶ 690:
|page=31}}</ref> Global variables are visible to <code>main()</code> and every other function in the source code.
: On the other hand, variable declarations inside of <code>main()</code>, other functions, or within <code>{</code> <code>}</code> [[Block (programming)|block delimiters]] are ''local variables''. Local variables also include ''[[
| last = Wilson
| first = Leslie B.
Line 727 ⟶ 700:
}}</ref> Parameters provide an [[Interface (computing)|interface]] to the function.
:* ''Local variables'' declared using the <code>static</code> prefix are also stored in the ''global and static data'' region.<ref name="geeksforgeeks"/> Unlike global variables, static variables are only visible within the function or block. Static variables always retain their value. An example usage would be the function <code>int increment_counter(){static int counter = 0; counter++; return counter;}</code>{{efn|This function could be written more concisely as <code>int increment_counter(){ static int counter; return ++counter;}</code>. 1) Static variables are automatically initialized to zero. 2) <code>++counter</code> is a prefix [[
* The [[call stack|stack]] region is a contiguous block of memory located near the top memory address.<ref name="lpi-ch6-p121">{{cite book
Line 770 ⟶ 743:
====C++====
In the 1970s, [[
| last = Wilson
| first = Leslie B.
Line 778 ⟶ 751:
| page = 38
| isbn = 0-201-71012-9
}}</ref> One obvious feature was to decompose large projects ''physically'' into separate [[computer file|files]]. A less obvious feature was to decompose large projects ''logically'' into [[abstract data type]]s.<ref name="cpl_3rd-ch2-38"/> At the time, languages supported [[Type system|concrete (scalar)]] datatypes like [[integer]] numbers, [[
In object-oriented jargon, abstract datatypes are called [[Class (computer programming)|classes]]. However, a ''class'' is only a definition; no memory is allocated. When memory is allocated to a class and [[Name binding|bound]] to an [[identifier]], it is called an [[Object (computer science)|object]].<ref name="cpl_3rd-ch8-193">{{cite book
Line 798 ⟶ 771:
| page = 39
| isbn = 0-201-71012-9
}}</ref> A function, in an object-oriented language, is assigned to a class. An assigned function is then referred to as a [[Method (computer programming)|method]], [[
| last = Wilson
| first = Leslie B.
Line 836 ⟶ 809:
}}</ref>
An object-oriented module is composed of two files. The definitions file is called the [[
<syntaxhighlight lang="cpp">
Line 879 ⟶ 852:
}}</ref> It is executed when the calling operation executes the <code>[[new and delete (C++)|new]]</code> statement.
A module's other file is the
<syntaxhighlight lang="cpp">
Line 1,043 ⟶ 1,016:
| page = 218
| isbn = 0-201-71012-9
}}</ref> [[Declarative
The principle behind a ''functional language'' is to use [[lambda calculus]] as a guide for a well defined [[Semantics (computer science)|semantic]].<ref name="cpl_3rd-ch9-217">{{cite book
Line 1,104 ⟶ 1,077:
| page = 240
| isbn = 0-201-71012-9
}}</ref> Moreover, their lack of side-effects have made them popular in [[
| last = Wilson
| first = Leslie B.
Line 1,126 ⟶ 1,099:
| publisher=Springer Science & Business Media
| isbn=9781447117193
| page=2}}</ref> It is tailored to process [[List (abstract data type)|lists]]. A full structure of the data is formed by building lists of lists. In memory, a [[
| last = Wilson
| first = Leslie B.
Line 1,158 ⟶ 1,131:
| page = 229
| isbn = 0-201-71012-9
}}</ref> Also, ''Lisp'' is not concerned with the [[
| last = Wilson
| first = Leslie B.
Line 1,216 ⟶ 1,189:
| page = 235
| isbn = 0-201-71012-9
}}</ref> Moreover, ''ML'' assigns the datatype of an element at [[compile
| last = Wilson
| first = Leslie B.
Line 1,280 ⟶ 1,253:
</syntaxhighlight>
Here is a comprehensive example:<ref name="Logical English">Kowalski, R., Dávila, J., Sartor, G. and Calejo, M., 2023. Logical English for law and education. In Prolog: The Next 50 Years (pp.
1) All dragons billow fire, or equivalently, a thing billows fire if the thing is a dragon:
Line 1,320 ⟶ 1,293:
Prolog is an untyped language. Nonetheless, [[Inheritance (object-oriented programming)|inheritance]] can be represented by using predicates. Rule (4) asserts that a creature is a superclass of a dragon.
Questions are answered using [[
<syntaxhighlight lang="prolog"> ?- billows_fire(X).
Line 1,360 ⟶ 1,333:
| isbn = 0-256-08515-3
| quote = While it is true that OOD [(object oriented design)] as such is not supported by the majority of popular languages, a large subset of OOD can be used.
}}</ref> In an object-oriented language, an object container is called a [[Class (computer programming)|class]]. In a non-object-oriented language, a [[data structure]] (which is also known as a [[Record (computer science)|record]]) may become an object container. To turn a data structure into an object container, operations need to be written specifically for the structure. The resulting structure is called an [[
| last = Weiss
| first = Mark Allen
Line 1,397 ⟶ 1,370:
The <code>grade_new()</code> function performs the same algorithm as the C++ [[Constructor (object-oriented programming)|constructor]] operation.
Here is a C programming language ''[[
<syntaxhighlight lang="c">
Line 1,713 ⟶ 1,686:
| page = [https://archive.org/details/discretemathemat00rose/page/623 623]
| isbn = 978-0-07-053744-6
| url = https://archive.org/details/discretemathemat00rose/page/623}}</ref> BNF describes the syntax of a language and itself has a ''syntax''. This recursive definition is an example of a [[metalanguage
* <code>::=</code> which translates to ''is made up of a[n]'' when a non-terminal is to its right. It translates to ''is'' when a terminal is to its right.
* <code>|</code> which translates to ''or''.
Line 1,769 ⟶ 1,742:
==Software engineering and computer programming==
[[File:Two women operating ENIAC (full resolution).jpg|thumb|right|Prior to programming languages, [[Jean Bartik|Betty Jennings]] and [[
[[Software engineering]] is a variety of techniques to produce [[software quality|quality]] ''computer programs''.<ref name="se-preface1">{{cite book
Line 1,880 ⟶ 1,853:
| page = 331
| isbn = 0-256-08515-3
}}</ref> Chances are a module will execute modules located in other source code files. Therefore, computer programmers may be [[
===Program modules===
Line 1,939 ⟶ 1,912:
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.
Line 1,991 ⟶ 1,964:
| isbn = 0-619-06489-7
| quote = The key to unlocking the potential of any computer system is application software.
}}</ref> [[
Enterprise applications may be developed in-house as a one-of-a-kind [[proprietary software]].<ref name="pis-ch4-p148">{{cite book
Line 2,001 ⟶ 1,974:
| page = 147
| isbn = 0-619-06489-7
}}</ref> Alternatively, they may be purchased as [[
| last = Stair
| first = Ralph M.
Line 2,043 ⟶ 2,016:
The potential advantages of off-the-shelf software are upfront costs are identifiable, the basic needs should be fulfilled, and its performance and reliability have a track record.<ref name="pis-ch4-p148"/> The potential disadvantages of off-the-shelf software are it may have unnecessary features that confuse end users, it may lack features the enterprise needs, and the data flow may not match the enterprise's work processes.<ref name="pis-ch4-p148"/>
====Application service provider====
One approach to economically obtaining a customized enterprise application is through an [[application service provider]].<ref name="pis-ch4-p149">{{cite book
| last = Stair
Line 2,080 ⟶ 2,054:
[[File:Kernel Layout.svg|thumb|A kernel connects the application software to the hardware of a computer.]]
The kernel's main purpose is to manage the limited resources of a computer:
* The kernel program should perform [[
|title=The Linux Programming Interface
|last=Kerrisk
Line 2,087 ⟶ 2,061:
|year=2010
|isbn=978-1-59327-220-3
|page=22}}</ref> which is also known as a [[context switch]]. The kernel creates a [[process control block]] when a ''computer program'' is [[Loader (computing)|selected for execution]]. However, an executing program gets exclusive access to the [[central processing unit]] only for a [[
[[File:Virtual memory.svg|thumb|250px|Physical memory is scattered around RAM and the hard disk. Virtual memory is one continuous block.]]
* The kernel program should perform [[memory management]].
Line 2,098 ⟶ 2,072:
| page = 152
| isbn = 0-13-201799-7
}}</ref> The kernel maintains a master-region table and many per-process-region (pregion) tables—one for each running [[Process (computing)|process]].<ref name="duos-ch6-p152"/> These tables constitute the [[virtual address space]]. The master-region table is used to determine where its contents are located in [[
:*The program pregion stores machine instructions. Since machine instructions do not change, the program pregion may be shared by many processes of the same executable.<ref name="duos-ch6-p152"/>
:* To save time and memory, the kernel may load only blocks of execution instructions from the disk drive, not the entire execution file completely.<ref name="lpi-ch2-p22"/>
Line 2,160 ⟶ 2,134:
===Utility program===
A [[
| last = Stair
| first = Ralph M.
Line 2,187 ⟶ 2,161:
[[File:AND_ANSI_Labelled.svg|thumb|96px|right|AND gate]]
[[File:OR_ANSI_Labelled.svg|thumb|96px|right|OR gate]]
A [[Microcode|microcode program]] is the bottom-level interpreter that controls the [[
| last = Tanenbaum
| first = Andrew S.
Line 2,224 ⟶ 2,198:
}}</ref>
* Having one transistor forms the [[
* Connecting two transistors in series forms the [[NAND gate]].
* Connecting two transistors in parallel forms the [[NOR gate]].
Line 2,241 ⟶ 2,215:
| isbn = 978-0-13-291652-3
}}</ref>
These hardware-level instructions move data throughout the [[
The micro-instruction cycle begins when the [[microsequencer]] uses its microprogram counter to ''fetch'' the next [[
| last = Tanenbaum
| first = Andrew S.
Line 2,273 ⟶ 2,247:
}}</ref> The ALU has circuits to perform elementary operations to add, shift, and compare integers. By combining and looping the elementary operations through the ALU, the CPU performs its complex arithmetic.
Microcode instructions move data between the CPU and the [[memory controller]]. Memory controller microcode instructions manipulate two [[Processor register|registers]]. The [[memory address register]] is used to access each memory cell's address. The [[
| last = Tanenbaum
| first = Andrew S.
Line 2,280 ⟶ 2,254:
| year = 2013
| page = 249
| isbn = 978-0-13-291652-3
}}</ref>
|