|
Click here to download the PDF version Chapter 1: Computing Concept
============================
What is programming
-------------------
* what is computer?
* e.g. what is the difference of a microwave timer and computer?
* a process to write (design) a set of instructions to control
computer to do a specific task.
* the collection of all instructions and their syntax of one kind is
called (computer/artificial) language.
* there are many kind of languages: C, C++, Java, Perl, Basic...
What is instruction?
====================
* an instruction is basically composed of two parts: action and
object.
* e.g. go home, buy food...
* the different action part can combine with different object part.
* in computer terms, there are functions/operator and
parameter/variable.
* a program is a sequence of instructions in logical and structural
order
* e.g. Write a program to buy a can of coke from a selling machine.
The possible action is "insert", "take", "push". The possible object
is "can of coke", "coins", "button". How about if the lights of
buttons are out of order? Additional action: "when", "exist", "not
exist".
* Actually, "insert", "take" and "push" are also composed of other
lower level of instructions, like "move arm", "move finger", etc.
* The same situation can be found in a computer program.
Process of program generation
=============================
* There are many kinds of computer languages.
* For one kind of computer, how can it understand all kinds of
languages? Or a new language?
* One kind of "computer languages" is called "high level language"
* Another kind of language, which is the basic language of a kind of
computer understand, is called "machine language".
* The process to translate from high level language to machine
language is called compilation and linking by compiler and linker.
other object file ->
source file(.c)->|compiler|->object file(.o)->|linker|->executable
header file(.h)-> library file (lib) ->
* The collection of all source files and resources file for a
executable (program) is called "project".
©2002-2024 Hong Kong Baptist University. All Rights Reserved.
|
|