Saturday, 30 August 2014

Programming Code

Programming is basically thinking of something you want the computer to do, breaking it down into separate tasks, and telling the Central Processing Unit (CPU) to do them in order. The CPU is basically the chip. But the CPU only takes instructions in machine code, which is represented by ones and zeros often know as binary code. To write complex instructions using this language would be impossible. This is why source code (Java, C#, HTML, and dozens more) was created, to make it easier to write programming language. (But let's be realistic, even source code looks impossible :)). You can write source code by hand using plain text editors, or you can use an Integrated Development Environment (IDE), such as Visual Studio or Eclipse, which make it so much easier to write source code.

Now as you can probably guess, when you write the source code, the CPU can't run it unless it's in machine code so there has to be a way to change the source code to machine code. There are three ways to do this - compile (C, C++, Objective-C), interpret (most languages that end with script), or a hybrid of the two (C#, Java). Compiling means taking the source and completely translating it to machine code, which results in an executable file (.exe) that can be sent to any CPU (within the same environment, meaning among PCs, or Mac, but not both). Interpreting means you don't worry about changing the source code to machine code, but you let the user's apps worry about it. So for example when you use JavaScript you send the source to the user and let their browsers interpret it and change it to machine code. Hybrid is when you compile as much as you can, but are still able to send it in source code so that the other side can interpret it.

No comments:

Post a Comment