C/C++ Programming Languag

 

The C and C++ language is used for most major programs and operating systems, including Windows, Linux, and Unix. Years ago, many programs were developed in assembly language for speed and size. But improvements in compilers and hardware have all but eliminated the need for assembly language programming.

Anyone, who has moved from DOS to Windows based programming, can tell you that a Windows based program is many times more complex. While many people use some variation of BASIC, you should give serious consideration to leaving the limitations of BASIC behind and moving to C/C++. The Windows operating system is written in C/C++ and when creating a Windows based program, it is easier to program in the same language.

The BASIC programming language was originally developed as a teaching tool and not as a program development language. BASIC was included with the DOS operating system and as such many people starting writing programs in BASIC. But what was quickly discovered is that memory and other limitations made it difficult to create large programs.

The C language was originally developed as a portable language which could be easily deployed on most types of computers. C is actually written in C with a minimum amount of programming that is dependent on a machine’s CPU and hardware. It was possible for a version to be created for a new computer is weeks instead of months and years. As each version worked the same and had the same commands, it was simple to convert a program from one computer to another. This helped propel C to the premier language it is today.

C++ is an extension of C that adds additional capability while retaining the original C language commands. In my mind, objects and inheritance are the some of the most valuable features of C++. Objects and inheritance are often difficult for the non-C/C++ programmer to grasp. The following brief example should be helpful.

After you have programmed for a while, you realize that much of your code is the same over and over. So you open an old project and copy/paste the code into your new program. Then when you find a mistake, you may have to go back and correct the code in many programs. Every time you correct a program, you have to test that program to insure that it works as expected. Think how much better it would be if you only had to do the code once.

Well this is where an object comes in. An “object” can be data, programming code, or both. Consider a hypothetical object, called ZipCode. ZipCode will be used to store and format a postal Zip Code. ZipCode will also have the ability to check Zip Codes for errors. The actual source for this object will not be developed here and is not necessary for this example.

Now when we write a new program that requires a Zip Code, the ZipCode object is used to create one or more variables to hold Zip Codes. For example, in an invoicing program we could create a ZipCode object called BillToZipCode and ShipToZipCode. These two new objects are ineffect clones of the original ZipCode object and inherit all of the capabilities of the base object.

No additional programming is necessary beyond the code to create the object, typically one line of code. Now when we assign a Zip Code to one of the objects, it is automatically formatted and checked for errors. Each program that uses the ZipCode object has the same capability without additional programming.

Now lets assume that we discover a mistake with the ZipCode object. In convential programming, it would be necessary to check each program individually and correct the code. Each program would have to be tested to insure the changes worked properly. This adds up to a lot of work. Contrast that with our object method. All of the source code is in the parent or base object. Therefore we only have to change the source code at one spot. Then simply recompiling all objects that use the ZipCode object will fix the problem without requiring each program to be tested. Control programs, called MAKE programs, can determine if the programs needs to be recompiled or not. This further simplifies the process.

Hopefully, this makes sense to you. I realize that this is a very simplistic example. But applying the concepts to more complex applications makes program generation easier. Now lets take our example one step further. Lets assume that we want to use the Zip Code and look up the city and state names to lessen the workload of the user. In conventional programming, it would be necessary to modify every program to add this capability. This would obviously require a lot of work to accomplish. Using our C++ object, the job is much simpler. Just load the base object, add in the new code, recompile and all programs which use this object now have the ability to lookup the city and state name after the Zip Code is entered.

This should give you a little head start in understanding how the C++ language can simplify your life. by Lyle Prentiss,  for more information on programming. If you pick up the paper today, you are sure to notice page after page of ads for computer programmers. High school and college students who are not sure “what they want to be when the grow up”, should take a serious look at a career in programming. I started programming over 20 years ago, when your choices for hardware and software were very limited. My first word processing program was “Electric Pencil” and had to be loaded off cassette tape. Times have certainly changed and the opportunity for aspiring programmers has never been better.

I’m going to feature programming tools, such as compilers and editors, which I feel are worth considering. Even on a limited budget, you should be able to put together a system with the hardware and tools that will enable yourself or your child to begin learning to program.

What do you need to get started?

A relatively new computer, running Windows 95, 98, 2000, ME, or NT4. CPU speed should be 200 Mhz or above and 500 Mhz is great. If your computer has a 120-200 Mhz CPU, you’ll still be ok but maybe a little sluggish.
A minimum of 32 Mb of RAM memory (64 Mb with NT or 2000), 128 Mb recommended. Minimum of 300 Mb of free hard disk space. A compiler to develop programs with. Click here for some recommendations. Compilers Borland C++ Builder 5 C++Builder is an ANSI C/C++ compiler for developing applications under Windows and the Internet. Click here for more information.