Writing computer programs means writing instructions, that will make the
 computer follow and run a program based on those instructions. To 
explain how programming works, I will give a brief history. The basic 
instructions are composed of a sequence of ons and offs, that the 
computer follows as it runs them through the processor, turning switches
 on and off. The ons are coded (meaning written in programming) with an 
1, and the offs with a 0. Numbers and letters are also represented by 
this; 0000=0, 0001=1, 0010=2, 0011=3, etc.  In the beginning, programs 
looked like "
1010100100101111010101010101".
Someone realized that since the purpose of writing programs is in order 
to make life easier, why don't we write a program that will take a kind 
of code that is easier to create, and the program will translate it into
 computer code (1s and 0s). So, assembly language was created, where the
 code then looked like  "add $5, $7, $8 #comment", which 
although not completely readable, it was a lot better than "010101". The
 program that converted the assembly language into computer code was 
called the assembler. Then someone decided, why don't we make a program 
that will translate English-like words into assembly language, so we can
 write code in English. Thus modern "third generation" code was created.
  Now the programmer can write code like "x = 5 + 8;" or "String stupid =
 "You are not smart;". (The first piece means that x will equal 5 + 8, 
and the second means that whenever the program writes stupid it means 
the words in the quotes. However, that is not important now, the 
important thing to realize is that programming is more "Englished" and 
understandable than before".) Now, a compiler will translate the new 
code into assembly language, to which an assembler will translate into 
computer language, that the computer will execute into a series of ons 
and offs. This new way enabled writing more complex code, as it was now 
more readable and easy to program.  Java is one of the newer languages 
that uses this third generation code writing technic.
In short, writing code means writing a bunch of instructions. Each 
instruction is relatively simple, yet because of the computer's speed, 
it is able to run millions of instructions in a second. In order for a 
complex 3d game, like for example Diablo, millions of little code lines 
are being executed per second, as each code line only does very little. 
Your job as a programmer is to be able to not focus only on what the end
 product looks like, but on how each little piece runs, and then being 
able to write all of the little lines of code that enable the whole 
program to run.  When you learn how to program you learn how to break up
 the objective into different chunks, and work only on that chunk at a 
time. This is in order to focus on what you need to do right now, and 
that which you don't need to know is pushed off to be done at a 
different time.  For example, when you are writing code for a game, when
 you are focusing on the good guy fighting, you ignore the rest of the 
game, and only focus on getting the guy to swing the sword, etc.  When 
you are writing the code on how the good guy finds and picks up 
treasure, you write only the code for that, ignoring, the code on how he
 fights.  Then, you take a step back and put the pieces together.  
Although this seems hard, it is one of the basic aspects that you are 
taught when you write programs, and you become extremely used to it.  
This is known as abstraction.
One writes code with a specific terminology for the language that he is 
programming in.  The different terminologies can be grouped into the few
 categories of keywords, variables, operations and predefined classes 
(in Java). (This is an oversimplification, as I am trying to make this 
easy to be understood for beginners). Keywords are the words that have a
 specific meaning to the compiler. For example, "if" tells the compiler 
that "if the condition is true then run the next piece of code". 
Operations are symbols that give specific meaning.  For example, the 
operation of "+" can be used to add two  numbers together.  The 
operation of "=" means that the operand (the thing using the operation) 
on the left "gets" what is on the right. Variables are the values that 
you give to a word that you make up.  For example, in Java the keyword 
"int" means a number. If you write  "
int sum = 8 + 7;" you 
are telling the compiler, I want a variable called sum to get the value 
of 8 and 7 added together.  From now on until you change it, whenever 
you write "sum" in the program, the compiler reads it as "15".  For 
example if you were to write "if (sum==15)" means if that 
variable called sum equals 15 (which for now it has not been changed) 
then run the next piece of code. 
  Also, in Java you have already made classes that will do a huge amount
 for you.  All you have to do is bring them into your code, and it will 
save you a huge amount of programming.
 
No comments:
Post a Comment
if You Need Any Help Then Write Us:We Come Back With Solution