Four Key Concepts of Computer Programming
Last week Rob Miles who is taller than I am, has more hair than I do and has an English accent all of which indicate he is probably a lot smarter than I am left a comment on one of my posts that lists his idea of the four key concepts in programming. He left to comment on Do We Need A New Teaching Programming Language BTW. The post and his full comment are worth the read. Rob’s list was:
- Process data (assignment)
- Make decisions (if)
- Loop (do - while, for)
- Use indexed storage (arrays)
Among other things he said:
If you can do these four things you can write every program that has ever existed. Sure, the code won't be pretty, but it will solve the problem. In my course we focus on algorithms at the start because this is where we actually create behaviours [note classy British spelling which adds credibility] that solve problems.
In all seriousness, Rob is a great teacher who also writes some really good textbooks. He really knows his stuff. All of that not withstanding I kept trying to think of a fifth thing to add to his list.
I thought about input/output for a long time. But I/O is such a platform dependent sort of thing. It depends not only on the language but the operating system and even available hardware. Input via a key board is different from punch cards (remember those) and still more different from input via a Kinect sensor (let’s keep in mind that there is a future). As I recall the PASCAL standard did not specify requirements for input/output and left it to the developers for individual platforms. So that probably doesn’t fit.
I thought about variables but that is sort of covered by process data and indexed storage. Even internal data representation which I see as a key computer science concept is probably not as key for programming. I have successfully used programming languages that only stored integers and strings. Well maybe there was a Boolean but I forget. I managed to write some useful applications anyway. Some even dealing with money.
Recursion? How often do you really need recursion? And a lot of things that recursion is used for loops will do just fine for. So while one should learn recursion and a really good programmer should know how, and more importantly when, to use it I don’t think it fits the top four or five list.
Would you add something? Remove something? Overall what do you think of Rob’s list?
Note: To subscribe to this blog please use https://feeds.feedburner.com/ComputerScienceTeacher as the RSS feed source. Thanks.
Comments
Anonymous
December 07, 2010
The comment has been removedAnonymous
December 07, 2010
How about Files? Without some form of storage when the code is not running many of our programs are not very useful. Databases could be another storage form.Anonymous
December 07, 2010
I think what I really should have said is "You have to know how to use these things to solve problems before you go any further". I also should have added thing 0 "You need to know how to solve the problem before you can write a program" and thing 00 "You need to know what the problem is before you try to solve it." These are the other two points that I hammer really hard when teaching how to program. The main reason why software projects go awry has nothing to do with programming technique and everything to do with failure to determine what is really required. Abstraction, generalisation and partitioning are there to provide a means by which you can take the raw abilities of the hardware and make them properly able to solve real world problems in a managed way. Remember, I'm not actually saying these are the only things that you should teach, what I'm saying is that it is important people understand that these things are what computers really do and that everything else is built on top of these fundamentals.Anonymous
December 08, 2010
The New Zealand Ministry of Education is working on these matter with the teachers and qualification for our year 11-13 students ages 15-18 years old www.tki.org.nz/.../dt1_46_int_8jul10.doc They have outlined that a computer program is A basic computer program is a program, written in a programming language, that: will include variables, assignment, predefined actions (e.g. predefined methods, functions, or procedures), expressions, sequence, selection and iteration control structures obtains and uses input, from a user, sensors, or other external source has been tested and works correctly. check out the link above, it may give you some ideas on where things are goingAnonymous
December 08, 2010
He has forgotton functions/modules/subroutines. Breaking down problems into smaller parts is fundamental to programming.Anonymous
December 08, 2010
Seems like a very narrow definition of what constitutes programming. So much for prolog and Turing machines. To heck with proof based systems like multi-dimensional programming.Anonymous
December 08, 2010
As long as Data Types and Manipulation functions (+-*/etc)are included in 'Process Data', then the primary level is Process Data and Make Decisions. All programs can be written with those. Loops and Indexing are program folding techniques and are level 2. You can continue up the ladderAnonymous
December 08, 2010
The comment has been removedAnonymous
December 09, 2010
>I also should have added thing 0 "You need to know how to >solve the problem before you can write a program" and thing >00 "You need to know what the problem is before you try to >solve it." Those aren't programming concepts, but problem solving fundamentals in general for pretty much anything you do in life. Also you don't need "indexed" storage (arrays) per se, just some sort of dynamic storage allocation. As a practical consideration I think you do need another concept, whether you call it I/O or debugging or "feedback" or whatever. The fact that I/O is hardware dependent is beside the point. The programmer has to have some feedback from the system to verify the program is working, and to learn, practice, experiment and modify along the way. I'd call that very fundamental. Otherwise it would be like trying to learn to play the piano without being able to feel with your fingers or hear the sounds - theoretically possible if you're already a master, but essentially impossible if you're learning. In fact if you're talking about teaching and learning programming, I'd put this thing (whatever you call it) first on the list.Anonymous
December 09, 2010
To add to the I/O comment, imagine a computer program with no input and not output. What exactly could that program accomplish? How many such programs exist? If you think about that, I think you'll realize I/O of some sort is pretty fundamental. You can write a program without arrays, without loops, without decisions, and without I/O, but that's not really the point.Anonymous
December 09, 2010
It is amazing how people get wrapped aroung the axle about a topic like this. I have been teaching CS to HS kids for 20 years (give or take a decade) and I have to agree with Rob's list. But I interperet I/O as part of process data and many of the other objections as part of his list in some way or other. I see this list as the focus of a Programming I course and as such it pretty much covers most of the bases. This does not mean these 4 are the only topics covered in the class.Anonymous
December 09, 2010
These four concepts are key concepts, and really everything else is just higher level of abstraction. We need abstraction but it is not core concept. When one understand ifs, loops, arrays and variables, it is enough to write in any programming language is on earth, everything else goes into syntax differences, and on higher level using libraries, frameworks to not reinvent the wheel. So I totally agree.Anonymous
December 09, 2010
While I agree that most everything can probably be categorized somewhere under these 4 broad categories, I also think that the generalization leaves open the possibilities of large holes. When generalizations are used instead of details to specify completeness, there is a huge potential for incompleteness. I have interviewed "experienced" programmers who have learned all four of these concepts and done a lot of programming, but can't debug a problem because they don't understand memory models and stack frames. The devil is in the details.Anonymous
December 09, 2010
The comment has been removedAnonymous
December 09, 2010
The skilled programmers does not required the advanced concepts.May be it help in writing code much easier, modular and quicker It is sufficient to have these four basic concept understanding to write any code.I/O is again help in making things easier to display and feed the values. Even recursion is advanced concept,which helps in easier implementation.But the programmer with little intelligence and skill can break down the problem in such a way ,so that advanced concept are not necessary for computation.Anonymous
December 09, 2010
ya it looks nice. But actual programing paradigm itself needs its basic definition.And flow chart diagram.It only explains how loops ,conditions,expressions and other flow of program works in sequence. When one wants to solve a problem.One should create an abstract explaining the actual behavior and working of the program. then explaining the algorithm with flow chart.Then only one can ever start programming.This applies to all languages and program paradigms.Anonymous
December 10, 2010
Maybe flow charts are useful, but they are mainly critical to imperative paradigms. Functional paradigms might best use flow charts to communicate dependencies, which might not be so important in a massively parallel environment or any other where Time (and sequencing) is not the most important consideration.Anonymous
December 13, 2010
Rob Miles is someone I've looked up to (literally) since he was a couple of years ahead of me at University. I think that the first programming language that one should introduce people to should be the native language of the person being taught. Teach people to marshall their thoughts and to write down clear instructions. Teach them to plan meal menu / recipes, write route for walkers, guide blindfolded people around rooms, etc. Teach them to write essays - that will introduce them to reasearching concepts and problem domains, decomposition of ideas, structure, flow, and clarity of reasoning. Only when they have learnt to think logically and clearly and to be able to communicate is it rational to even consider straight-jacketting them in computer languages of any kind. Computer Languages are like Newspeak in 1984 - designed to reduce the types of things that you can think about, not to release the imagination.