Thursday, August 4, 2011

A Few Preliminary Definitions

Machine Language

Computers are very fast adding machines. Their operations consist of circuits open or closed, spots magnatized or not. These states are represented by 0 and 1. (O closed, 1 open) Everything that can be done on a computer can be done with 0's and 1's.

Programming languages

Programming in 0's and 1's is extremely tedious and prone to errors. To help, programmers first developed assembly language. It provides some key words and abreviations to act as memnonics for the machine languge. Later programmers started to develop what more complex programming languages such as Fortran and Cobol. In these language each command, such as "print" represented a whole batch of machine level commands. The language was processed by a compiler and turned back into machine language.

Fortran and Cobol were top-down languages. That means that you started at the top and wrote your code in one long list of commands until you were done. As computing grew more complex, this method of proved inadequate. It was difficult to trace errors and debug. It was also nearly impossible to reuse code for other projects.

The next generation of lanugages such as C allowed programmers to break the code into seperate functions. This was called Structural programming. A program consisted of any number of functions and each function did only one thing. this made it easier to locate errors and also to reuse code. This was a huge improvement, but as programs grew more complex, it still proved inadequate. A large, complex program could have thousands of functions. Keeping track of and organizing then could be nearly impossible.

This gave rise to the next set of languages such as C++, C# and Java. These languages use a Object Oriented structure. The code is still divided into functions but the functions are grouped into objects. These object represent the "natural" organization of the program. For instance a Point of Sale program would have objects like customer, item, inventory, sale, etc.

It is important to realize that the computer doesn't understand C# or any of the other languages any more than you probably do at this point. They must be compiled into machine language by another program called a compiler

Classes
Classes are part of any object oriented language. A class is an abstact defintion of an object. A customer, for instance, has a name, an address, perhaps a customer number. An object is a specific instance of a class, such as the customer Joe Smith.

No comments:

Post a Comment