AN INTRODUCTION TO C

In previous lessons, you were introduced to the basic structures of programming such as conditional statements, variables, input, subroutines, and more. Now you're going to look at a group of languages that have been very important in the history of computing and are the dominant languages in much of computing today.

For simplicity, these are referred to as the C family of languages because they have the C language in their background. The language called C was developed in the 1970s as a powerful and portable language usable at both the systems and applications level. What is called systems-level programming deals with the nitty-gritty details of hardware and operating systems, while applications-level programs run on top of operating systems and deal with user's tasks. The languages in this family share the following characteristics:

  • The core of the language is compact and depends on libraries to achieve functionality. Programs must specifically declare the libraries to be used.
  • Variables and functions must be declared with type information, and the language (usually) pays attention to the declared type in all subsequent uses.
  • There is a simple way to create complex variables that represent a collection of simpler variables.
  • Programs are built up of short statements written in plain text using the equal sign (=) to assign values to variables and expressions that look similar to standard algebra. These statements are built up into modules that can be compiled separately.

History of the C Language

The C language was developed with the original Unix operating system and still has some elements (such as terse abbreviations for commands) in common with it. Because of C's power and flexibility, it has become one of the most widely used computer languages, and compilers are available for a huge number of different systems. Because C programs usually have platform specific details; however, moving a program written for a Mac, for example, to a PC may take a bit of work.

When talking about computer languages, platform generally refers to a particular combination of hardware and operating system. You might see a product for the Windows platform, the Mac platform or the Linux - x86 platform. Unfortunately, this distinction breaks down a bit when you get to the Java platform because it runs on so many combinations of hardware and operating system.

You can read a history of the development of C in a paper by Dennis Ritchie, one of the originators of C. The language has been standardized, both in terms of basic syntax and in terms of standard libraries. C compilers for a large number of operating system are supported by the Free Software Foundation.

The power and flexibility of C come at a price, however. Complex C programs can be really hard to debug, and it may be susceptible to viruses and hacker attacks. There are a number of errors commonly made by novice (and even experienced) programmers that can be hard to find. Basically, it's easy to shoot yourself in the foot with C.

History of the C++ Language

C++ (spoken as C plus plus) builds on the C language as the name indicates. Because C++ contains all of C, C++ compilers compile strictly C programs without difficulty; however, the opposite is not true. Bjarne Stroustrup, working at Bell labs, started development of C++ in the early 1980s as described in a short history.

C++ popularized the idea of OOP (object-oriented programming) in which the variables and functions with which the programmer deals are thought of as being packaged in objects . Thinking of programs this way helps to control the complexity of very large programming projects. As OOP is a vital part of programming these days, you will see that term frequently.

Unfortunately, C++ also inherits from C the many possibilities for hard to find bugs. For example, it's perfectly possible to write a program that writes data all over itself and dies. When you see news reports of newly found security problems in some operating system, the root cause may well be this sort of problem.

One of the great strengths of C and C++ is the enormous number of libraries of already debugged code that are available. Although these are called libraries, they are really more similar to single books in a huge library. In addition to the free open source libraries, there are also commercial libraries that can be licensed.

Similar to C, the syntax and standard libraries of C++ are under the control of a standards committee of the ANSI (American National Standards Institute). When you see references to ANSI C++, it means an implementation that adheres to the standard.

History of the Java Language

Researchers at Sun Microsystems were doing "blue sky" research in the early 1990s. They felt strongly that the future of computing would depend heavily on interconnected (networked) computers and small computing objects communicating with each other. At that time, there were no languages that made communication over networks easy and portable.

In speculating on what kind of language would be required, they liked the syntax of C and the idea of OOP, but decided that many conventions in C++ would have to be removed or revised to make a more bug-resistant language. In particular, they wanted to make memory management , multithreading, and network connectivity easier. (Don't worry, these terms are all explained in later lessons.) This is where Java comes into play. Java incorporates many security features that make fatal bugs less likely.

Click this link to read about the exciting early history of Java as recalled by the originators on the third anniversary of its release. Java achieved more rapid adoption than any other language up to that time because it was perfectly positioned to catch the rising interest in the Internet, and it was designed with network communication in mind. Sun has always made Java implementations available for free, and this policy has stimulated a huge community of programmers to create their own freely available resources.

The Java language specification was developed by Sun Microsystems, and use of the name Java is still controlled by Sun. However, Sun has involved many individuals and industry partners in the subsequent development of the language and standardization proceeds through an organization called the Java Community Process rather than ANSI.

Even more than C or C++, Java comes close to the goal of running complex programs on many different kinds of hardware with no modification.

What's Next for the C Family

The success of Java has inspired Microsoft to create the latest member of the C family of languages -- C# (pronounced C sharp.) The creation of C# is a key factor in Microsoft's attempt to unify the programming environment for many different languages. It combines ideas that have been successful in Java with some additional features. At present, C# development appears to be confined to the Windows platform, but there's no reason it could not be extended to other platforms. C# is so new that a history article isn't readily available, but here is a site for beginners in the language.