Read this post on slashdot, and this article that the post references. The comments on the /. page is interesting as well.
In short, we all know that today’s university graduates learn very little about programming and software architecture that has real value from their curriculum. This article focuses on the problems of high-level programming languages, but the reverse is equally true. Again we have all seen old-timers who can code in assembly and C, but are still struggling to grasp this “new” concept called Object-Oriented Programming!
I’m sure that for great programmers, a language is just a window, and not their eyes. They can use a different window in the other wall if the current one does not offer the view they desire or has the wrong-colored glass panes, but for the rest of us, our programming languages pretty much define what we consider easy/hard/fun/boring (if not possible/impossible.)
That’s one of the reasons I like and prefer C++. It hides almost nothing of the complexities and idiosyncrasies of the underlying machine (which can be a pain, or an opportunity) while still letting you solve, or at least manage, the pains and take advantage of the opportunities. It’s mighty complex and full of dark corners and dirty tricks, but you can get the job done, on any level you want, as close or as far as the bare metal as you want.
In short, C++ rocks!
Printer-friendly version
ahf | 17-Feb-08 at 7:59 am | Permalink
Nice article, I think quite true too. I think if you can divide the mental tasks into two categories, they would be : processing and accessing memory, much like computers. We either do process, which could be creative or deductive and sometimes we fetch information from the memory, now in order to solve un-solved problems and touch the new borders of thought, you definitely have to process since nothing exists in the memories, but if something has been done, you might as well be ok by putting it in the memory part of your brain, it doesn’t need your brain to work as much and is a lot simpler.
Now what does this have to do with programming? There seems to be a shift from imperative programming style to declarative programming style, the difference here being the programmer would not need to define the process (the core of thinking …) and she is ok just by defining (declaring) values (like setting the height of a button). A programming language like java with a huge library base (where should the information about this huge library be? In the memory??) … would not need much processing by the mind in order to come up with new orchestrations of algorithmic elements… (although this can be done on a much huger scale which most coders will not touch). You just have to know that something exists, you won’t create as much… just like what VB has done and if the authors believe that Java is killing the programmer attitude, something like VB has been mass killing for years..
The sad (probably) fact is that I see this trend not just in academia and programming but everywhere else in life, the need for thinking(processing) is being reduced as time goes by and things are commoditized (technology) … seems like the modern human is facing situations to think, less and less…
How much thought process is needed for :
Multiplying numbers in your head -> Using an abacus -> Calculator -> bar code reader and computer ….
MatGill | 17-Feb-08 at 12:34 pm | Permalink
It’s not always about being possible. These days you need to get the job done as fast as possible. You also need to collaborate with a bunch of other programmers who don’t share your taste or level of bad-ass-ness in C++. You need to use platforms and tools written in a certain language. You need to take into account that C++ is not suitable for a webserver hosting multiple web applications, doesn’t include platform independent threading, networking, database access infrastructures, GUI programming, many of the dynamic features needed for true object oriented patterns and techniques, and heck a lot of other shortcomings that makes your life miserable when it comes to real-life you-get-paid-for applications. You need to worry about the fact that your boss has heard much about .Net or Java that no matter how hard you try to convince him/her, he/she wouldn’t give a shit.
Enough of that crap, C++ rux
Hamid | 17-Feb-08 at 1:37 pm | Permalink
The article you’ve suggested is one of the great ones, but as the article said, the problem is not with Java. Java of course has its own advantages and disadvantages just like any other language. If students don’t really understand pointers because they are hidden by Java references, it’s not Java fault. I think it’s the instructor fault! In fact something is wrong with the training system, not with Java. It’s fine to teach C/C++ first and then teach java references by comparing them by C pointers. In addition, I think other programming languages like C++ (and even Python) have huge libraries, too. You can’t force others not to download and use them. Can you?
yzt | 18-Feb-08 at 11:06 am | Permalink
I gotta run now. Will discuss your interesting points later.
@Hamid(3):
Hi, and welcome!
yzt | 23-Feb-08 at 2:10 am | Permalink
@Hamid (3):
No one said that it’s Java’s fault that the computer scientist don’t know anything about computers anymore. It’s like saying it’s the poison’s fault that we die if we drink it!
About the role of standard libraries. All of us know that what you suggest is unrealistic. The stuff that get included in the standard library of a language will be used by everybody, most of all students and beginners. But downloading and installing a 3rd party library may be too complicated (new interface and rules, different documentation, design philosophy, approach, assumptions, etc.) or even impossible or disallowed in some situations, specially those involving students.
Again, the subject here is the standard library accompanying a language, not just any library. You are correct about Python having a huge (and immensely useful and practical) library, but Python is hardly any more suitable than Java to teach to CS or CE majors.
And C++’s standard library is so small compared to the gorilla that comes with Java that it’s almost embarrassing (to Java programmers, not C++ code monkeys!)
To answer your question that whether someone can force you not to download and use a library, I must say that of course you can! If you are the teacher and the “someone”s are your students, you may very well restrict the use of any and all libraries altogether. But writing any practical program without the standard library is close to impossible (or outright impossible without falling back to OS system calls) and restricting to only parts of a library is rather hard too (You can try and tell students not to use vector, but they will easily use deque or even basic_string instead.)
yzt | 24-Feb-08 at 5:28 pm | Permalink
The original discussion was mainly about the programming languages taught in schools, and not languages for professionals.
But your point is also interesting and true, to some extent.
You say that a programmer needs to write code as fast s possible, or in other words, deliver new features and bug fixes as fast as possible. While I believe that this is mostly about better programmers, and not better programming languages, I do concede that the language and library do count in a major way in this aspect. But a programming language is not just about making the common tasks easy. It should also make everything else possible. There are some things that are completely impossible in Java or Python or almost any other language, except C/C++ or Assembly. Do I have to name those tasks? I’m not saying that it’s hard or complicated or unwieldy, I’m saying it’s outright impossible (of course, you can extend any decent language with modules written in C (or go through the whole hoopla of JNI or JINI or whatever it’s called,) but that’s kind of cheating in this context.) One other way to do the otherwise impossible tasks is to write a C++-to-X converter (or interpreter) in language X and define C++ syntax as an input data description language for the given application, but this brings us face to face with the other limitation of almost all the languages that boast “productivity”, etc.: performance. Your interpreted (or converted) C++ program will run so slow that it won’t be possible to do any real work in it. Again, this drop in performance from C/C++ to any other popular language is not a mere inconvenience, it’s a hard limit.
On the other hand, there’s nothing you can’t do in C++ that you can in Java. I’m talking about user-observable things here. Sure, you can’t have completely transparent and non-intrusive object serialization in C++, but that’ll only make life a little harder; it won’t prevent me from implementing any features visible to end-users.
You say that C++ is not suitable for a web server hosting multiple applications, which is confusing to me, because all production-level web servers are written in C++ (or its subset, C.) Maybe you meant web-based applications? Well, while you are correct that most of the web-based applications are not written in a compiled language, it’s more a matter of laziness or time-to-market considerations or resources that drives the decision, not C++’s inability (or unsuitability) to generate or serve web-pages. I have no doubt that the most demanding web applications are still written in C/C++, because of performance concerns. I can testify to the fact myself, because I have written a non-trivial and moderately usable web-based application (KOPCS) in C++ and it could serve hundreds of users simultaneously on commodity hardware, without breaking a sweat. And all that in plain CGI (as opposed to FCGI or FastCGI or falling back to specialized Apache modules) and without page or session caching or any of the other tricks that are so common these days (I’m not blaming them, just saying that we could have still achieved one to two orders of magnitude more performance with those techniques.)
You say that we can’t use C++ because it’s not interoperable with other languages/tools/platforms/frameworks. Is that really so? Or is it just a little bit harder to design for real extensibility and interoperability?
You say that C++ does not include platform-independent threading, networking, database access, GUI framework, etc. Again, I have to assume that you mean all that is lacking in the “standard library“, otherwise, it’s obviously incorrect. Just look at pthreads, Boost, SOCI, wxWidgets, ASIO and the Berkeley Socket API among many many more. And those are the platform independent ones. In fact, there’s rarely a tool or service that’s unusable from C/C++, and when there is, it’s usually only because of some fascist vendors’ reliance on customer “lock in” for revenue. And all the dynamic features I can think of either fall into the “harder but not impossible” category, or are already supported in some form other than that of other languages.
The archetypal “pointy-haired” idiot boss is the only impractical-to-circumvent problem I see with C++!
MatGill | 25-Feb-08 at 5:58 am | Permalink
Gee! That was too much of an answer to the modestly meaningless concerns I opposed (whatever that may mean!).
A few points on your points:
I think we all agree that education is not meant only for the purpose of education itself. And you can’t teach people _everything_. So you have to stick to the things that are mostly used in a future job. Any realistic sole would agree that in today’s software market (and specially in Iran) Java and .Net are by far more popular than C++. And guess what? Those rare areas of shortcoming in Java-like languages simply do not happen in everyday life of an average programmer, and if they do (god forbid :D), can certainly be handled by those “cheating”s. I myself once coded some very tricky JNI code with threading on the native side for some unusual network protocol in one of those I-got-paid-for applications.
I think we both agree that C++ with all those fancy non-standard libraries has nothing less than Java or Python or whatever. Certainly you (you being yzt) can easily compile and use a huge library that can handle a funky network task or whatever. Me, on the other hand, had to go into hell a lot of trouble to compile and use a library with neural networks, only because there were mismatching dependency versions and heck a lot of problems that was due to bad packaging by the author (after all he was supposed to be an AI guy rather than a programmer). Anyhow, the point is that you need to think out of the box (box being yourself, you being yzt) and see that this “possible” but “slightly harder” of yours is probably “a whole lot of crap” for me and for the majority is literally “impossible”. Anyhow, if you managed to do _any_ native programming for Nokia 5200 with your cross-platform “wxWidgets”, let me know about it. For the time being, I’ll stick to J2ME.
Before I go on any further let me clarify what I meant by the point on web-applications. I was referring to the lack of basic security mechanisms and sandboxing type of crap that can only be done by hardcoding it into the OS or having a virtual machine. You need to make sure the access areas of different applications on the same host do not intersect, witch is sometimes impossible. I suppose that is technically possible, though I’m not quite sure if that is the case. I know that these days they do massive virtualization with Zen and likewise to provide light weight sandboxing that could prevent such stuff for all and for good (once again whatever that may mean).
Even on the client side, things like code signing and likewise (which is a part of the language/runtime infrastructure for Java or .Net) can’t be directly supported in native languages. For an implementation with native languages you will need direct OS support like signature checks for packages on modern Linux distros, or driver signature checks for Windows, both of which are not runtime checks. That is exactly the reason we see native code being the basic source of virus infections.
I myself have done professional coding (professional meaning get-paid-for) in C/C++ (both on Linux and Windows), Java, Python, MATLAB and Delphi. Basically I won’t give a shit what language I am forced to use as long as I get paid for the amount of pain in my ass. I suppose you feel the same, probably in a more polite way. But you know, this world is not a world of geeks and nerds working on their “Mike”s writing state-of-the-art web-applications for online programming contests! People want easy money with no pain whatsoever. They don’t really enjoy writing cool and geeky C++ codes because it’s “fun”. I’m not even sure if I’m still feeling like that myself.
ps: sorry for any mistakes, don’t feel like to check it …
yzt | 25-Feb-08 at 3:26 pm | Permalink
@MatGill (7):
OK, I agree with all that you said about programming as a job. I think everyone of us who have had to work on “commercial” software knows that if you don’t stop caring, you can never finish the job. At some point, you just have to let go of all the perfectionistic (as opposed to idealistic (somehow!)) desires and just do what the boss wants, in whatever language she wants, with whatever technology she wants. And our only solace would be that we know that the code we are writing is wrong in some way.
I guess this is why I have never been entirely successful in that line of work. Because I couldn’t just let go, not easily. (Of course my laziness also played a major role. I’d estimate it to be around 110%!)
So, let’s go back to teaching languages. I think it’s safe to assume that teaching languages is not the purpose of computer science education, not so even for computer engineering. It’s simply a common language to be able to put down ideas precisely, like mathematical symbols and expressions. All I’m saying is that a language to be taught should be selected based not how fast the students can write a web-based calendar, but how expressive they can be for (at least) these three tasks: expressing algorithms and data structures, understanding the machine architecture, and understanding language and computation theory.
Another aspect that a programming language can be important is in the same way that music and literature can be important; as food for your brain. You may listen to mindless rap (not that all rap is mindless) or read a newspaper, but you also should listen to better music and read the classic masterpieces, not because they teach you something but because they make your mind perform better, or let you discover feelings you didn’t know you were capable of, or any of the other dozen reasons that comes to mind.
I read a short story by Isaac Asimov a long time ago, which depicted a future in which people were taught one skill and one skill alone, and they were taught everything about it. This teaching were done directly into their brains and it happened in minutes (they called it “tape” learning or something.) No one were taught anything else ever in this way, and no one generally tried to learn anything else. The protagonist of the story were a young man who wanted to become a computer programmer (what a coincidence!) but he was deemed incompatible and unsuitable for the job. I won’t go into the details, but the guy theorized that if he could have a group of sufficiently intelligent people, he could teach them using books (the idea of which sounded stupid and appalling to everyone else) and while it would take much longer, they also would have a much deeper understanding of any subject and they could help advance the technology and move science forward. (For the life of me, I can’t remember the name of the story or the characters or the collection it was part of. Does anyone know?)
What I’m getting at is that if a big enough majority of us are bad programmers with no deep understanding of the underlying machines and concepts, the next generation will be worse, and the one after that even worse. It may reach the point were all the passion is lost from programming and all the libraries and compilers and languages are developed by mediocre programmers. That would be a sad future indeed.
MatGill | 25-Feb-08 at 10:19 pm | Permalink
Hmmm, good points in there. Well in no place I said that we should only stick to high level languages in a formal education. But I argue that it should be the main concern. Learning to use a programming language is only a small part of the education needed for , say, a software engineer. What I’m saying is that if we want to have an “advanced programming” course, it should teach Java, and not details of C++. This does not mean that we should not refer to C++ at all. In fact I really like the bottom up approach in teaching computer engineering. Start down from transistors and gates, basic computer architecture (maybe 8086 architecture), assembly, C/C++, then maybe Java, high level software architecture and so forth. But the important things is that, you need to put the stress on those “single areas of concern”.
There is an issue here that needs a second thought. Maybe our small world of computer engineering (forgetting about computer science) is now too vast to sit in the same pot. Maybe we need both more high level designer and programmers and more geek like library writers. For now I think we can teach students all those, but little by little it will be out of hand.
Hamid | 27-Feb-08 at 5:32 pm | Permalink
I agree with the majority of your opinions, but there is something I’d like to ask
Which one is best suited for a 1st semester CS/CE student as her/his 1st programming course?
1. A programming course with emphasis on improving algorithmic views of students
2. A general course on computer systems (software, hardware, programming, … and how they are related to each other)
You know, 1st semester students usually face with errors like “out of bound array accesses”, languages like c/c++ are compiled into executable code with no runtime checks. In the case of c/c++ if they do mistakes like that, they will be really in trouble. That is, they just see some strange output. Or even worse, consider the case of dangling pointers (or uninitialized pointers). Languages like java easily generate errors like “out of bound exception” or “null reference exception” at run-time, this is not the case with c/c++. I think there is some contradiction here. That is, if students use java, they won’t understand pointers (and as a consequence dangling pointers). Consider the case of c/c++, we hope, they would understand pointers in this case but doesn’t it has some side-effects. Is it possible that our 1st semester students found it so difficult to implement any algorithm?
They were just some questions, I don’t have any belief about them. I remember my 1st programming course, the accompanying language was Pascal. It may seem strange, but I don’t know whether it was fine or not?
MatGill | 28-Feb-08 at 2:19 am | Permalink
I’m not qualified enough to make any judgments on the matter. But I have some suggestions.
One way to go is to have a purely bottom up approach. We had that type of approach in University of Tehran (which I think has the best educational system for CE among all universities in Iran, including Sharif, not being a patriot or something, but being fair in comparison). We used “From Bits and Bytes to C and Beyond” as the text book. After getting the basics of logic gates and how things work, we wrote assembly programs for a computer called PC2, which was a small RISC machine. We tested our codes on a debugger-like virtual machine. You could actually see the memory locations and all the registers and so forth. I think it’s crucial for rookies to get familiar with those concept in the very beginning of their studies (this is one of the reasons I found the curriculum of UT unique). I remember there was a problem in the book that asked you to write an assembler for this machine with pure 0s and 1s (Yaser should love this :D). And then it introduced higher level languages and their compilers. Then we got to C at which time the time was up.
But now lets talk about math. We all know that CS and ultimately CE are branches of math. We need to make students understand the mathematical backgrounds as well. In a way that they can leave in a perfect world in which no one cares about detailed memory locations. We had a chance to learn stuff like lambda calculus and a few functional languages such as ML (as senior students). These are absolutely needed for CS and make a great foundation for CE (another plus to UT). Unlike other languages that need you to worry about memory and stuff, these are math-based and theoretically any high school student should understand them. They could also be used as the starting point for CS or CE, or maybe along the line I talked about previously.
And finally we get to algorithms and data structures. For these type of studies, I would strongly argue that we need a language very close to human language, with easy notation and possibly with the option to write functional codes and the chance to extend to object oriented version. Ok, Ok, you know what I’m talking about. It’s called Python. I wonder why don’t they use Python instead of Basic in high schools these days. In fact staring with a language like that in the very beginning of a CS or CE BS is a great choice, provided that you want to use a top down approach.
I gave 3 choices above, each of which has it’s own cons and pros. You basically cannot have them all together. But you can definitely cover them all in the BS period. I would suggest a start with bottom up approach along with small introduction to math part in a separate course, and then in the higher levels using Python like languages for pure algorithmic courses.
I really loved the curriculum at UT. I had the chance to design a RISC CPU (a pipelined version at the end!), program it on FPGA and use it with my own hands. I had the chance to build a small computer that was connected to a monitor and a keyboard and wrote a small ping pong game for it. We went through almost the complete design details of 8086 (I once though that I could actually make a motherboard, with simple ICs rather than chipsets) and the ugly patches on for backward compatibility of later machines. On the other hand, we went through all those needed for a typical computer engineer in Iran and more. Of course it was not perfect, and the professors were not qualified enough. But on the whole I think it was close to a perfect one for a typical Iranian software engineer. The background I learned at UT is by far the best I could get in any university in Iran.
Hey guys, don’t attach back
I’m just being fair, for real!
MatGill | 28-Feb-08 at 2:31 am | Permalink
I forgot to mention. The course work at UT was far more than other universities. Those projects that I talked about in the above text were not single projects at the end of the term. They were weekend assignments and we had them every week or every other week. I myself had to pull all-nighters for at a month during my studies at UT (excluding those that were spent playing Unreal Tournament and DotA:D). Not everyone could keep up with this tough work and many people nagged and just passed the courses without learning those that I talked about. As you see a perfect curriculum is not enough at all.