Let's start with the very basics:
Programming is like talking to the
computer in a language the computer understands. And like
spoken languages, there are many languages that computers
can speak. In the world of the Internet, the key language is
arguably JavaScript, just as in the United States it is
English and in France it is French. You use programming to
tell the computer what to do.
Let's start with the very
basics (cont.):
Like human spoken languages (ex: French, English)
programming languages have rules (grammar, spelling etc)
and meaning for certain special key words. In English
the word 'throw' has a meaning; it means to 'toss',
'pitch', 'fling', something or someone. One such 'key
word' in JavaScript is the word 'function'; this keyword
tells the computer that this is the beginning of code
(programming code) that does something, or in other
words, takes an action. Here's a made-up example:
function: Pop up a box and say:
'What's up Jimmy! '
This made up example (not real
programming!) is telling the computer to pop open a box
and say: 'What's up Jimmy!'
Just for the curious, I will now
show you the real way to do this with Javascript:
function popupMessage()
{
alert(“What's up Jimmy!”);
}
What they h#$% is that suppose to
mean? I know that for many of you this is already
freaking confusing, but hold on, it's well worth it!
Programming languages have other
words (besides 'function') that have special meaning as
well, special meanings that tell the computer what to
do. So when you are programming, you are using special
keywords to tell the computer what to do.
You use programming to write (in
other words: create or build) software (ex: Mircrosoft
Word, Internet Explorer and even Windows!) and software
enables you to more easily control your computer.
Computers are really, really
stupid. So stupid in fact that if you were talking to a
computer directly, you would have to use a very simple
language that is so slow to write, that it becomes very
difficult to get anything done since you have to explain
every single step to the computer. How simple you ask?
So simple that even something like printing the letter
'A' on screen could take you days to build because of
all the code you would have to write!
Computers naturally can only really
understand (without the help of software/programs) is
'yes' and 'no'. Computers see 'yes' and 'no' as 1 and 0.
Once again we can say that programs are sets of written
instructions telling computers what to do.
Because of how stupid computers
really are, programmers (a.k.a.: nerds) over the years
have written programs that make it much easier for us to
'talk' to computers. One of these programs that make our
lives easier is the web browser.
Built into Internet Explorer,
Netscape and most other web browsers is the ability to
understand a programming language called JavaScript.
With JavaScript we can indirectly control the computer.
I hope that this basic explanation
of programming clears things up a little for all of you
reading.
Ok, that is a lot of abstraction
to take in, let's look at something a little more
concrete.
Is HTML and CSS
programming?
We know by now that HTML and CSS
are used to build web pages. This is a question that
comes up from time to time; since HTML and CSS is
essentially just lots of code that is used to tell the
browser what to display (HTML) and how to display it (CSS),
isn't it programming? The answer is no, and this is why:
The fundamental difference between
coding (ex: HTML, CSS) and programming (JavaScript,
Java) is that in programming you can make decisions
based on something happening.
For instance, you can write a
little JavaScript that cause a little message box to
appear if the user (the person looking at your page)
does something. This can be clicking on a button or
pressing on the 'C' key on the keyboard etc .
This is of course a simplification of
the situation but it essentially covers it. It can get
confusing because in the world of the Internet there can
be some 'gray' area where without using programming you
can get the browser to do something on it's own. An
example of this is the META tag 'refresh'. This tag
allows you to tell the web page to reload itself or to
load an entirely new page after a specified number of
seconds or minutes. Here's what the META tag 'refresh '
looks like:
<META http-equiv='refresh'
content='3; URL=http://www.seektemplates.com'>
This tag tells the browser to load
the page after 3 seconds.
Some people will get a little
confused and say that since the META tag code is telling
the browser to do something, it is programming, right?
Wrong, the reason that it is not programming is because
there is no decision being made. No matter what else may
happen (as long as they stay on the page for at least 3
seconds) the page will automatically load the website in
the Meta tag.
To make this example act like it
was truly programmed, you would have to be able to (for
example) control if the browser would reload the page or
some other page depending on say, what the user did on
the page.
An easy example: say you had a box
on your web page where the user could enter in a number,
and depending on the number entered, the browser would
load a particular page.
This shows how programming allows
you to make decisions based on as many possibilities you
want.
One more example: you can with
JavaScript check to see what browser the user is using
to view your web page and what time of the day it is. So
with this information you can send people to a
particular website if it is say, before 12 pm and they
are using Internet Explorer as their browser. And you
can also program to send them to another web site if it
is past 12 pm and they are using Netscape. Any
combination is possible and that is the power of
programming!
A final point:
This is just the first part of
this series, in part two I will slowly introduce you to
more concepts that will give us the foundation we need
to get into some real programming.With just a little
patience, in no time you all will be programming!
NEXT: PART 1