Difference between revisions of "Introduction to Terminology"

From CodeStuff
Jump to: navigation, search
(Created page with "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, ma...")
 
Line 10: Line 10:
 
<edcode>
 
<edcode>
 
function starIt( q ) {
 
function starIt( q ) {
   return "*"+q+"*";
+
   return "***" + q + "***";
 
}
 
}
  
Line 17: Line 17:
 
var floo = starIt(snoo);
 
var floo = starIt(snoo);
  
print(floo);
+
print(floo, 300, 250);
  
 
</edcode>
 
</edcode>
 +
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.  Refer back to this page when you encounter one of these terms.
  
 
=== Convention ===
 
=== 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 ===
 
=== 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 ===
 
=== Function ===
...
+
The name Function is descended from its use in mathematics. The mathematical form purely provides a result from a given input.  
=== Parameter ===
+
 
 
...
 
...
 
=== Call ===
 
=== 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 ===
 
=== 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***"
 
...
 
...
=== Variable ===
+
 
 +
=== 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 ===
 
=== 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.
 +
 
 
=== Operator ===
 
=== 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 ===
 
=== Expression ===
...
+
An expression is a calculation that results in a value.
=== Statement ===
+
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==
 
==Words to lean soon==

Revision as of 13:48, 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.

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. 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.

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

Plus a whole lot more. Whenever people talk about a topic, words will come to be used to fill meanings as they are required.