What is computer programming?

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. (for more see the terminology section.) 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.
0 comments:
Post a Comment