Difference between revisions of "Introduction to Terminology"
| Line 33: | Line 33: | ||
=== Function === | === Function === | ||
| + | [[file:Code_Function.png|left|frame|The function highlighted]] | ||
The name Function is descended from its use in mathematics. The mathematical form purely provides a result from a given input. | The name Function is descended from its use in mathematics. The mathematical form purely provides a result from a given input. | ||
... | ... | ||
| + | <br style="clear: both" /> | ||
=== Call === | === Call === | ||
| + | [[file:Code_Calls.png|left|frame|The calls highlighted]] | ||
Calling is when a running program temporarily jumps to another position within the program. Most commonly calls are to functions. the program above contains two function calls, on line 8 there is a call to starIt on line 2, and line 10 has a call to the function print (which is a function provided by the system so does not have a line number in our program). | Calling is when a running program temporarily jumps to another position within the program. Most commonly calls are to functions. the program above contains two function calls, on line 8 there is a call to starIt on line 2, and line 10 has a call to the function print (which is a function provided by the system so does not have a line number in our program). | ||
| + | <br style="clear: both" /> | ||
=== Return === | === Return === | ||
| + | [[file:Code_Return.png|left|frame|The return highlighted]] | ||
A return is the reverse of a call. When a call is completed the program returns to the place that initiated the call. A function will return if the program reaches the end of the function. Functions can also be told explicitly to return. When a function is told to return it can return with a value that can be considered the result of the function. | A return is the reverse of a call. When a call is completed the program returns to the place that initiated the call. A function will return if the program reaches the end of the function. Functions can also be told explicitly to return. When a function is told to return it can return with a value that can be considered the result of the function. | ||
| Line 45: | Line 50: | ||
... | ... | ||
| + | <br style="clear: both" /> | ||
=== Parameter === | === Parameter === | ||
| + | [[file:Code_Parameters.png|left|frame|The parameters highlighted]] | ||
Also known as arguments, Parameters are the values given to a function when it is called. | Also known as arguments, Parameters are the values given to a function when it is called. | ||
... | ... | ||
| + | |||
| + | <br style="clear: both" /> | ||
=== Variable === | === Variable === | ||
| + | [[file:Code_Variables.png|left|frame|The variables highlighted]] | ||
Variables are a way to store changeable information. This program creates two variables, snoo on line 6 and floo on line 8. | Variables are a way to store changeable information. This program creates two variables, snoo on line 6 and floo on line 8. | ||
| + | <br style="clear: both" /> | ||
=== Value === | === Value === | ||
| − | Values are data of some form. Numbers, letters, words and sentences are all values. Values can come in even more complex forms. Values don't change, they get put into variables changing a variable means replacing the value in the variable with another value. | + | [[file:Code_Values.png|left|frame|The literal values highlighted]] |
| + | Values are data of some form. Numbers, letters, words and sentences are all values. Values can come in even more complex forms. Values don't change, they get put into variables changing a variable means replacing the value in the variable with another value. Values can be made 5+3 makes the value 8. Of course you cannot highlight all of the values that are made during the running of a program because they don't all appear in the code. Values that do appear written in the code are known as literal values. | ||
| + | |||
| + | <br style="clear: both" /> | ||
=== Operator === | === Operator === | ||
| + | [[file:Code_Operators.png|left|frame|The Operators highlighted]] | ||
Most people are familiar with some operators. Plus + and minus - are operators. Most languages use * and / for multiply and divide. | Most people are familiar with some operators. Plus + and minus - are operators. Most languages use * and / for multiply and divide. | ||
in JavaScript = is called an assignment operator. | in JavaScript = is called an assignment operator. | ||
| Line 66: | Line 81: | ||
You can read more about operators in JavaScript at http://en.wikibooks.org/wiki/JavaScript/Operators | You can read more about operators in JavaScript at http://en.wikibooks.org/wiki/JavaScript/Operators | ||
| + | <br style="clear: both" /> | ||
=== Expression === | === Expression === | ||
| + | [[file:Code_Expressions.png|left|frame|The expressions highlighted]] | ||
| + | |||
An expression is a calculation that results in a value. | An expression is a calculation that results in a value. | ||
These are all expressions | These are all expressions | ||
Revision as of 23:20, 24 January 2012
As a beginner, the sight of an already completed computer program seems impossibly complex. It is quite easy to be overwhelmed by the whole program. A program is however, made out of parts. You can learn each part works one at a time and you can learn how the parts work together.
To communicate the ideas involved with programs it helps to have words that clearly express particular meanings. Two programmers having a conversation need to have the words to say what they mean. Those words need to have quite precise meanings. If there was a Tiger behind the door, you should probably say to your friend "There is a Tiger behind the door". Saying "There is a cat behind the door" is just as correct, but leaves out details that your friend may find important.
Words matter, In life and in programming.
Contents
Words to know
Most of these words already have meanings in English, often their meaning is similar in the context of programming. Sometimes words used in programming seem to have very little to do with how they are used in English. The bigger difference can be an advantage at times to stop you from mixing up the common English use of the word with the Programming use of the word.
This program is quite small. You may not understand the details yet but that's ok. It's here to show us what the parts are called. That will aid us in understanding how it works. You don't have to understand completely in one go. This page is not for a complete explanation of the concepts, it simply shows which word is used for a particular concept. Refer back to this page when you encounter one of these terms.
Convention
This is actually one of the standard dictionary meanings of the word. It is an agreed way of doing things. Often is more than one way to do something but it would be better if everyone did it the same way. In these cases a convention can form in order to help people to work together. Because it requires agreement and there are always people who disagree, people argue about conventions a lot.
Illegal
Sometimes you can find a program will complain about something Illegal. Don't worry, this does not mean you have broken the law. It means some part of the program has broken some internal rule.
Identifier
An identifier is a name, it's job is to identify things. In JavaScript there is a naming convention for function and variables. It is suggested that they start with a lower case letter and the first letter of any other words in the name are capitalised, for instance soQuakeWithFearYouTinyfools starts with a small s. This is known as "lower camel case".
Function
The name Function is descended from its use in mathematics. The mathematical form purely provides a result from a given input.
...
Call
Calling is when a running program temporarily jumps to another position within the program. Most commonly calls are to functions. the program above contains two function calls, on line 8 there is a call to starIt on line 2, and line 10 has a call to the function print (which is a function provided by the system so does not have a line number in our program).
Return
A return is the reverse of a call. When a call is completed the program returns to the place that initiated the call. A function will return if the program reaches the end of the function. Functions can also be told explicitly to return. When a function is told to return it can return with a value that can be considered the result of the function.
in the program above, line 3 returns to line 8 bringing with it the value "***Cheese is quite nice***" ...
Parameter
Also known as arguments, Parameters are the values given to a function when it is called. ...
Variable
Variables are a way to store changeable information. This program creates two variables, snoo on line 6 and floo on line 8.
Value
Values are data of some form. Numbers, letters, words and sentences are all values. Values can come in even more complex forms. Values don't change, they get put into variables changing a variable means replacing the value in the variable with another value. Values can be made 5+3 makes the value 8. Of course you cannot highlight all of the values that are made during the running of a program because they don't all appear in the code. Values that do appear written in the code are known as literal values.
Operator
Most people are familiar with some operators. Plus + and minus - are operators. Most languages use * and / for multiply and divide. in JavaScript = is called an assignment operator.
a = 3 means "put the value 3 into a".
JavaScript also has an == operator which is used for comparing.
a == 3 means "is a equal to the value 3"
You can read more about operators in JavaScript at http://en.wikibooks.org/wiki/JavaScript/Operators
Expression
An expression is a calculation that results in a value. These are all expressions
- 3
- 3+3
- 3+x+3*4
- 2*(3+4)-((3/x)+17)
- "ook"
- starIt("ook")
- "ook"+starIt("ook")
- x == 3
if x were a variable with a value of 3 the results of these expressions would be
- 3
- 6
- 18
- -22
- "ook"
- "***ook***"
- "ook***ook***"
- true
All of these results are values.
Words to lean soon
Object, Method, Array, String, Loop, Literal
Words to learn later
Closure, Floating Point, Constructor, Class, Pointer, Reference, Instance, Event, Thread, Process, Stack, Interface
And many many more. Whenever people talk about a topic, words will come to be used to fill meanings as they are required.







