Guide to Programming Series: Week 2
If you’ve noticed, programmers are usually a lazy (yes were lazy, it’s a fact) bunch that looks for an easier way to do things. This is the main reason for the development of easier to comprehend languages.
A, B, the C Programming Language:
To do away with the drawbacks of Assembly, programmers then developed several other languages like FORTRAN (turn to High-level Programming if you need more info now –linky–). In that process came C.
To make programming easier for themselves programmers of C made it look closer to the English language so that people can easily understand. Here’s a sample:
main()
{
printf ("Hello sylv3rblade!\n");
}
The code above is the equivalent of the Assembly version shown on the previous page and displays “Hello sylv3rblade!” on-screen. In comparison, the C language source code is much more appealing to use. In terms of speed though, assembly language executes at a faster rate because the latter is closer to machine code (1’s and 0’s) while C programs need to get translated into assembly language code before finally being converted into machine language code.
As you step up in the programming language category, this x-step process increases thus tend to be less efficient than writing an equivalent. They are however, much easier to read, write, and modify.
To sum up, C has the following advantages:
- Easier to read and write than Assembly
- Same access available to Assembly
- Portability
Portability in general computing means something that you can lug around without being a burden. In programming, we change the meaning a bit into “something which you can run anywahere.” In theory, it is possible to run a C program on any computer so long as a C compiler is already on that computer. The reality, though is that you almost always must modify a C program to get it to run on a different computer. Modifying a C program, however, is still much easier than modifying an assembly or machine-language program.
While C is a powerful replacement to Assembly, it has it’s share of flaws:
- C programs are larger and slower
- C provides access to all parts of a computer,
including the capability to manipulate the computer’s memory.
Although unlimited access sounds like a programmer’s dream, be wary. If don’t wrong, C programs can accidentally wreck your computer’s memory, causing your program to crash your computer.
To supplement or even eliminate this problem, programmers created several derivatives. C++, Java, Perl, Python, and C# fall into this category. These C-derived languages add a special feature like object-orientation (more on OO later in the Series) and workarounds to prevent memory leaks prevalant in C.
Tags: Programming Series
Comment ( 1 )
Have Something To Say ?