The Purpose of Programming
One of the most important things in education is learning WHY things work, not just how to throw something together. Too often someone will skip the work of a mathematical problem and put some bogus solution to the question hoping that they get a correct answer, not knowing how to get the right answer even if the solution was correct. It is so important for a basketball player to understand why a “gooseneck” shot is better than just heaving a ball towards the hoop, or for a baseball pitcher to know how to throw strikes, instead of chucking the ball towards the catcher hoping that it doesn't hit the batter. This idea also expands into the field of computer science.
It is important for computer programmers to know why and how things work in computer code, instead of just copying and pasting other pieces of code. In an interview with Dr. Lori Payne, Department Head of Computer Science, Mathematics, and Statistics at Mesa State College, the question was given, “Some people have noticed that programmers are coming out of college and not being able to be proficient in the workplace. That they only know how to use the STL (a library of standard coding templates) and cut and paste code from the internet... Do you agree with this?” Dr. Payne's response is quite striking. She answers:
"Yes, I do agree with [this]. I know that, because I have had employers that have told me so. People who have hired from other institutions, when they got these people on the job site they could not do anything but very standard tasks, because they had to be tasks that they could find some code that somebody else had actually written. They could not modify other people's code, they didn't seem to be able to understand basic algorithms of creation."
She also agreed that these same programmers, the ones coming out of college, have a deficiency of deciphering (reading and understanding) other scientist's code. This is a very big problem because some people writing the applications for our computers, cell phones, video games, etc, don't know what they're doing! They don't know what programming is in its basic form! Granted not all programmers are like this, but the fact still remains, that this is a major problem.
How do we overcome such a major, and potentially hazardous, problem? There are obviously many solutions to this situation, but the best one that stands out is for colleges to teach C++ in their curriculum as the beginning language so students learn what programming is, and how to do it. C++ may not be the perfect programming language, but it offers the best solution.
First, what is computer programming and what aspects of it are important to learn? Dr. Warren MacEvoy, Professor of Computer Science at Mesa State College, was interviewed and given the question, “When you teach programming in its most basic form... what do you believe to be the most important things to teach?” He responds:
"To try to explain the fundamentals and commonalities between [programming] languages.... The basic structure of the language in order to describe the recipe of how things are done.... Understanding how values are represented on a computer and in particular for implementing correct algorithms.... The whole object structure.... The idea of using a modern debugger of some sort to be able to trace through an application and actually see how it goes, I think it makes a big difference."
All the aspects Dr. MacEvoy discusses here are key to understanding as a programmer, they are things that will make it to where a programmer can solve many problems without any help or without cutting and pasting from the internet. Professor Bjarne Stroustrup, Department Head at Texas A&M, mentions a few other key things in response to the same question asked to him. He says that he teaches about loops and structures and also makes sure students work with code that actually works early in the teaching process. All three of these things are critically important in the process of understanding programming. In response to the question, “What is programming to you?” MacEvoy responds, “To create useful things that codifies stuff that other people need or find useful.” Dr. Payne in response to the same question says that its problem solving. This means that if programmers truly understand what they are doing, it means that they wont go through the motions of making it look like they're doing something, but will actively search for answers to problems, or for solutions to problems given from clientele. Professor Stroustrup says it the best in an interview response, he says:
"Someone who can only use libraries and cut and paste is not a programmer, let alone a computer scientist. My opinion is that programmers should know in principle how every library used is constructed and have experimented with writing some basic library implementations themselves. If they don’t, they’ll be prone to believing the strangest things about their libraries – and libraries are one of the most fundamental tools for effective programming."
Now, “Why C++?” C++ does have its disadvantages, Dr. Payne, Dr. MacEvoy, and Professor Stroustrup all agree, which is quite significant considering that Professor Stroustrup created the language. They all mention that it is a complex language to use, and that it has its quirks. However, they all have good things to say about it too. Dr. Payne talks about how its a great language to use because it is such a popular tool, she says, “It is the single most used language among the kinds of jobs that students of ours will be getting.” She also makes mention that if you know C++ you can pick up a lot of other popular languages out there. Dr. MacEvoy makes an analogy and compares the fact that we don't start by teaching our children Spanish here in America, we teach them English. Not because English is harder, but it is the language we all speak. Kyle Wilson a professional game developer puts it well when he states:
"Nothing succeeds like success. The fact that C++ is the dominant language for game development gives it a lot of inertia. If you want to hire experienced programmers, it's much easier to recruit C++ gurus than it is to find OCaml talent. If you're going to develop for consoles, Microsoft and Sony provide C++ compilers, but for any other language you're on your own." (Game Architect.Net)
The same reasoning goes with teaching C++, C++ is taught because it is so popular. All three interviewees agree as well that C++ offers programmers a chance to learn key programming tools such as; structures, classes, arrays, functions, templates, etc. Which is another reason as to why C++ is a great beginning language. Stroustrup says:
"C++’s language features, such as functions, exceptions, classes, class hierarchies, and templates can – and should – be used to teach the programming techniques for which they were devised. Even pointers and arrays have their place – in particular, it is hard to demonstrate the implementation of data structures without them – but I always present them as necessary implementation tools rather than facilities to be used in interfaces or as part of high-level design."
C++ does offer great reasons as to why it would be an excellent beginning language.
As stated before, C++ is not a perfect language, but the truth is that no languages are perfect. C++ has is quirks and as Dr. Payne states, “It leaves you with enough room to hang yourself with code.” This is actually a good thing for programmers to learn. It is advantageous for Computer Scientists to learn that ALL programming languages have their own quirks, and that you NEED to learn them. It is also advantageous for them to know how exactly their programs work so they don't “hang” their programs with the code. The fact that C++ is not perfect would not be a good reason to not use it as a beginning language, because in fact, ALL languages are not perfect.
The following is an example of C++ code and a breakdown of how it works. Please note that anything following a “//” is an explanation of what the code is doing.
#include
#include
#include
#include
using namespace std;
void multiply (int x, int y) //This function takes two integers and multiplies them
{
cout << x*y << endl;
}
int main() //This is the main function that asks for two numbers to be entered
{ //and then sends them to the multiply function.
int a, b;
cout << “Please enter two integers to be multiplied together.” << endl;
cin >> a >> b >> endl;
multiply(a, b);
return 0;
}
This is a great example of how C++ is used in the programmer's eyes. Please note, that this is NOT the most efficient code in C++. This is an example that shows different elements of programming being used in C++. This is a program that has a user input two different numbers and then sends them to the function “multiply” which in turn outputs the product of the two numbers. This uses a good amount of elements that were mentioned by Professor Stroustrup, Dr. MacEvoy, and Dr. Payne. It shows how libraries are used, how to create functions and call them, and how to manipulate the input data of the program, all of which are basic things programmers must know. In other languages, such things could quite possibly take only 1 or 2 lines of code, but would have nowhere near the teaching effect that this C++ code offers since it has so many elements of programming needed. It is the same reason that teachers always teach the hard way to solve a problem first and then the easy method, so the student learns WHY to solve the problem when they are using the easy way.
It is important for programmers to begin writing programs early especially when using C++. When programmers get to create programs, they even better understand what they are doing, and why they are doing it. Which is why when using C++, the last thing to help beginning programmers become better, is to have them create lots of programs. Professor Stroustrup in his book “Programming: Principles and Practice using C++” says:
"Programming is learned by writing programs. In this, programming is similar to other endeavors with a practical component. You cannot learn to swim, to play a musical instrument, or to drive a car just from reading a book — you must practice. Nor can you learn to program without reading and writing lots of code." (Stroustrup XXV)
In conclusion, there is a problem with some Computer Science students coming out of college not being able to be proficient in their programming skills. C++ offers a way for this problem to be overcome and to greatly increase the ability of all Computer Science students when used correctly. C++ offers many ways to be the best beginning language, it helps students learn how to use; functions, data structures, objects, arrays, libraries, and many more essential things needed in the field of Computer Science. Schools and educational institutions everywhere should take time to examine their curriculum and and make C++ their beginning language if they are not already using it as such. If they are using C++, schools should examine the course material being taught and see if it is using C++ to its fullest potential. Doing such things could lead to the day when no one in the field of Computer Science is found inept of the skills they will need to succeed in the jobs they are assigned.
Works Cited
Game Architect.Net. 2010. Kyle Wilson's Musings on Game Engine Structure and Design. 4 April. 2010
Macevoy, Warren. Personal interview. 16 April 2010
Payne, Lori. Personal interview. 16 April 2010
Stroustrup, Bjarne. Personal interview. 18 April 2010
Stroustrup, Bjarne. Programming: Principles and Practice using C++. n.p: Addison-Wesley, 2009.