College students are sometimes taught only a single programming language in detail. This limits their exposure to different language syntax/semantics, as well as approaches to problem solving. Every programming language was originally designed for a specific purpose, and, as such, tends to promote its own unique way of looking at, and solving, a problem.
Understanding just a single language promotes solutions that only approach a problem from a single perspective. Knowing multiple languages allows the problem to be looked at from a variety of perspectives so that multiple solutions can be compared and the most natural solution for the problem can be selected.
Say, for example, all you have is a hammer. In this case, both nails and screws will be best inserted with a hammer. However, if you also have a screw driver, then there is an alternate solution for inserting the screws, and the best tool can be selected for the task at hand.
Languages to solve problems
Programming languages are designed to either solve a specific class of problems or support a specific methodology, each encouraging students to look at a problem from a particular perspective.
FORTRAN, for example, was designed to help solve mathematical problems. It can be an ideal language to use for purely mathematical problem solving. COBOL was designed to help solve business data or form storage and manipulation.
The C language was designed to aid in operating system implementation and has features that allow for direct mapping to, or manipulation of, the underlying hardware.
C++ was designed to take a problem-specific language, C, and add Object Oriented programming support. It is thus a mix of both problem solving capabilities and methodological support.
The Ada programming language was designed to provide reliable operation with an emphasis on type safety, scalability and maintainability.
The Java language was designed to provide Object Oriented methodological support and portability. Scripting languages are, in general, designed to allow for very quick solutions to small problems. This list of programming languages can go on and on.
Multiple languages allow multiple solutions
Introducing students to a variety of languages helps them see each language’s advantages and disadvantages in helping to solve problems.
The C language can be used to teach how to interface to, and better understand, the underlying hardware that the software will run on. There is an advantage in some cases to being able to directly map a problem to the underlying computer, such as specifying where devices are located, or directly mapping a structure to memory. The student will also learn the disadvantages of such a language. Languages that allow direct mapping to the hardware tend to be loosely typed, permitting integers to be used as pointers and vice versa, making logic errors much harder to detect.
The Ada language can be used to give students an understanding of how to map a problem directly to a corresponding solution. Ada has powerful built-in typing capabilities, separation of specification from implementation, generic templates, and built in concurrency/threading support (tasks), to name just a few features. Powerful type constructs allow the problem entities (objects, control threads, etc.) to be directly modeled in the solution.
Separation of the specification from the implementation allows for information hiding to aid in portability to different computers and maintainability as the implementation changes over time. Ada is also a strongly typed language that will teach a student the advantages of the compiler catching errors (such as treating a pointer as an integer, which is possible in C) so that they do not end up being run-time logic errors later on.
There are of course disadvantages as well. An Ada program may take slightly longer to write, as a student must specify the types of all variables prior to their usage. Thus there is a cost for static error detection, but this tends to reduce the time that would later be spent debugging an application.
Java may be a good language for students to learn for directly mapping an Object Oriented (OO) methodology into a programming solution. Its virtual machine implementation provides some type safety and also portability (it allows the solution to ignore the underlying computer). On the other hand, Java tends to be clumsy for problems that are not naturally object-oriented.
Further, Java’s thread model is low-level and error-prone, and the language’s stated objective to hide machine details is an obstacle for low-level and real-time applications where such details are intrinsic to the problem.