Java as a CS Introductory Language?
First, tulare queries: "I'm currently a student at a small university whose CS students are required to attend two terms of Java programming courses before moving on to other OOP languages. My personal feeling is that Java is clunky, ugly, and runs much too slow on most platforms. The official CS department position is that Java is pure OOP (as opposed to C, for example), and furthermore, Java is extremely widely used at this time. Now, I may be stirring things up a little here, but just because everyone does something one way does not neccessarily mean that something is being done the best way. What I'm asking is to hear reasoned opinions on the following statements:
- Java is a fine development language, and it will help me as a programmer to learn it.
- I'm right. Java is a fad, not worth much more than the Windows OS in terms of quality, and my CS faculty is doing me a disservice by cramming it down my throat.
- There's a little truth in both the above statements."
While on IRC, I was discussing this issue a bit with other editors and Chris DiBona happened to have some thoughts on the matter, his words follow:
When Cliff mentioned that a Java in education story was going to be posted, I asked to weigh in on the topic. I will not talk about the suitablity of using a non-free language, as I'm certain that will be discussed in the comments and is not a trivial issue.I don't think that Java, or any Object Oriented language, would be suitable for an AP Computer science class. I don't think it serves the needs of students looking to fully understand the internal workings of a computer, which is in my mind what an AP computer science course should be directed towards.
C is a language that has been designed to be very close to the hardware, and its ideosyncracies and power reflect that. Through this relationship, C reflects the realities of the hardware your programs run on. Memory management, low level process and I/O control are all things that a computer scientist should understand at a very low level, to better aid in future programming and debugging no matter which language is chosen or inflicted upon said scientist.
In contrast, Java has been designed to take such concerns away from the programmer. Memory management? Low level IO? These are not the droids you were looking for.. (at least not without an RMI written in another language) That's okay too, that isn't what people want from Java and it isn't what it was designed to do.
And that is exactly my problem with it being applied in a computer science course designed to teach CS fundamentals. In short, since I believe that AP CS courses should focus on the low level architecture of computing, Java is an inappropriate language for that course.
When is Java appropriate? In your college sophomore comparative languages course, or, alternatively, in an OO course or two, but it shouldn't be used as the keystone language for any CS program. Please don't take this as me saying that Java is neither useful or important in it's own (non-free) way, as it clearly is. However, in my opinion, It should be considered an adjunct subject to a serious program in Computer Science.
C and C++ more intuitive?
You have to be kidding.
Steve Michael
Really, what language you use in those first few programming classes is a secondary concern. You don't take those classes to learn the language (although that is a side effect), you take those classes to learn the fundimentals of programming, which apply to almost all computer languages (BASIC not withstanding). Once you learn the fundimentals, learning whatever language you need, be it C, C++, Python, Perl, Java, Lisp (not as much, functional programming languages are generally different enough from procedural languages that they require another class to use correctly).
I say, use whatever they are teaching, and if you don't like it then pick up another language. It's a lot easier to learn a programming language than it is to learn how to program.
My only concern is trying to shove too much syntax down the throat of first year students. Full blown OO languages tend to require a bit more typing than something like C for the trivial projects that students do, which may turn off some people (I know in my high school, the Pascal class lost 3/4 of it's slow typers on the second day. Worse, in high school almost everybody types slow.)
I guess you might want to avoid "bad habit" languages as well, like BASIC and possibly Perl. I'd also shy away from anything that the average windows user hasn't heard of like Scheme, Python, Modula II, Ada, or APL. You probabally want to chose something with good free or cheap compilers as well. Ada95 may be a nice language, but your school won't be able to afford the licenses for the compilers under Windows.
Down that path lies madness. On the other hand, the road to hell is paved with melting snowballs.
I read the internet for the articles.
Out of all of the other languages I have ever studied [including C, C++, TCL, Perl, PHP, Forth, Scheme] Python is by far the easiest to pick up and use right away.
It's something you have to experience yourself to truly appreciate how easy it is to pick up.
If I ever had to teach someone how to program, I'd definitely introduce them to Python first. The concepts are easy to grasp without having to sweat all of the small stuff that could otherwise be extremely distracting and only dilute the main ideas.
--
Computers are getting faster all the time, but programmers won't unless they can use languages which take care of some of the housekeeping for them. It is this more pragmatic philosophy which underpins Java, not to mention most other modern languages.
--
Oh, how I agree. In my university:
We were taught procedural programming in Modula 2 -- because it enforces good practice.
We were taught functional programming in Miranda -- because Miranda doesn't let you sneak in procedural paradigms by the back door (although Miranda only really clicked for me after a Lisp course taught by a better lecturer -- Lisp *does* let you sneak in procedural tricks).
We were taught OO using Eiffel -- because Eiffel is a pure OO language that doesn't tempt you into non-OO constructs (as C++ might).
--
This was around 1995, when Java was quite new -- I recall our OO lecturer saying that maybe Java might soon become a suitable language for teaching OO but that it was too soon to tell. In my limited experience of Java, I suspect that it would make an excellent teaching language (I tried to persuade my IT-teaching girlfriend to use Java as her language for teaching programming -- school politics with regard to installing software on the system put paid to that idea).
At university there were no end of students whingeing at the lack of real-world stuff they were learning: one student memorably complained that the word "Novell" was never mentioned in a complete networks. Likewise, many wanted to learn real-world languages such as C (which we did, later). Those people were and are wrong. If you have a good grounding in the theory, adapting to the real world is easy. The reverse is not as easy.
--
... is it vocation skills, transferrable skills based on concepts, or the inner workings of a computer.
If it's about OO programming, I would go with Java. C++ is a complicated language, and doesn't force OO. In addition, C++ will also distract from learning OO as the student will have to fiddle around with other unrelated implementation details, such as make files, wierd linker errors, etc. If you're learning OO, spending most of your time learning a specific language is rather silly (and C++ can be a very time consuming language to learn).
Personally I prefer learning the concepts and transferrable skills. I can apply these in many situations and they will last longer through out my career. The practical stuff I can learn on the go, and I doubt that school will ever be able to teach that sufficiently anyway.
Today's students will probably do thir best work in a language similar to Java, but with better support for the things that Java is bad at. This language does not yet exist at all.
It will use many of the same language features that languages that currently exist have, though, and this is what it is worth learning. Of course, its features which are currently available are available in different languages, so it's important to learn multiple languages.
For OOP, I think that Java is a good tool. Possibly Scheme would be better if you wanted to present the full range of possibilities, since there are theoretically significant features that Java lacks (e.g., singleton instances). Of course, in order to be particularly good programmers, people need to know more than just OO concepts, and that means they'll need to learn a language that's good for teaching those concepts.
In practice, currently I would suggest C for actual programming, including OOP, unless you need platform-independence or you need libraries that exist only in another language. But I wouldn't want to try *teaching* OOP with C; you really want to have a language where the OO syntax is obvious and explicit.
The first real language used in the CS curriculum (the first class uses a made-up language that theoretically has no compiler or interpreter) is Java. The reason is simple: Java is OOP without being obstructive about it (*cough*Smalltalk*cough*), and it's a pretty good language. The theory goes that it's easier for students to learn OOP first, then learn procedural (and functional, etc.) programming. In my experience, this seems well borne out... most people I know who learned procedural programming first really struggled (in some cases, still struggle) with OOP. Those who learned OOP first had no real problem picking up procedural.
I think a lot of posters here are ignoring the fact that no sane human would teach an entire CS curriculum in one language or even one paradigm. It's also worth noting that we're not talking about teach a language so much as we are about using a language in the course of teaching computer science concepts. Maybe it's the GT student in me, but I find that an important distinction.
I've mostly forgotten Java. I've also forgotten a lot of C specifics, and I can barely remember what little C++ I learned. Smalltalk is something I'm happy to have dropped from memory. I once knew BASIC, I've seen some FORTRAN and some COBOL, and at some point I even knew MOO.
I've forgotten most of these languages because I can. When I sit down to read them (as I occasionally do) or to use one (as sometimes happens), it takes me little to no time to get back up to speed and get to work. The reason is simple: I was taught the ideas that form the basis of computer science and of computer programming. The languages were just tools, and still are.
I could understand this if you were actually using C or C++ in a procedural manner. This type of step by step programming is much more intuitive and conducive to learning.
:)
Other than that, there's absolutely nothing about C++ that is more intuitive than Java!
There are already tons of implementations of the JVM and the Java compiler, in case you hadn't noticed. Sun has a very very extensive language specification published, and anyone is free to implement it, no strings attached.
The trick is that to make Java useful for most things, you need the very extensive libraries that are copyrighted by Sun.
But this is just the same thing as C#, isn't it? C# is made to bind tightly to the Win32 API set and to .NET. Having the C# language standardized will mean relatively little if all of the API's that C# code depends on are not standardized. And Microsoft has *always* laughed at anyone who suggested that they should 'standardize' their API's.
- jon
- jon
Ganymede, a GPL'ed metadirectory for UNIX
I think smart kids will handle the transitions to more difficult languages okay. Programming in BASIC involved 'taking too many things for granted', perhaps, but every new language you learn should have something new to teach you anyway, or else why bother?
- jon
- jon
Ganymede, a GPL'ed metadirectory for UNIX
I'd argue that unless you understand assembly, you don't fully know how registers work. I haven't had to write any assembly for over 10 years, yet with every single line of code that I write, I'm thankful that I could if I needed to. I'm sure you're a very competent programmer, but empirical evidence from 20 years of coding shows me that without fail, coders that don't know assembly are unable to progress beyond competence into true greatness. Not that greatness is actually needed for 90% of coding tasks, but nonetheless, those with a background in assembly are without fail better coders.
As for when it should be learned, I disagree that it should be a first language, but it should be mandatory in any CS course at some point. but
"The invisible and the non-existent look very much alike." -- Delos B. McKown
As I see it, University (College) is about education not about industrial training. You shouldn't be taught specific tools at university rather you should be taught theory.
Many people see it this way, and I can understand it to a certain degree. But you should also consider that learning a programming language to a level where you are REALLY productive and wont regret what your wrote 6 months later takes years. I think I reached this point in Java after 1-2 years (fulltime programming), C++ probably needs much longer - I cannot claim that I reached this point.
IMHO C++ is no language that is easy to learn, but if you are are writing software 40 hours a week you will soon appreciate its large feature set (and maybe even the compact syntax). Java's lack of features like templates/generic programming, macros or multiple inheritance has both advantages and disadvantages. The advantage is that the language is small, easy to learn and it does not have any features that an inexperienced or tasteless programmer can misuse.
The disadvantage is the lack of expressive power resulting of this. Basically Java encourages Cut&Paste programming, which is a maintanance nightmare, a major error source and the root of all evil.
In Java you cannot write something once and then use it for different types, so you start copying the code and modify it slightly for each type. In C++ you can write it once and use templates.
The same problem is code that repeats itself only with slight variations that cannot be expressed with functions. This mostly occurs in regression tests, and can easily done with macros in C++. In Java you will start to copy&paste...
When people need multiple inheritance with several non-abstract classes in Java they start to implement an interface and copy&paste the code. Sometimes this is also done using a code-preprocessor, like some CORBA implementations did. In C++ you just multiple inheritance.
"I've had some conversations w/ friends of mine about this very idea. I think that assembly should be the first language taught in CS. To be a skilled programmer, you MUST know how a computer works at the fundamental level. Teaching java to beginning programmers only encourages sloppy programming, despite any admonitions from profs"
And if tomorrow a new CPU is released that doesn't have a von Neumann architecture? How does the person whose fundamental thinking processes w.r.t. application developement were structured by assembly adapt to that?
Personally, I would go a step farther. One of the reasons that ordinary human beings have so much trouble using software is that the programmers are far too close to the details of the machine architecture.
sPh
I rather think the issue is do people want an introductory language for computer science or an introductory language that is going to be useful for getting jobs as programmers (software engineering, development.)
If one is teaching the pure theory side of OO, then something like Smalltalk is going to make more sense, perhaps. (Depending on what you want to teach, theory-wise.) C/C++ would be the worst because they are closer to the machine/hardware.
If one is teaching for the more practical/engineering side, then C/C++ and/or Java is going to make more sense, depending on your perception of where the job market is going.
I've had some conversations w/ friends of mine about this very idea. I think that assembly should be the first language taught in CS. To be a skilled programmer, you MUST know how a computer works at the fundamental level. Teaching java to beginning programmers only encourages sloppy programming, despite any admonitions from profs.
...mainly because Ruby's OO model is dynamic. (Perl's is, too, but as a "first language" it is problematic.)
Much of this "Ask Slashdot" seems a little unfocused: Some people are answering with the assumption that a "first language" is a CS major's first programming language, while others are assuming the class will be attended either primarily or partially by those in other disciplines.
To me JAVA makes sense for the second case, but not for the first. With a good IDE, beginners can get up useful programs with a basic understanding. But it is not a language I would ever choose once I knew the others (OK, in certain cross-platform environments, maybe) for really tough projects.
Ruby breaks through this barrier because it works for beginners who really need a glue language without limitations (Python, Perl or Ruby) as well as for people who are going to be pushing the limits of OO before they are through with their careers.
But the Ruby book (linked in the parent) demonstrates a problem with using OO for new programmers: Which comes first, the OO chicken, or the basic programming egg? How do you teach what OO is without having some basic commands to demonstrate it with? And how do you teach basic commands in an OO language without doing it object-orientedly?
I don't think this problem is insurmountable. But it may be more important than choosing a language. (In fact, the object-oriented ZOOs so offensive to Steeltoe may be failed attempts to do this.)
The final question which needs to be addressed by people deciding about JAVA in first-year classes (or Ruby for that matter) is: What PRECISELY do you mean by "object oriented"?
Perhaps because I have been around so long, I see OO as a dynamic concept. It has changed over time and really only reached its maturity with the publication of Design Patterns. I fully expect it will change still more in the future.
Some languages (JAVA, C++ and Python) take a very accurate snapshot of the current thinking on OO and implement it very well. Other languages (Perl and Ruby) assume that OO will evolve and give you the ability to implement as much of object-orientedness as you'd like.
An interesting question is whether aspect-oriented programming (boy, do I hate that name) will become a part of object-oriented programming or whether it will be considered a separate paradigm. Ruby is the one of the few languages that implements aspect-oriented concepts (like mix-ins) and it also allows programmers to choose where they want to work on that spectrum. (You can ignore aspect-orientedness, you can use the features offered by the language itself, or you can modify its aspect-oriented features into whatever becomes the next definition of the new paradigm.)
All of this makes it an excellent choice for the CS majors starting a basic class which needs an OO language.
One drawback with Ruby (which may actually prove a boon to beginning CS majors) is the lack of a large library like CPAN or the C libraries. Although it is growing, the Ruby Archive is nowhere near as comprehensive as CPAN. While this may be occasionally frustrating, it offers CS majors a good way to make a name for themselves. (There's nothing like applying for a job and finding your prospective employer uses a module you wrote. Voila! Instant reference.) All you have to do to make a name in the Ruby community is go to CPAN, find a module which has no counterpart on the Ruby Archive, and port it to the Ruby idiom. Of course, if Ruby fizzles, that still won't get you a job. But at least you can tell some Perl employer you know the module well enough to port it.
Eternal vigilance only works if you look in every direction.
I'll agree with that. Procedural programming teaches the basic concepts fairly well - and makes a good starting point for learning OO stuff later on down the road.
I started learning how to program in BASIC back when I had a brand-spanking-new TI994A. I was about 5 years old. All I really got out of it was the ability to really mess with the TRS-80s we had in grade school.
Then I started picking up a bit of C. By the time I was gheaded to college, I had a fairly good grasp of the basics. Pointers and the like were still a bit confusing, but I was at least comfortable with if/else, for, while, and various variable types.
I'd also started down the road of *thinking* in terms of procedural language - which i believe is the biggest stumbling block new programmers have - not being able to conceptualize and break down a problem into pieces that can be programmed.
Intro to programming in college _was_ C, so that worked out well for me =) Learned a lot more about pointers - a _lot_ more.
Left college when the money ran out - started dabbling in HTML and Perl. Eventually got myself mixed up in MySQL and PHP - which led to my current job as webmaster for a small but growing and suprisingly stable startup.
Languages I use today (ranked by usage):
Perl
PHP
::grin:: )
No C, other than side-projects of my own. I'm spending a lot of spare time getting up-to-speed on C++ (mainly for the OO stuff), and have considered Java, but haven't gone there yet. I'm pretty sure my next language will be Python.
With a background in C, I picked up PHP and Perl without too much of a problem - I'm sure the same can be said of moving from C++ to Java. I haven't quite figured out where Python fits into all this yet (that's part of what intrigues me about it
Well, that's been the British practice throughout most of Britain's higher education...and it cost them dearly, historically speaking. A brit (Perkin) created (by accident, he was looking for artificial quinine) one of the more important inventions in the modern world (the coloured dye, which eventually led directly to plastics (also a coal-tar derivative)), and the British culture of "higher education isn't something someone does for work" pretty much through that head start right down the drain...the winners in the new chemistry technologies were the Germans, where education WAS considered something for the practical. In particular, color plating and color photography was a German invention that the Brits might have had a lead on otherwise...(Source: James Burke's Connections)
But as I said (and I was talking about American Universities, where the competition to get in can be harder at times, 'cause it isn't practically set-in-stone by some test one takes in the 4th grade...or do the Brits still do that?)-- the Balance is what's important. The theory languages are good for teaching good programming and design and all that, but there's no reason that the practical, business-hyped languages should be ignored -- teach BOTH of them and you've got the prime candidates for a fresh-outta-college job.
--
You know, you gotta get up real early if you want to get outta bed... (Groucho Marx)
"But remember, most lynch mobs aren't this nice." (H.Simpson)
-- Joe
If a BALANCED education, in liberal studies as well as the field of industry one intends to specialize in, wasn't important, then college wouldn't be important and the american tech industry would all be based around people who are "Computer Learning Centers" graduates.
I'm not talking about higher-education being 100% directed to getting the job, but it is almost 100% NECESSARY to get a good job, especially in the IT industry. Just having a head full of theory and languages that one will never use again (and liberal studies along the way) is NOT going to necessarilly be useful in the competition to get a decent job (competition that is increasing in today's .com-deaththrows) -- some experience (classroom is usually enough) in practical languages used in the modern world is also important.
Companies won't take a "generic c.s. grad" without practical experience in a language that company uses -- they'll only take the "exceptional c.s. grad".
It would be nice if we were all exceptional and all could just study the finer theory of things, but its not that way -- schools don't get 100% exceptional students (not even the ivy league), and their curriculum should reflect that and provide means by which their average students are in some ways prepared for getting jobs in a competitive market. Teaching practical programming languages like Java, C++, Python, Perl are means to that. A smalltalk-educated student will have a learning curve to learn Java that a company may decide isn't worth paying for when another candidate already has Java experience. They'll only take the smalltalk one if his overall record is exceptional as well.
--
You know, you gotta get up real early if you want to get outta bed... (Groucho Marx)
"But remember, most lynch mobs aren't this nice." (H.Simpson)
-- Joe
Yes, Java has the ability to "bypass" good OO design (as does C++), but if the teacher makes the programming assignment conditions include not using those proceedural cheats, then the student MUST learn the theory too, and walks away with both theory and practical application.
--
You know, you gotta get up real early if you want to get outta bed... (Groucho Marx)
"But remember, most lynch mobs aren't this nice." (H.Simpson)
-- Joe
Remember I wasn't talking about those who "learned Java", but those who learned Java as part of their university c/s program who will have a slight advantage over those who didn't. Read between the lines, people, I didn't say "java programmer" meaning "one who only knows java" -- i was referring to the c/s grad who knew java as well as all the rest of what normally goes into a c/s degree (as opposed to the one who only had theoretically "correct" languages that aren't used as much in the real world, like smalltalk or eiffel). sheesh.
--
You know, you gotta get up real early if you want to get outta bed... (Groucho Marx)
"But remember, most lynch mobs aren't this nice." (H.Simpson)
-- Joe
Nice sentiment, but regardless of the "ideals" of education, when one gets out of college, one expects (screw that -- NEEDS) to get a job, and given two straight-A students, one with a lot of theoretical-application languages under his belt, and the other with not so many of those, but having known Java since his freshman year, the recruiter will pick the Java programmer, 'cause it means his company can save money having to train the programmer.
And any University with a reputation for letting the education get in the way of future employment for their students is gonna start losing students quickly.
Its nice to "learn", but the truth is that since the 1960s and the G.I. bill, one goes to university because the degree is a requirement for getting a job, not to "learn". And that isn't gonna change anytime in the near future.
The theoretical and the practical-for-today's-world should be considered hand-in-hand. I value the theory I know from my C.S. degree very highly...but I wouldn't have gotten the good job I wanted without having had C++ in college.
--
You know, you gotta get up real early if you want to get outta bed... (Groucho Marx)
"But remember, most lynch mobs aren't this nice." (H.Simpson)
-- Joe
Largely due to a misguided OO-fad pressure, university CS departments forgot their reasons reasons against C in the first year and adopted C++. The argument often went "but it's a relevant language, and industry wants it!" Thus academia, like many companies at the time, made an unprepared mass transition to C++ (in the mid-90's more than 67% of departments used C++ in the first year). Thus the pedagogical issues with C were compounded by the added complexities and pitfalls of C++. Worse, virtually none of the new C++ instructors had any clue about how to leverage the OO paradigm whatsoever. At best, they taught "Modula-C", and at worst you got students in senior level OS classes asking "do I need to write a class for this project?" Finally, the faculty teaching higher level classes in these departments generally didn't retrain either. What many CS students don't realize is that a good four-year program isn't just a disconncted collection of classes. The students should be gradually ramped up in their design and implementation skills throughout their program. But the faculty suddenly had a design (non-OO vs. OO language) and language (via gross misunderstanding of C++'s tools) disconnect with the students. Disaster.
Beyond all that, there are specific reasons to choose Java over C++ as a first year language. First: C++ has no object library, Java does. Yes, now after many years, it sort of has the standard template library, but for anyone with experience with languages like Smalltalk or Java, the STL is too little, too late. If you need further convincing, take a look at Brown University's first-year program, and what the students are able to accomplish both from a pedagogical standpoint and from a look-what-I-made! standpoint. The first year is run by Andy van Dam (yes, of Computer Graphics fame) and is a fantastic model for excellent OO instruction. Also check out University of Virginia's program -- and if you can get the opportunity to hear Jane Prey (on the Board of Directors of the ACM's Computer Science Education SIG) talk about their program, take it!
I taught a variety of CS classes over a period of several years, and was (am) very interested in the best techniques available for teaching our the mathematics and engineering of our discipline. All of this experience suggests that the introduction of C++ to the first year created a *major* problem for Computer Science -- I'm glad to finally see it phased out for a clearly better language.
In scientific computing, speed is paramount. Most people use fortran. Many would like to get away from fortran because it's over thirty years old, and has none of the nice features of newer languages. But for non-CS people, C++ is not something you pick up on a whim. C++ is by far the most complicated language around. The world of scientific computing, I fear, will be stuck with fortran forever because of its lower learning curve, and because of the fact that The bastards have stopped teaching C++ altogether. Java, while nicer in some regards, does not easily lead to picking up C++ (mostly, I think, due to templates and STL). Taking an intro java class and using fortran works though, because the language constructs needed for fortran are few, and certainly contained as a (small) subset of java.
So I think teaching java is a horrible turn of events for we mere mortals. It has too many variants, is not (and will not be) standardized. And most importantly, most places only have one language class. That language should be the one that is most common, and contains enough language elements to allow people to easily transition to most other languages. Going from C++ to java is easy. Going the other way is nearly impossible.
Maybe when more compilers correctly implement the C++ standard the situation will improve. These days it's very hard to compile on different platforms because different vendors implement different subsets of the standard. That, and they have to make STL errors readable. A newbie is not going to sift through a page of horrible looking errors from a single template mistake, just to find that none of the errors tell him what (or where) he did wrong!
--Bob
1^2=1; (-1)^2=1; 1^2=(-1)^2; 1=-1; 1=0.
I have to agree. (Though I'd add Lisp and Forth (or PostScript) to the list just to round out the programming paradigm experience.)
For those of you old enough to remember life before OO, remember how the early OO advocates were fond of smarmily remarking that OO required an entirely different way of thinking, and was therefore a big jump from procedural/imperative code? That runs both ways. Now that the schools are producing people who never wrote a non-trivial program in a non-OO language, I'm increasingly having to work with people who have severe mental limitations when it comes to problem solving. Procedural-only programmers tend to create tight but obscure and hard-to-maintain code. OO-only programmers tend to create overcomplicated, overengineered code. The best programmers I know can handle both design methodologies, and their code tends to be efficient, modular, clear, and easy to maintain.
There is no knowledge that is not power.
--
Proud member of the Weirdo-American community.
Java is a good primary language to teach in MIS, but not as a replacement for C/C++ in CS. Most CS-type work will not be done in Java. Much of the new MIS work, traditionally done in Cobol, will be done in Java if newly implemented.
You can't get more object oriented than Smalltalk. The IDE is what all the CASE and developer tools want to be when they grow up.
The only systemic failing that Smalltalk has is that contained objects only know about their containers if they are explicitely made aware and passed in a reference at instantiation time.
Java is a wanna be. C++ is even worse. The rest of the languages and development environments are left standing on the shore.
Use Smalltalk. You can find a free version at http://www.squeak.org/
Go try it out. But be warned, you'll be utterly spoiled by it.
MSBPodcast.com The opinions expressed here are my own. If you don't like 'em... Think up your own stuff.
First you take intro to Java (if you need it, most don't)
Then you take data structures in Java (which ultimately becomes GUI construction techniques in Java, despite how hard they try.) People who have never programmed fail since they either are A) not fast enought at GUI design or B) cannot comprehend the idea of the linked list.
Then you take functional programming in scheme. People who can't handle recursion and functional thinking fail.
Then you take computer architecture, in which you write MIPS assembly and design a CPU. People who at this point still can't understand what a computer _really_ does, fail.
From thereon you advance through stuff and less people fail out. I think it's probably a decent system since there is a steady drop-out rate, as opposed to people doing computer architecture or scheme first and everyone jumping ship at once. The first two Java classes basically get you warmed up in coding and try to get you thinking about data relationships and stuff.. things which are very important when doing scheme and even when designing a CPU. The data structures class, if taught in C or any other language, would have the same purpose and would not delve into the things Java does automatically like memory management. CS classes are not about learning the language, they're about learning the theory and concepts behind using the language. You eventually do learn the things that are absent in Java like MM, but they are taught in a different context, on the hardware level.
--
So, have they bothered with a 'select'-like statement, or is it still 3000+ threads for a server with 3000 cllients?
IMHO, Java is NOT industrial strength. It is fine for many things, but for what I want to do, C++ is still it. It will never be as fast as C++. All those nice run-time optimizations being applied to Java work for C++ too, if anybody would bother. Of course, since C++ is generally tons faster, nobody has yet.
As for worrying about all that icky memory stuff. I want to worry about it. My programs are faster and better designed for it. I think it would be highly amusing to plop down a Java programmer in an environment where careful memory management was crucial to successful execution. They wouldn't know their heads from their arses.
It's possible to do memory management in Java, despite the garbage collector, but it isn't as easy, and nobody feels they have to with the nice, warm, fuzzy garbage collector wrapping them up.
I think Java is fine for many things. I've watched its development and maturation with interest. I actually made a good stab at porting JVM beta 1 to my platform (UnixWare). It's just not the wonderful be-all and end-all language you make it out to be.
It also makes me extremely nervous that Sun still has such tight control of it.
Need a Python, C++, Unix, Linux develop
Personally, if you want to teach core computer operation then you need to say away from any OO language. There are many many programmers out ther that have no clue how the hardware works. (What registers are you using for that math operation? I know, we don't have to anymore! but that is no excuse) If you look at software in general over the past 12 years we have steadily went from applications that do the job to bloated monsters that do 90 billion things that 90% of the customers don't want. now add to the fact that the code is bloated as hell because we don't have to be careful anymore.. (256Meg is standard on a low end pc now... why should I actually delete that meg of unused code?) and now with processors at insane speeds we dont even have to optomize anything anymore.... A standard bubble sort can be used and noone will be the wiser because that 866mhz computer waits for the Hard drive or ram longer than it takes to sort.
we either need to kick all the CS "professors" out of the colleges or smack them in the heads, because all they are generating is sloppy programmers that write sloppy code and use sloppy techniques. The best example I ever witnessed was a CS professor proclaiming that embedded processors would fade away because they weren't powerful enough to run a program that was compiled from an OO language.
Whatever..... Many of my non-OO, C programs fit in less than 2K... and if I need speed I use assembly, a language you have to learn on your own now.... and was my first introduction to programming in college (assembly,fortran,basic,C/C++ was the progression bac in the olden days)
but then I work with computers that have a maximum of 64meg ram to use as system ram and filesystem, and operate at 66-200mhz sometimes without FPU....
Do not look at laser with remaining good eye.
As someone who uses many languages in the course of the day, Java included, I might be able to offer some information.
This is dead on. I wish that I learned OOP properly in college. Learning C and other procedural languages actually hurts you in the early stages, because you have to unlearn tactics.If I were teaching someone OOP in college, I would start with a "pure OOP" language, such as Python or Java, and a book similar to Design Patterns. I sure wish I learned this way.. Design Patterns came out after I graduated and it pretty much changed the way I thought about OOP overnight.
That's not to say that C++ doesn't have its place. It can be fast, and it can be very flexible. However, in an academic environment other priorities are simply more important. Garbage collection is key. Trust me, you don't want to be up all night tracking down a memory leak when all you need to do is implement a certain algorithm. Also extemely important is a free, cross platform development environment. (No, C++ isn't as strong here as java or python due to library implementation differences). I consider C++ a very dangerous language to start learning with because it's so easy to slide back into C. Until you get to the point where you can understand what the consequences of that are for your project, it's a giant boobytrap waiting to snare the unwary.
This is a very popular but shortsited viewpoint. Java is stronger than it has every been in the past. It's still in heavy growth mode, with more libraries and extensions being developed for it than I can keep pace with these days. It's going to continue to evolve for quite some time. As the JVMs continue to improve in performance, and CPUs continue to double in speed, the performance difference between Java and C++ is going to become less and less. It's already at the point where I run large java applications like Jext (thank you very much Roman Guy!) on my pentium-III 600 without any noticable slowness.Java is a very good investment. It's not the best OOP language in every area but it may be the most well rounded. It's certainly not going away, and you can get a lot of useful work done with it.
Java seems to enjoy better support for the corporate world than from the open source community. This is largely because Java is so useful to corporations and they're ready and willing to develop and pay for enterprise class extensions that most lone hackers would consider boring or overkill. Java isn't a zero sum game, however, and there is plenty of room for free software to thrive. I'm glad the the Apache crew recognize this- their Xerces XML parser and their Servlet engine are excellent, excellent examples of free java software. www.gnu.org also lists a large number of useful java libraries and applications. The time is ripe for someone to bring Kaffe or similar free JVM / library up to speed.
If you do decide to get into Java, I would recommend you learn python as well, and then use the embedded scripting language jython (www.jython.org) from within your java apps. It's a killer combination.
Da. Stimmt. Very true. You are very right that variables, flow control, functions et al. are what are important.
The problem is that most CS departments don't like teaching languages. Therefore they must use a real (read: very powerful/widely used) language (C/C++/Java) for the into courses, so that later on, when students are doing more real-world things, they already have the language skills to do it.
Now, the first programming course I took (in high school) was a semester of C, then a semester of C++. Personally, I think that this is one of the best ways to go. C doesn't have any of the fancy OO stuff. It encourages you to use loops and function calls. It isn't some "pure" language (Smalltalk = pure OO, Lisp = pure functional, etc), and can therefore be used to teach a variety of styles. Porcedural-type programming is the simplest thing for a beginner to understand, but they do need to be introduced to recursion and OO too. C is a fairly solid, usable, simple language and allows such.
OK, now for the disclaimer. I said simple. There are 2 topics in C that are not simple, and I wish that there was a version of C where they were unneeded. Pointers and memory management. A lot of people find learning C difficult for the simple reason that pointers and memory management are confusing complex topics, and very integral to effective use of C.
Disclaimer part 2: I said usable. Another problem with C is that you can't do neat shit with it right away. Beginners want eye candy. They want to do something impresive, without too much difficulty. C is bad at that. No fancy graphics. No easy network code. None of the nifty things that other languages make fairly easy and removed from the hardware. You say that libraries aren't important for the first 3-6 months. I'd revise that to say teaching libraries isn't important for the first 3-6 months. But if you can provide some code that lets your students easily do something cool (they write maze-solving code, you write a graphical frontend for them), then they are more likely to stick with it.
Given that, I think that Java isn't that bad of a choice. Yes, Java is OO, which is a count against it as a teaching language. But it is garbage collected. It also has no pointers. These two things are very very nice for an intro language. I know that when we started pointers/memory management in HS, we lost 1/4 the class (and they had to take a drop). At the semester (where there was no drop penalty) we lost half again. The lack of these difficulties makes Java a very tempting choice. Also, Java has all of the eye candy one could possibly want, and then some. Yes, it isn't good to teach all of those fancy libraries to beginners, but giving them code that lets them use some of the fancy stuff is good encouragement.
Now, Java is OO. Most people teaching it as an intro language introduce the OO features. This is probably not good. But just because it has OO doesn't mean you have to use the OO. So there is some magic "public class fooclass{" stuff around all of your code. And instead of "int main(){" you have "public static int main(String []..." garbage. But you can still pretend that it is functional, or procedural, or whatever. Like C, Java is a hybrid language.
So, you say language features are unimportant. Fancy features are unimportant, but the simple features of
- Garbage collection
- No pointers
- Hybridness
make Java, IMNSHO, a decent choice of an intro language.Oh, and I'm not talking entirely out of my ass. My first CS course in high school was in C, but the intro college course I took was taught in Java. CS 101, while it did focus more on OO than I thought healthy, was a very good intro class nevertheless. The labs had a lot of provided code, and then ask you to fill in simple methods for it to work well. Overall, an excellent course, if a bit slow for someone who already knows how to program.
I guess it sums up that Java isn't a bad language to teach in, but that you need to teach it correctly (no OO, no libraries) for it to be good.
Well, no wonder you don't feel comfortable coding C++ anymore. :)
"Do you expect me to talk?" "No, Mr. Bond. I expect you to die!"
Highschool and/or intro to programming classes should start with the basics of how a computer works, some theory, and into to a couple different languages. I'd suggest short stints in C, PHP/SQL/HTML, and Python to start. Then after the intro classes you can take a more in-depth approach and add things like C++, Java, and Asm.
At what price learning? At what cost wisdom? The price is a man's peace of mind, and the cost is his life.
Programming languages that try to make programming to easy tend to be slow to use and a lot more work in the long run than just learning to program well. Programming in human-language is painful. You'll find the human language very unspecific. You often won't get what you meant. It's at least as bad as using visual programming techniques.
At what price learning? At what cost wisdom? The price is a man's peace of mind, and the cost is his life.
I know it's a heretical stance to take, but I'd say that to teach OOP concepts, a visual language would be best.
It took me a while to get my head round OOP in the first place, but working in windows, when you can instantly show the subclassing of a textbox into a purple textbox (for instance), it's very easy to get the basic concepts across to people in a non-abstract manner. Having got those concepts across, it's then very easy to move onto non-visual languages and apply the concepts you've learnt.
_____
My Journal
Secondly, this is exactly the point of high(er) level languages: To eliminate details that are better solved by the machine, or previously by someone else.
Yes, it is, but I question whether schools should make programming too much like driving. Consider this: drivers who understand the workings of their cars are always better drivers than drivers who understand "wheel turn, gas go." Drivers who understand how the car works understand why you don't accelerate the car by flooring the gas pedal. They know why you change your oil periodically. Their cars last longer and work better.
So it is with programmers. Those who know how the machine works know why memory allocation is slow, and reusing blocks of memory is faster than allocating new ones. Those who understand the preprocessor know why defining a frequenly used value or code block will produce faster code than those who only know object fields and functions. People who understand low level operations recognise good programming practice better than those with experience only in high level language because they've had to. Their code is more reusable, more readable, faster, and less prone to bugs.
Back when I was an undergrad, different sections of Intro Programming were taught in a variety of languages. Different engineering departments allowed their students to take different languages, but the only section that all of the engineers could take was 2/3 Pascal and 1/3 Fortran. It was definitely a weird combination, but I thinked it worked out pretty well. Learning 2 languages right away makes it easier to pick up other languages on your own later. Plus, Fortran was still (and probably is still though C/C++ are making some headway) the dominant language for engineering/hard sciences.
So anyway, Java might work OK, in some of the situations above, but I'm not sure that having a particular language that is the dominant one taught in introductory classes is the best option
--
Preventive War is like committing suicide for fear of death. - Otto Von Bismarck
As far what is better Java, C or C++, it really depends on your application. I would not right an OS in Java, but C or C++ would be better as both could give you far greater speed improvements. JSP is a good way to go for writing web applications, and if it ever gets standardized (hint hint sun Microsystems) then it could be even better. Certain applications Java is not well suited for, but others it is great. Anywhere where speed is a real issue, C is better.
I don't want a lot, I just want it all!
Flame away, I have a hose!
Only 'flamers' flame!
What does widely used have to do with good teaching :-)
C++ is probably the most widely used OO language, but it sucks as a teaching language.
C is the worst teaching language one could think of and not even appropriate in the context of OO programming.
VB is extremely well used but it's debatable if it is an OO language (or even a programming language
Smalltalk enforces the parts of OO that it supports so it is an OK teaching language.
Eiffel supports and enforces all parts of the OO paradigm and is an excellent teaching language despite the fact that it is not videly used.
The University of Illinois at Urbana/Champaign has been using Java in the introductory CS class since the spring term of '98 (when I first took it... before that they had been using scheme). The first portion of the class (at least back then) dealt with basic programming syntax and how to do loops, etc. Then it moved on to the OOP philosophy and started dealing with classes.
The course homepage for CS125 is: http://www-courses.cs.uiuc.edu/~cs125/
The next class required of CS majors is CS225, which is a data structures class taught in C++. The first couple of days of the class are spent going over the difference between C++ and Java (most especially stuff on pointers), and then later they move in to data structures and algorithms.
The course homepage for CS225 is:
http://www-courses.cs.uiuc.edu/~cs225/
He said, "You'll be able to tell your grandchildren that you helped assemble the first NT supercomputer," and I cringed.
The very things that make Java so useful for getting work done, are the things that make it a bad choice for learning fundamentals. Use a lower-level language that has pointers, doesn't have garbage collection, etc. C, Pascal, or even assembly would be good.
---
As copyright owner of this comment, I authorize everyone to defeat any technological measure which limits access to it.
I started out with C and then moved to C++. I never was able to master C++ to an elite level. I was always blown off by its complexity.
I was just about ready to give up until I came accross perl. Perl was simple and easy to learn. I quickly got good at it and started going into more advanced OO perl programming. Now, I have a great perl job.
I believe I do better starting out with a simpler language and with limited tools than with a more complex language like C++.
But this is just me and I know I'm not the only one out there. It's not that were too stupid to learn it's the way we are being taught is wrong.
I know Perl is slow like Java so I focus on my algorithms to improve speed and I make it modular to work with others and to reuse code.
I'm a better programmer because the language is simpler for me to learn and grasp.
So I'm sorry for the C++ guys here but I agree with the Java crowd here. It's better to start with a simpler language than with a complex one.
"If a show of teeth is not enough, bite
Some people will only take one or two programming courses in their college careers. These people need a course which teaching them what programming is about. Java has some very nice features which can give people an introduction to programming.
CS majors will take other programming classes. C and C++ are appropriate for more advanced work. Introductory students shouldn't need to know about pointers in order to write programs. There is plently of opportunity to learn about the internals of computers in more advanced CS classes for those with the inclination.
Many of the points raised in the other posts just don't matter in an introductory class: inefficient, know more about the hardware, used more often. Jave lets people write basic programs that tell people how to make a computer (in fact many different kinds of computer) do something -- anything -- in a language that has some real world applications and is not just a theoretical exercise. That's all that counts. And Java fits that bill.
I have discovered a truly marvelous sig, unfortunately the sig limit is too small to contain i
Doug Lea (well known C++ programmer and writer; teaches at SUNY/Oswego)
Kevin Sullivan (U. of Virginia)
A couple of less positive articles from Australia.
An article at O'Reilly.
Stupid job ads, weird spam, occasional insight at
Part of the problem with C++ is that you can cheat. What I mean, is that you have already done C then you can program in C++ without really taking advantage of any other object orientated programming techniques. Java on the other hand is a much more orientated language and since it is portable you avoid platform specific issues. Java also provides a rich API for doing many different tasks, so this not only helps in learning to program but also in accessing different open APIs.
Smalltalk is the real object-orientated language and the reference to them all. The only problem with Smalltalk is that it is percieved to be a dead language, though this in academic environment is not always a bad thing.
When I was at uni I was taught prodcural, functional, object-based and object-orientated programming. One thing that I got out of that is that there is no such thing as an ideal language. You have to look at the task at hand and decided which approach works best.
At the end of the day the best language for the job depends on what your target is.
Jumpstart the tartan drive.
What language is used matters very little. In school you're learning fundimentals. Good programming practices. These should be transferable to any modern language. The purpose of a good CS program is not to teach you a language that will help you find a job, but to teach teach you to apply the good programming practices that you've learned to different languages.
That said, Java is a fine language to learn in. Simply because java is not as widespread as say C++, does not mean it's not a good teaching language. IMHO, the ideal teaching language would never be used in the real world, to encourage students not to have a crutch language.
While I think Chris DiBona makes some very valid points, but, I do think teaching C as a introductory class lends the student to adopting it as a crutch.
Great programmers can quickly pick up other languages and apply the techniques they've learned to those different languages.
First it was Pascal, then all the Unis switched to C, then to C++, now to Java. One cycle is hardly complete before the next one starts; those eager freshpeople getting Java now will discover that it's old hat by the time they graduate, and the wheel will start another turn.
For my money, use something simple like Pascal or C to introduce the basics, and then introduce OOP after a good semester of abstract data types.
Alternatively, do like a lot of schools and use Scheme, so you can teach beginners to 'think' rather than to 'program'.
--
Sheesh, evil *and* a jerk. -- Jade
Is that, in order to learn CS, you should learn
a) Modula-2
c) Smalltalk
d) Scheme (or lisp)
Then graduate to applied languages.
C, C++, Java, etc...
QUOTATION DIVISION.
Teach them COBOL first. Then threaten them with a lifetime of doing that, if they don't learn Java/C++ well enough.
MESSAGE BODY DIVISION.
The only problem with that is that I don't think you can really appreciate the clunkiness of COBOL unless you've already got some experience in a good language. Someone who has zero programming experience just might not have the gut-level aversion to COBOL that comes with time and experience.
Personally, I'm glad that I spent that semester studying COBOL. It's pretty interesting as a historical relic, it let me learn a lot about punch cards, and it taught me to steer clear of the stuff in the real world.
SIGNATURE DIVISION.
NAVIGATE WEB BROWSER TO http://ishmail.prmsystems.com/hh.html .
I have had several students here who started to experiment with all sorts of arcane features like inner classes and operator overloading without learning how to write good programs first.
Funny...Java doesn't have operator overloading (just method overloading and overriding). If your students are doing that, then they are skilled indeed (as they have probably modified the compiler to do what they want)A lot of comments so far have focused on whether it's good to teach people something high-level as their introduction to CS.
... I mean, why not show them "look, you hit the gas, it goes faster" and find out if they're at all interested in why, first.
I think it's necessary in some ways. The sort of thinking which is required to succeed as a software developer starts with being able to look at a problem and break it down into loops, conditionals, etc. You need to introduce people into this way of thinking pretty early on.
I can't imagine my first exposure to the logic of computers being C (mine was Apple 2E basic). It's just too hairy, too full of ways to shoot yourself in the foot. Do you need to know that you can shoot yourself easily? Yes. Do you need to know about pointers, about memory allocation, etc? Sure. Which is why, after you understand how to think "like a computer" in some ways, you learn about what's under the hood.
I mean, imagine never even having been in a car and having someone explain driving to you by ripping an engine apart. Whoa, there
Anyway. Java isn't a toy language, and if it's a fad, so is OO programming itself. Java is a powerful language, being used in some of the biggest software projects out there right now, by some of the biggest software development houses out there. I know because I work at one, and I do Java development.
If you're going to discount Java as an introductory language, do so because it introduces (rather well, actually) the concept of OO on people who are still learning what "if" means, not because it is too simple. If C++ is okay for an introductory language, then Java is strictly better in my opinion. I would probably teach C to today's students the way I was taught assembly language. "You need to know this, it will make you a much better developer, but if you get stuck in a job using it, it's a bad sign."
Not representing or approved by my company or anybody else.
"Your fresman year should be devoted to assembly language, basic data structures and low level hardware concepts."
You're going to scare away the next generation of developers doing this, IMO. I would never have gone into computers if I couldn't write "hello world" with something as simple as "Print 'hello world'".
Everything else you say is dead on -- a real CS education should teach you about many different types of programming languages. You should feel comfortable talking about declarative, functional, procedural, and object-oriented languages. My favorite CS undergrad class dabbled in C++, Scheme, and Prolog. For our final project, we had to solve the same problem in all three languages. Though we all knew we'd never see Scheme or Prolog once we entered the workforce, it was amazing to see that the chosen problem was an order of magnitude easier to write (and faster to execute) in Prolog than C++.
But, to introduce people to computers, for their very first class where they have to type something in and see a response, do you really think we're going to fill our ranks by making them learn "MOV AX,BX" or letting them learn "A = A + 1"?
That's like saying you can't learn to cook without taking Chemistry first. Sure, if you know chemistry, you'll be a better cook. But to tell someone who thinks they want to cook, "Take chemistry first, then you can learn to sautee vegetables," seems a bit extremee to me.
Not representing or approved by my company or anybody else.
Sorry, but that's just plain untrue. IBM provide compilers and JVMs that are every bit as good as Sun's and in many cases better (check out pretty much any performance comparison for 1.1.x JVMs, for example...)
++ Say to Elrond "Hello.".
Elrond says "No.". Elrond gives you some lunch.
Regardless of whether that's the case (it isn't, IME) that's not what was being said in the first place, I believe. The claim here, AFAICT, is that Java is a cleaner, better designed OO language than C++. And I certainly wouldn't argue with that.
Most people are never going to write device drivers at all. Why is this relevant?
And frequently do, with the result that they write truly hideous Java code. I've seen the result of people taking this attitude, and it's not pretty. It's frequently possible to tell that people were C++ coders before becoming Java coders from the quality and style of their code.
If that's what people are being taught, then it's the quality of the teaching that is to blame, not the quality of the language. No Java coder worth their salt would write like that. Sounds more like the sort of thing I've seen from bad C++ coders, in fact. :^P
++ Say to Elrond "Hello.".
Elrond says "No.". Elrond gives you some lunch.
You mean it takes about five years for Sun to fix a bug once it's well-known and they've been provided with a working fix? :^P (Witness the bug preventing any program which calls getDefaultToolkit() from terminating, which has led to years of truly horrific user interface application design, and has finally been fixed in 1.4)
++ Say to Elrond "Hello.".
Elrond says "No.". Elrond gives you some lunch.
I sincerely hope that's sarcasm. The idea that you have to be able to write something in order to use it is so fundamentally wrong it makes me shudder. Incidentally, I hope you can write web browsers and operating systems. Otherwise you've got no right posting to Slashdot.
++ Say to Elrond "Hello.".
Elrond says "No.". Elrond gives you some lunch.
Again, you're trying to blame the language for bad teaching approaches. I've seen courses taught with buggy C compilers. Does that make C an inherently bad language? Of course not.
There is no requirement to teach applets as part of a programming course that incorporates Java, and IME courses which do concentrate on applets are normally outdated: applets don't play as large a role in Java today as they did back in the days of 1.0.x - most of the roles Java was expected to fulfil through applets are now using other technologies, from simple animated GIFs to Shockwave applications.
The last good Java course I saw didn't cover applets at all, except in passing. It did, however, cover enough to make it possible for students to learn how to write applets if they needed to.
Fair enough. Quibble over granularity rather than answering that issue. The overall question is whether Java is a better language to teach beginner programmers (or more accurately whether it's a good language to teach them) - the issue that you misunderstood was the question of whether Java is 'cleaner' than C++. This has nothing to do with buggy VMs, and everything to do with a clean and simple object model.
public class Globals {public static int GLOBAL_INT;
public static String GLOBAL_STRING;
}
Ugly, yes, but I believe you'll find it does the trick. It's actually one of those recurring features you see in bad Java code where people are trying to write C++ in Java.
And if we step back a little from your argument, what you're actually saying is that it's easier to learn to code in Java than it is to code in C++ (something that I'd personally agree with). And that's a good argument for using Java over C++ in my book: there's much less time getting to grips with (and struggling with) the language, with the result that more time can be dedicated to learning what you can actually do with it. Which is presumably what people are there to learn anyway.
++ Say to Elrond "Hello.".
Elrond says "No.". Elrond gives you some lunch.
HERE HERE! My sister took her first programming course last semseter. Java. I spent one evening with her going over the basics of OO programming so that she could finish her projects. It took her a while because the prof had been trying to teach Java as a procedural language. Stupid. Learn C first (not C++!) or Pascal or ADA. OO is VERY COMPLEX and should be taught later, IMNSHO.
-- IANAEG - I am not an elder god.
You can't. You have to pass an Integer, instead - or use a Class, such as Vector.
Passing an Integer won't work, Integer is immutable.
You're talking about imperative languages. Declarative languages also exist where you don't tell the computer how to do something (ie. the algorithm), but what you want it to do and then it automatically figures out what algorithms to use. (Think SQL, or Perl's regular expressions, or esr's CML2, or XSLT, or a whole bunch of other things). These languages are often domain-specific languages in practice, but it's hard to argue that they don't produce code that's quite free of errors.
I predict that in the future developers (and possibly power users) will use many special purpose declarative languages instead of one general purpose imperative language.
My company has had some experience with the C++/Java debate. Its sole business is providing materials for CS instruction in high schools and universities.
For the vast majority of high schools, the AP determines the sole language of instruction.
For the vast majority of colleges and universities, the perception of industrial relevance by the students and non-CS administration mandates what language will be used, regardless of the suitability for pedagogical purposes. Otherwise they might be using Pascal, Python or Turing.
What this means is that most faculties can only realistically teach either C++ or, now, Java. C++ was not well liked for a huge variety of documented reasons. We were able to give out 600+ "C++ Sucks!" buttons to attendees at the SIG-CSE (Computer Science Education conference) mostly on the strength of educators being forced to use a language that they considered unsuitable for use as a first language. Or as one educator put it:
If we don't teach C++, nobody takes the course. If we do teach C++, nobody passes the course.
Sun's marketing of Java has allowed it to be perceived as industrially relevant by the student body, who generally get their information from newspapers, magazines and want-ads. This means that Java has become an acceptable choice for teaching first year computer science.
(Generally, AP follows the general trend of CS1 a few years later. The quick switch from C++ to Java indicates, in my mind, a lot of unhappiness of high school teachers teaching C++.)
When weighing Java vs C++, it's not too suprising the Java comes out ahead in the minds of most CS educators.
Remember that, in general, the only real goal is the efficacy of the language in teaching the concepts covered in CS1. Things like actual efficiency (as opposed to the order of algorithms) is not really a concern of CS1. Things like garbage collection vs explicit freeing are also beyond CS1's purview.
Hence they look at syntax issues, ease of expression of algorithms, etc.
All opinions are mine, not my company's.
While Java is usually considered more suitable than C++ for CS1, Java has a number of deficiencies from an educational perspective.
:-)).
Remember that in general, the only issues that matter are those that make it harder to teach the general CS1 concepts. Speed of Java execution is *not* an issue for most. (By the way, please note the word "in general" and "most". There are counter-examples, but one generalizations about the teaching of CS1 are, in my experience, fairly accurate.) For what its worth, my experience is 14 years of producing/selling resources for teaching computer science in universities/high schools.
(1) No simple I/O package. To read an integer from the keyboard takes multiple lines of code. Most programs are not pedagogically improved by adding mandatory error trapping. The solution, of course, is helper classes. My company produces its own, but many are available free over the net. Interestingly enough, while 2 years ago, most university teachers were not interested in helper classes, or in books using them ("I teach pure Java"), there has been a fundamental shift towards the use of them over the last year. The other alternatives are a lot of handwaving ("use this block of code, don't ask why") or using applets only or have all your examples carefully not every need integer input from the keyboard. Each of these techniques are used in different books.
(2) References are Hidden. The fact that many variables are references and can't be treated the same way as primitive data types. This is a personal gripe of mine. I'd say that about 50+% of students who've completed CS1 can't give a clear answer as to what happens when you say "a=b" when both are references. Java doesn't help the situation with the class that most students first encounter - String. Because String is immutable, you can say "a=b" and it works. Even worse, most of the time you can get away with "a==b" for a comparison (because Java efficiently caches identical strings). I spend an inordinate amount of the Java courses I teach (to teachers, mostly) on this problem.
(3) C++ Syntax. In other words, a misplaced semicolon can still waste many hours of student's time for little pedagogical gain. Of course, this was simply a marketing trade off in the creation of Java.
(4) Overly complex environments. Of course, development is focused where there's money, which means education gets (for very little money, mind), what's developed for business. For educators, you generally want an environment that has the basic features but can get students writing programs within about 15 minutes. There are a few educationally focused Java IDEs out there. We have our own (Ready to Program), but there a number of others suitable IDE's out there such as BlueJ.
(5) The Java class libraries. This is both a good and a bad thing. With C++ there was never any question about teaching the Windows API. It just wasn't done. But with Java, you *have* to use part of the class libraries, and from there, it's a slipperly slope to (HORROR!) graphics, applets and GUIs. These can add a lot to a course, however, what concepts get eliminated so that you the fun stuff?
Aside: I've noticed a distinct reluctance when people suggest what should be added to CS1 to also suggest what should be removed so that it can fit. You only have so much time.
Anyway, that's a mini-capsule of what we've found. I could go on for hours (and do, as a few people at NECC will find out
Another Aside: Does anyone know any web sites that cover this topic in depth? I've been amazed at the paucity of web sites about high school/university CS instruction in general (lots of good individuals posting content, but few general resource gathering sites).
There's a difference between learning the stuff in your spare time and needing to have 1 or 2 years experience in a real job to answer most of the classified ads on the market. I never wanted to learn any languages just for the hell of it, but even if I did, I would have had to do something serious with that knowledge to reap the benefit of having spent ANY time with it. Even my college experience in the stuff I learned is not good enough for most of these HR-dept. placed job listings.
I was happy enough in college doing school, working a part time job, and reading Slashdot to keep familiar with things. Perhaps I would have served my own knowledge well by doing some more independent study with programming topics, but the only thing that would have helped me get a job would have been to work at a local corporation for one or two years while in school doing that stuff. Otherwise... hey, I've got all the free time in the world right now, and my roommate is taking a Java class and he's got a book on it, so I could learn from him. But that doesn't meet the lofty expectations employers have for entry-level candidates right now...
This is a great idea, and it's exactly what my CS program did in college. We learned C, C++, Lisp, SPARC Assembly, and Prolog at least in the core cirriculum. Java, SQL, several flavors of Lisp, and perhaps some other programming-type languages were taught in elective courses. VB was available in the business department.
The major problem is that after all this time spent on DIFFERENT languages, I'm a jack of all trades and a master of none... I don't even feel comfortable coding C++ anymore just because I haven't done it for at least 2 1/2 years: it wasn't asked of me toward the end of my program. The only above language that I did NOT get to take is Java, because of scheduling difficulties, and now I sorely regret that... because now I'm looking for a part time job to make ends meet as a recent BS-CS grad with an MIS minor and two completed internships. Yea, life sucks sometimes, but whatever.
Point is, I may have a diverse background in languages, but that doesn't help me professionally. I still wonder why I spent all that time learning all those languages and no one made sure that I would be able to apply my skills in the real world.
I mean, if you're gonna teach a course on a subject, maybe you shouldn't design it around trying to make money off the concept. But if you're going to assemble a department and an educational program that people will be paying in excess of $20,000 a year to enroll in, then perhaps more than FOR loops and system calls should be included in the bunch.
This is the problem with Java though. Teaching Java instead of C++ is a cheap way out... it's not supplementing a good program with job skills, it's replacing a good program with the language of the year. It's the dumb way of answering the question of "How are we ever going to use this stuff?" Instead of teaching them what they should know, they'll teach them what they want to know. That's not always good. In this case, it's flat out horrible. But I suppose it'll make many people happy as long as no one figures out that a Java-based CS program is perhaps as bad as all the Visual Basic courses they teach over in the business school...
I will probably be modded down heavily for saying this...
There is a reason why BASIC is called BASIC - it stands for Beginner's All-purpose Symbolic Instruction Code.
Originally designed at Dartmouth College as a teaching language in the 1960's, it is still a language that can truely teach the fundamentals of coding.
I am not talking about QBasic, or QuickBasic, or even VB - but standard ANSI Basic. For a course, I would recommend using Bywater BASIC.
Don't teach line numbers, or GOTO, but do teach how to handle possible errors, and good code formating, as well as proper commenting and code documentation. Most programming concepts can be taught using such a BASIC implementation.
Later, after students have caught on, you can go back a little and tell them about GOTO, and why it is bad - as well as why it can be good (very few people know examples of good uses of GOTO - I have seen only a few myself - but yeah, I know it is possible to write code without ever using a GOTO).
After that, teach a more structured language - Pascal comes to mind. Then move to C, then C++, then Java...
Worldcom - Generation Duh!
Reason is the Path to God - Anon
For an introduction to programming course, Java may not be all that bad a language. Java hides a number of implementation details (such as memory management) which, while extremely important for a well-rounded programmer to learn, just gets in the way of a beginning programmer who is learning about loops and method invocation. And, at least at the level of writing expressions and loops, it's similarity to C should help people make the transition later to C/C++.
Of course I wouldn't use Java for embedded software development, nor would I personally want to use Java for anything that is compute intensive. But by hiding a number of details, IMHO it's not a bad language for beginners.
All those nice run-time optimizations being applied to Java work for C++ too, if anybody would bother.
You apparently don't understand what I mean, because those optimizations are impossible for any staticly-compiled language. The HotSpot compiler can see the entire inheritance structure that is in place for that runtime session, and finalize those methods that will not be overridden. Better yet, if it finds out later that it was wrong, it can dynamically replace the finalizd method with a non-finalized version.
Of course, since C++ is generally tons faster, nobody has yet.
C++ is not that much faster in situations where operation is computation bound, rather than I/O or graphics hardware bound.
So, have they bothered with a 'select'-like statement, or is it still 3000+ threads for a server with 3000 cllients [sic]?
3000 threads is only the case on systems like Linux where the thread model is one-to-one. Solaris, for example, has a many-to-many thread model that allows for very nice threaded operation. When you get right down to it, Linux isn't really set up for good lightweight threaded execution. The 1.4 revision of the JRE for Linux starts to address those problems, as do the new I/O libraries and some of SGI's work on KIO.
As for worrying about all that icky memory stuff. I want to worry about it. My programs are faster and better designed for it.
I personally have my doubts that you of all programmers on the planet has memory management down to an art. Nonetheless, I think the great number of memory-leaking C++ programs and libraries out there testify that you are rare if having to worry about memory management makes your programs better. The garbage collector in Java is admittedly the weakest part of the platform still, but it's a tricky problem, and it is being tackled steadily. The gc in J2SE 1.4 is reportedly much more efficient than its predecessors.
It also makes me extremely nervous that Sun still has such tight control of it.
Sun can't make a single change to the language or API specs outside of the Java Community Process these days. They are responsible for the official implentations of the J2SE on Windows, Linux/x86, and Solaris. They are the administrators of compatibility testing, and they own the trademark. So basically, the only difference between them and Linus Torvalds is that they require passing a compatibility suite before you can use their trademark. That and they can't change anything without community input. Gosh, that's tight-fisted control!
Right...
Not to be nitpicky, but you mention providing marketable skills & performance isn't the issue. If Java is a slow performer, wouldn't it tend to hurt students more learning a language that is slow, and klunky? Last I checked, there were plenty of jobs available for C & C++ programmers. I have a feeling that Java may be a fad, and C/C++ will be around and fall back in favor unless Java really takes off.
Java lets you do some cool stuff, and it lets you do some really klunky stuff, but it isn't designed for performance. Any industry that is CPU bound (Simulation, number crunching, gaming, local applications, etc.) needs to be coded to run fast. Industries that are network bound (ISP's, ASP's, Portals, etc.) don't really care about how much the CPU is choking because the network is the bottleneck. I have a feeling, once the network is no longer the bottleneck, Java either better get fast quick, or it's going to be going back to C/C++ for speed.
Obligatory flamebait disclaimer: I don't think C and C++ are going away, or that Java is the One True Language. However, it is ridiculous to assert that Java is slow, poorly adopted, or unsuited to real-world applications in the face of overwhelming evidence to the contrary. Very serious companies like Oracle, Sybase, IBM, Macromedia/Allaire, Borland and of course Sun, are banking lots of money on Java's success, recognizing that it's a mature, robust, stable, fast language for very serious development.
Right...
Every time there is a discussion on Java, the same complaints come up:
Guess what, folks - most of that hasn't been true for the past couple of years, and it's getting better all the time. The stuff that you're not and won't be allowed to do is prohibited for the most part because it's dangerous and counter-productive. Java, like any widely-adopted language, does not simply cater to the 31337 hax0r.
I've helped teach a class for the AP and IB CS exams, and I'll tell you what they're about more than anything else - algorithms. That certainly doesn't benefit more from C/C++ than it does from Java. Hell, if that were the concern, we'd use Haskell! The point is, the class's focus isn't on pointer arithmetic, code optimization, or any other topic that makes C++ a more natural choice than Java. As a matter of fact, having to consider those things make C++ an obstacle to understanding, rather than an aid. I'm glad the College Board is changing the language to Java - it's the right thing to do for the level of understanding they're trying to teach.
Right...
All these CS graduates with no idea about machine internals are inflating my EE salary! More java! Yeah! VB too!
Embedded programmers rule :).
..don't panic
Let's face it, most tutorial languages are picked for being high level, and having a fairly shallow learning curve. When I started learning programming, Pascal was used, which was fine in the days of purely procedural programming. Now that OO is more or less the defacto way of thinking about things (NOT to say that we should only be programming in OO languages), it makes sense to go with Java. Java was designed from the very very beginning with the explicit goal of making it harder to make mistakes - errors are caught up-front as much as possible.
Java has:
1) strict typing
2) dynamic linking
3) built-in memory management
4) a consistent implementation and rich libraries from a single vendor (for better or for worse)
5) works *identically* on many platforms ("identically" is the key here...we don't need to be spending half our time teaching build environments for various systems)
For all these reasons, it makes sense to use Java as a beginning language. The basic programming concepts are all there (yes, even resource management). The problem with C and C++ is that it is very easy to obscure larger concepts with intimate technical details, the learning curve is steep. I remember when I was learning Pascal, it was as if the class hit a brick wall when pointers were introduced. Imagine if learning pointers and intimate machine-dependent ("words"??) memory management was the prerequisite to larger programming concepts such as conditional statements, iteration, recursion, etc. The whole learning process would be stymied.
And I used to be one of the oh-so-cool C++ programmers who thought that Java was just a kindergarten-level "fad", and scoffed at it when it was used to teach programming in CS courses. Now enterprise Java programming is my day job, and I can attest to the fact that it is NOT a fad, is very powerful, and is used to do some really serious, and really cool stuff. I'm sure assembly programmers said "C?? You don't even need to know what REGISTERS are to use that!!".
It's 10 PM. Do you know if you're un-American?
All true, but the numbers are 80-20. It's not a fuzzy sum ("x" and "100-x"), because it isn't a sum in the first place. It's a ratio; 80% of the time is spent in 20% of the code. Two different nouns; you can't borrow from one and give to the other. The fact that they add to 100 is coincidence.You make a very good point in that MIX/MIXAL was never advocated as a first programming language. I just wanted to note...
What's more, it's a recursive ratio. 64% of the time is spent in 4% of the code.
Proof? Examples? How the ratio was calculated in the first place? See either volume I or III of -- what else -- Knuth. :-)
You cannot apply a technological solution to a sociological problem. (Edwards' Law)
Hear, hear. I'm sick of seeing freshly-minted Java programmers grunt out mounds of steaming O(n!) code, believing that "this is good cuz it's Java."
Knuth continues to use MIX (and the new MMIX) and MIXAL in TAOCP for this reason; once you know how the computer works, and which algorithms are the proper ones to use, your choice of high-level language often becomes irrelevent. Just a choice of style.
Wake up, people: you can write FORTRAN in any language.
You cannot apply a technological solution to a sociological problem. (Edwards' Law)
There's a really great book out called _Accelerated C++_, by Koenig and Moo. (Yes folks, that Koenig and that Moo, the C++ gods.) It's a very new approach to teaching C++ as a first language, and everybody who's used it or even just reviewed it has loved it.
It doesn't even introduce pointers for several chapters. Students learn how to write simple loops, manage collections of things using std::vector, do the common 90% of string-related tasks using std::string, write some useful and practical programs, all before ever seeing a pointer.
Side note: the book is part of the C++ In-Depth series, being edited by Stroustrup. One of the rules for the series is that the main body text of the book must be no more than 300 pages. No filler crap, no 1500-page tomes to raise revenue; make your point simple and clear and then shut up.
You cannot apply a technological solution to a sociological problem. (Edwards' Law)
I think that the best way to get people started on programming is by introducing concepts such as variables, data types, flow of control, functions and references. This is why I think C is what should be taught in the (High School) class room. Having come from a Pascal background I have really benefitted from being taught procedural programming before moving on to C++/Java's OOP models.
Teaching people assembler you are forcing them into the deep end of the Marianas trench right away. What's the point of explaining memory segments and offsets to someone who doesn't know such basic concepts as variables and functions? Why should I concern myself with the difference between near and far jumps before knowing the standard loop constructs that such jumps can be used for?
Ñ'
As far as for a CS course, it depends on what that course is trying to teach. In my university courses, we are never taught a language, we have to pick that up ourselves, the language is used as a tool to express CS ideas. In this way, a language which has many drawbacks overall may still be a useful tool.
For an introduction to OO ideas, Java may be very useful because students don't have to deal with explicit pointers/references or garbage collection, they can focus more on the ideas of OO.
Something like Pascal is often considered outdated today, but I found that it was a good language to use for learning about procedural programming and CS fundamentals in a 1st year course.
Overall, my point is that every language that could be used has faults, but if it assists students in learning about the ideas of the course, then it is useful. IMO, courses that only teach languages are a waste of time. Languages in use will change, the ideas behind them and that for which we use them is what we need to learn.
---
I hope you're not pretending to be evil while secretly being good. That would be dishonest.
First, I find it difficult to believe that there aren't a sufficient number of Java development jobs. Second, the point of a CS education should not be to learn the most popular language, but to learn the concepts of programming so that you can easily pick up new languages as required. I find Java much better suited to that task than C++ with its mountains of complex features and wacky syntax.
if you're looking for a high-performance language you can't rely on a system with garbage collection and run-time linking.
This is not necessarily the case; recent Hotspot JVMs have been producing impressive results. Yes, you'll probably always be able to beat it with optimized C, like you'll always be able to beat C with optimized assembly, but for the vast majority of tasks it is more than fast enough.
Not to mention that truly understanding what's going on with memory and pointers, while posing a steeper learning curve, really helps you understand how the machine deals with your programs.
Here I agree. Nobody should be able to get a CS degree without knowing C and being able to do pointer tricks. But for introductory classes, which probably have lots of non-CS students, that's going to be overkill.
How to solve most of our problems: 1.Lots of nuclear plants. 2.Cure aging.
Yes, there are. You're absolutely right that applets and client-side Java in general have failed, but it's very heavily used in enterprise and back-end products that you don't see on the shelves at CompUSA.
Passing by reference. In order to pass values by reference in Java, you have to make another class to do it?
Why are you passing values by reference? Very often there's a cleaner way to do it. Personally, I like that in Java and C when I write "foo(a,b)" I can be sure that a and b will be the same afterwards, as compared to C++ where they might be passed by reference and I have to look at the declaration of foo to tell.
Garbage Collection is a clever trick, but if you get used to that net being under you, and you've never used another language, programming in C will be a rude shock.
Professional developers should understand memory management and be familiar with C. But an introductory class would be much better served by discussing loops, methods, and basic algorithms rather than the details of malloc/free/new/delete.
My point is that it takes more effort to go from Java to C++, than it takes to go from C++ to Java.
Of course it does, because C++ is much more complex and difficult. I'm experienced in both, and have found Java to almost always be a better choice.
(Try wrighting an applet that actually does anything useful, and then try to run it under Netscape on a Macintosh.
Again, that's client side. Sun completely screwed up by putting the burden of supporting Java applets on browser developers, thereby insuring spectacular incompatibilities. These issues go away on the server side. Our complex web applications run equally well on Solaris, NT, and Mac OS X, with 0 lines of code changed.
Java is nowhere near as bad as you think it is. I understand where you're coming from most of your exposure to it has been buggy applets, but it is a real language capable of doing real work, in many cases much more quickly and reliably than would be possible in C++.
How to solve most of our problems: 1.Lots of nuclear plants. 2.Cure aging.
As for performance, it is slower than some languages closer to the heart of a computer, but speed is not the point of an educational language, constructs and methodology are.
Not to be nitpicky, but you mention providing marketable skills & performance isn't the issue. If Java is a slow performer, wouldn't it tend to hurt students more learning a language that is slow, and klunky? Last I checked, there were plenty of jobs available for C & C++ programmers. I have a feeling that Java may be a fad, and C/C++ will be around and fall back in favor unless Java really takes off.
Java lets you do some cool stuff, and it lets you do some really klunky stuff, but it isn't designed for performance. Any industry that is CPU bound (Simulation, number crunching, gaming, local applications, etc.) needs to be coded to run fast. Industries that are network bound (ISP's, ASP's, Portals, etc.) don't really care about how much the CPU is choking because the network is the bottleneck. I have a feeling, once the network is no longer the bottleneck, Java either better get fast quick, or it's going to be going back to C/C++ for speed.
The fundamental question is: should these kids be learning fundamental CS--algorithms and data structures--or should they be learning something practical, with which they can also learn fundamental CS (albeit applied)?
If the former, then go the way of MIT and teach Scheme (a clean, older dialect of Common LISP). See *The Structure and Interpretation of Computer Programs* (or, colloquially, SICP) for more info.
My guess is that many of these kids will go on to other disciplines. Some will just want to be hackers. Do we really want to unleash bright, potentially excellent Open Source hackers on the world with a working knowledge of Scheme only?! What might they do? Could they tweak the Linux kernel's scheduling algorithm? Hmmm.
I think the best way to teach how computers work is to use a language that talks directly to them: C. People who propose ASM have their hearts in the right place, but ASMs come in as many flavors as ice cream (and from a productivity POV, they're about as nutritious).
A course should start with 2-4 months of C. Students can learn, for example, how the instruction pointer works, how arguments are passed on the stack, and how registers are used to do various things on whatever platform they're coding to. All of this is learned as a natural result of debugging simple problems.
Having learned the basics, the course can then shift gears and talk about OOP and how C++ implements its special variety. At this point they can learn, for example, about the extern "C" linkage specification and name mangling. These things are actually very easy to understand if you've used C--and are if the utmost practical importance; many libraries are still only available in C.
Algorithms and data stuctures can act as the landscape that these kids paint with their new knowledge and tools. Learning a language like C++, that is close to the hardware, they will be able to pick up any language with much greater ease.
WRT the Java vs. C++ issue, the answer should be clear. C has been around for 30 years, C++ almost 20. There have been hundreds of compilers written. Java? Not even a standard. Oh, and let's not forget that it was patterned after C++, along with several other languages (though to a lesser degree) like Perl and <ahem> UnrealScript.
If the rationale for using Java is that they want a simpler, cleaner, don't-show-me-the-hardware-messiness language, then why choose a C++ spin-off (that retains much of the syntactical messiness)? Use an elegant, open, intuitive language. The only one out there that I know of is Python. For a good description from Eric Raymond see Why Python?
You say that as if it's a good thing, but it isn't. At least not necessarily. Turn the point around: which curriculum would lead to the highest attrition rate [in a college setting, not high school necessarily]: a commercially viable language like Java, or an academic one like Python? If you're not concerned about students ditching school after a semester, then by all means go with Java. If however you're a cynical greedy bastard that wants four years of tuition money out of them, then make sure they understand the academic stuff well, and let them figure out the commercially viable languages on their own when they graduate.
Also, as for the "it looks familiar" point, that again could be seen as a strike against it. Teaching something relatively exotic like Python (or way exotic like Lisp), and then coming back later to teach a language from the C family (C++, Java, even Perl) could help the students see what elements are similar among vastly different languages, and thus help them to understand what common things are going on at a low level in any language.
DO NOT LEAVE IT IS NOT REAL
Gee, in hindsight, this topic couldn't possibly have been an invitation to an all out flamewar over which language has the most fervent True Believers... Java! Python! C++! Assembler! Nothing like a /. shouting match.....
DO NOT LEAVE IT IS NOT REAL
Yes, understanding and modifying poorly written code isn't a skill that'll get you anywhere in the real world. </sarcasm>
The cake is a pie
If you want to teach someone a computer language so they can go out and maybe write a few programs to do things that should really be done by shell scripts, by all means use Java, or even VB. If you are trying to build a good foundation for a sound computer science career, or to develop top-notch programmers, do not teach them Java (or any other OO language) as a first language. OO provides some very useful and powerful tools for development, especially of large scale systems. It is not suitable for teaching people the foundations of computer science. If you want to take a theoretical approach to CS, a functional language would be a good choice as it exposes the logical formalisms that underly CS and information theory, for practial curricums, a procedural language is best since it closely mirrors the way computers actually work. Once someone has a strong foundation, they can learn any number of new techniques and languages easily.
Many OO programmers swear that people should start with an OO language for whatever reason, but I have quite a bit of experience with people who learned Java first, and C or Pascal first. Hands down, when it comes to understanding more complicated archetectures, even OO archetectures, the people who understand how those systems translate into something a computer can execute learn much faster and are better able to understand the tradeoffs in flexibility, convenience, and performance that different techniques make.
Seems to me Python would be a much better fit as a learning language.
You're quite correct that I haven't used it to meet a deadline like you describe. That is probably because my employers have always trusted me to set my own schedule, and I make sure I do it right. Part of doing it right for me is staying far away from the Microsoft Incompatible Dependency Suite.
I suppose VB would be good for teaching what people have to do in the real world when their language isn't up to the task at hand, and vendors have to invent new and strange things to give programmers the features they want. VB feels so hacked-together it's not even funny.
Besides, if we went by "widely-used" to decide what to teach new programmers, we'd all still be using COBOL. :-)
However quite an amount of failures is also hardware driven, rockets (challanger), ships, trains, airplanes, etc. only people find it much more hard to believe if an accident is caused by software, than by hardware. (or most of the cases human failures). From what I read in the news only a minority of accidents are coused by software.
:)
You're kidding me? I am talking about things like microprocessors, ICs and logic circuits. How often does your computer hardware fail compared to the software it runs?
Might to be stupid, but designing an flexible, self changing cell logics, doing tasks, might not be easy. I know the today CPU architecture (called Neumann or?) is pretty much already taken as the wisdoms last words, it's not. But developing alternatives is fundamental research, and getting money (and brains) for this is difficult
There are a lot of researchers and engineers around the world hard at work designing reconfigurable, programmable active memories PAM). These memories are asynchronous processor arrays that are data (signal or event) driven as opposed to being clock driven. They are not only orders of magnitude faster than conventional processors, but they are also non-algorithmic: every active cell executes its instruction as soon as its data is ready. This is called event dirven or data-driven parallelism. It's analogous to the way the brain works. It's the future of computing, IMO.
Moderation Totals: Offtopic=1, Interesting=1, Funny=3, Overrated=2, Total=7.
Not what I would call a consensus. I had no idea this would be so controversial. I thank everyone for their replies even the negative ones.
'Parallel algorithm' is an oxymoron. Think about it.
Software engineering will come of age when programming languages no longer exist. All programming languages (Java, Lisp, C++, etc...) share a common charateistic. They are all based on a programming technique which was first pioneered by Lady Ada Lovelace more than a century ago: the algorithm. I am convinced that the algorithmic nature of software is the primary reason that computer applications are so unreliable and that software development is so time consuming and expensive.
It is a known fact that hardware is orders of magnitude more reliable than software. The most obvious difference between software systems and hardware is that the former is algorithmic whereas the latter is based on parallel streams of signals.
A signal-based system is ideal for the implementation of work-once, work-always components that can snap together at the click of a mouse. This is because their temporal signatures remain constant. By contrast, one can never be sure when an algorithm will be done and this is detrimental to stability. Algorithms should thefore be implemented on top of a signal based system. They should not be the basis of automation. In the future we will have technologies that allow computer memories to instantly reconfigure themselves into parallel logic circuits. In the meantime, even though the Von Neuman paradigm forces sequentiality on us, signal flow parallelism can be easily emulated in software so as to hide the serial nature of processors from the application developper.
Unless computer scientists wake up from their algorithmic stupor, computer science will continue to limp along, badly. More multi-million dollar space probes will malfunction, airplanes will crash, electronic stock exchanges will suffer from glitches and airports will shut down. Half a century, thousands of lives and trillions of dollars later, we'll kick ourselves in the rear and ask ourselves "why have we been so damn stupid for so long?"
There is more exteraneous noise in Java than in several other OO-capable languages (C++ excluded). This extra required syntax and the REQUIREMENT to program in OO makes java as a first or even high-school language difficult.
If you take someone straight out of BASIC or Pascal and throw them into Java, you might have some obsticles - They're learning too much all at once. In High school, the added complexity probably isn't warranted (we want to spark interest in our youth), and in College, people that transition majors may need more hand-holding.
Not really true nor a factor. For a large number of institutions (primarily High School), Windows is the development platform. It's harder to get easy-to-use free Java tools for Windows. Yes, you can find them, but it's not an obvious choice. The second part of my rebuttle suggests that an institution spends the money on the right tools (within their priorities for a given carriculum). We used Apple IIe's with Apple Pascal. It was a purchased license, but the whole system cost was marginal.
To counter this, Java requires expensive hardware (namely, no donated 386 / 486 is going to be happy in a [education] development environment), though these are probably what you'll find in poorer schools.. Which has to facilitate advanced students taking AP courses...
Then they'd all teach Visual Basic as a first language. Since you're garunteed some sort of employment. It's almost impossible to avoid VB these days.
-Michael
It depends on your application. If performance is an issue, you may want a lower-level language like C or C++ that lets you explicitly tweak memory usage patterns. And C++, other than sheer perversions like multiple inheritance (which is something that I have rarely either used or seen -- because it rarely seems appropriate), really isn't much harder than C. Classes are glorified C structures with functions (methods) that are members and some other bits of sugar (the public/private et al foo isn't in C).
Java's interface handling (the 'class BLAH implements FOO, BAR, BAZ interfaces') is actually quite nifty, 'tho. It'd be uglier to do the same thing in Java.
FYI, the two programming languages I use most are C/C++ (treating them as one because they're that similar... and the C++ programs I write are usually imperative + some OO syntatic sugar rather than radically OO designs), and Perl (which is nice for rapid prototyping since it's interpreted, and support for native associative arrays and references is sweet -- it's trivial to do complicated hierarchical structures in Perl. Plus, a built-in regex parser is a pretty useful sometimes).
Only the dead have seen the end of war.
You're right, if they only knew Java, and never went on to learn other languages, they would be tripped up by those things you mentioned, but who only learns one language? You have to start on something, and by no means is it going to teach you everything.
In fact, one could argue that because they don't have to worry about things such as memory leaks and pointers in general (of course, once they do, they'll realize it's not that Java has no pointers, it's nothing but pointers--const pointers), it's a better teaching language. And that's key, it's being used to teach basic CS concepts, not the entire universe.
Why learn assembly first? That is the WRONG way (IMHO of course). The way I see it, CS should be taught from the top down. First, you learn an OO language like C++. Why? Object Oriented design methodelegy is extremely high level and abstracted.
Next, on our trip to the bottom, a funtional language like C should be taught. If you have ever read "The C++ Programming Language" (Bjarne Stroupstrup), then you will remember that Bjarne said that learning C++ first is better than learning C first and moving to C++ later. The problem with going from functional->object oriented is you will try to do functional programming in the object oriented language. That doesn't come put too pretty. But, anyway, the reason I would teach C after C++ is because starting at the top and going down towards the heart of the computer is better.
After C comes assembly. Pick your choice--x86, PPC, m86k, or MIPS. Or even any other assembly. Assembly belongs last. Why? This is the part that can become useless. x86 is big now, but will it be in 10 years? Will processor architectures be the same in 10 years? If you start here, Then you will end up trying to make all your programs run best on the architecture you learned. So, when you got to an OO language, it would still be fairly low level, and the idea of OO design would be lost upon you. If you go from OO to assembly, you won't have this problem. You will have an appreciation for what the compiler does for you. Knowing assembly will help you to optimize your current programs, but the idea of portability will have already been ingrained into your skull, never to be forgotten.
Now, onto Java. Don't teach it! If a school wants to teach pure OO, then use ruby. Ruby is 100% pure OO, and would be a great teaching language. If Ruby can't be taught, then at least teach Python. Why must people choose Java for pure-OO when there are other languages that do it so much better, and in a free way (Ruby is free software).
So, maybe I am little biased towards OO design (I find that OO programs are easier to read, debug, and maintain). But, OO design does promote good code. I know I'll get flamed for this but...iostreams are many times better than C stdio. What you say! Well, it is a hell of a lot easier to learn cin >> foo that scanf("%d",foo). And, you can add the ability to input/output user defined data types with ease. You also get rid of printf() format string attacks. I see that as a huge bonus. printf("%s, moo! %d",5,"arf")...that will do a bad thing. It is impossible to screw up like that with an iostream: cout 5 "moo!" "arf" (yes, it will still output wrong but it won't segfault). Now, if C had a typeof operator that would fix the problems with printf and scanf etc (in va_args, you could do something like this: if (typeof(va_peek) != char*) return error)). Now, time to retreat into the flames of the anti-OO trolls (OO and functional coding have their places. I do not wish to force my opinion on anyone. If you want to flame me, then please present me with a sane argument).
-------------
HAL 7000, fewer features than the HAL 9000, but just as homicidal!
Ok, I get your point, but my view is still that you should have at least some previous knowledge of programming before startnig with OOP. In that way you already know the "tool" and OOP becomes just another way in which you can use it.
So, no OOP in the very first programming course. That'll come in the second course.
Teaching programming using OOP is [not quite, but almost] like teaching math using finite element methods (which I know is being done in some places).
Sig note: You know what I meant.
It's 11pm, do you know what your deamons are up to?
Java is, I would say, more platform dependent than C or C++. Furthermore C and C++ are actual real international (ISO) standards which means that you're protected against changes to the language that will make your old code incompatible with the new language every three years. Java is something that Sun does whatever they want with (and Microsoft has it extensions to it making it incompatible with the rest of the world as usual).
/have/ had troubles when people have been using extensions to the language, or as you call it "Borland C++ programs". The point is: Those programs are not C++. They are "Borland C++ programs". Those two things are not the same.
Why is Java more platform dependent than C or C++? First of all, if your platform hasn't got a JVM, you are done for. You can't run Java programs. If anyone tells you you don't need to have a JVM, then WHAT THE HECK IS THIS DISCUSSION ABOUT?
There's absolutely nothing in the C or C++ language standards that says anything about the platform, that's why those languages are so great for writing embedded applications and operating systems. They don't even assume the existance of a monitor or a keyboard.
I have never in my life had a problem with running C++ code written using the Borland C++ tools on my GNU/Linux or NetBSD machine. I
Now, I need some coffee...
It's 11pm, do you know what your deamons are up to?
My analog watch can calculate 1+1 faster than that thing.
:P
Shift key slip. You know what I meant
...but the sad thing is, you're probably right. We were working in Codewarrior (C++ Compiler) and a simple 20-line console app took about 130 seconds to compile. Then you had to get it to run. I think I spent more time in that class compiling than I did actually writing code.
Oh, the pain...
Consider: with OO you're told that you should spend 80% of your develompent time in OOA and OOD (making cute little object diagrams on whiteboards before doing any real work). I doubt that anyone except the most experienced programmers can forsee all the problems that they will encounter when writing the code, before actually writing it.
And once you do run into something that you didn't expect, you have to run back to the whiteboard for some more OOA & OOD, then sit down and make little changes over many source files that depended on the way you set things out the first time (at least in Java or other strongly-typed OO languages). Personally, I find that pretty wasteful.
Why not try a language that encourages you to write small amounts of code that can be tested in isolation, and then makes it easy to combine that tested code in different ways with little modification. I've found Python to be very good at this, but I'm sure there are some other good options.
Okay, so it's sounds a little crazy. But why not teach elisp and emacs? I think that too often, CS students who are not complete geeks like ourselves go into CS not really having any decent tools that they can use to expedite drudgerous tasks. They're given assignments to create things that will be of little or no value to them once they're done with the class (unless they can get hours of amusement out of playing cheesy simple tic-tac-toe games). By teaching an editor that has a very good scripting language (one could even teach a scriptable editor other than emacs/elisp, if it's really against their religion), you can show students that they can use their programming skills to create useful tools that they can use to write more code faster and better, and with less drudgery. If I knew how to effectively use elisp/emacs when I first became a CS student, my grades in those first few classes would have been far higher.
CS should give you a thorough grounding in several languages. Once you've got a few languages under your belt, you begin to understand that when you get right down to it, languages are just syntax and the concepts invariably remain the same. In fundamental concepts, Java and C++ are damn close to one another. As long as you understand the fundamental concepts and can pick a language that can most easily express the solution to your problem, you're pretty well set.
I'm trying to teach myself to set people on fire with my mind... Is it hot in here?
Once you get into OO, by the way, Design Patterns should be one of the required textbooks. You can get patterns books for other languages but the one with the C++ examples has struck me as being the most complete of the lot.
I'm trying to teach myself to set people on fire with my mind... Is it hot in here?
Once the student understands how things work in memory, going to any other language should be much more straight forward.
I'm trying to teach myself to set people on fire with my mind... Is it hot in here?
Eiffel is the only language to teach if you want to teach object oriented methodologies. Period. If you disagree, you don't know what Eiffel is. If you think you know what Eiffel is and still disagree, you're wrong, you don't know about Eiffel, go learn to actually CODE in it and you might discover what object oriented really means. Anyone who tried to tell you that inheritance was like "is-a" relationships doesn't know OO from a hole in the ground and has never used Eiffel.
Dismiss me as snooty or whatever, but just stick it in the back of your mind and in 5 years when you're writing your new applications in Eiffel and wonder what the hell #defines were for and what they ever had to do with porting, remember this post.
Esperandi
Instead of asking which language to use in an introductory CS/programming class, one should ask what concepts need to be learned and in what order, and then pick one or more languages that can illustrate the desired concepts. When the problem is approached that way, any one of several languages will do.
Many have suggested that the most important first step is learning about the machine being programmed, e.g. registers, memory management, addresses, etc. I suggest that this approach is exactly backwards. The early concepts should include basic structured programming constructs like if-then-else, case, subroutines/functions, and building larger programs from smaller pieces. Then you can introduce good, controlled interfaces and information hiding and why it is vitally important do them as well as you can. While you're at this point you can stress the point of documentation and communication, perhaps through a group project where each individual has to use code written by others in their group without being able to look at each other's actual code. These are the very basics of programming.
Then you can introduce concepts like object orientation, polymorphism and overloading. Somewhere along this point things might split up into more or less hardware oriented tracks. The more hardware oriented would get into C, C++ and assembler with maybe some embedded applications. The more business oriented track would introduce persistence/databases with SQL, XHTML, Java and many other language(s). Overlapping subject matter might include human factors (UI), distribution (networking) and parallelism (threads and multiprocessing). Somewhere in there you want to teach lower levels of how things work, e.g. compilers and language theory.
All of the early boring stuff (disciplined structured programming, documentation, communication) is the most important part for a software professional because you always do all of those things regardless of programming language or architecture, no matter where you work. These topics should be covered first, no matter which language you use to cover them. These basics are ironically the stuff that most CS and engineering programs leave out or skip over.
something like Prolog or haskel.. Computer scientist at the undergrad level are in training to be Computer scientist to go on to a graduate level. Have some 2 credit courses that teach C++/java or any other language.
Moderators, pay attention. That was the most important statement in the entire discussion (at the high school level). AP Courses should use the language that's in the AP Exam. Period. Otherwise the students will not get AP credit which can save them $$$ in college tuition.
The current AP CS Exams use C/C++, but they will switch to Java in 2003. College courses should use whatever language is best for them; personally I recommend Scheme or Python. But for the high school level, you ignore the Board at your own peril.
---
"This message is composed of 100% recycled electrons."
Seriously. It has the pure OO-approach and lambdas of Smalltalk, simplicity of Python, flexibility of Perl, even borrows mix-ins (advanced OO concept sort of like multiple inheritance) from eiffel and is fun, with easy to understand syntax! If you're going to teach OO language approaches in an imperative language, this is a serious language that contains just what you need and no extra fluff. It is easily extendable, both in C and within the language itself. I bought the "bible", got productive after a few hours and learned almost everything but C-extensions in just 3-4 days. Very easy and fun read, plus the entire book is also available online.
;-) Java is NOT a well-designed language. It's not always best to follow the pack either, those who make a difference don't. Ruby is perfect for bringing up new ideas. Let students experiment with extending OO-concepts in the language!
Here are some additional links:
The official Ruby page
Dr. Dobbs article about Ruby
Documentation
HotLinks
If this weren't MUCH better than Java, I wouldn't pull this shameless plug. Please check it out, don't stay in the dark ages..
Btw, PLEASE don't make the students create Object Oriented ZOOs and the like. We were forced to such meaningless assignments when we had OO-classes in school, and such stupid problems are for OO-morons. Additionally, you don't need a "fast" language for teaching OO-concepts. On the contrary, since ruby is a glue language (like perl), it can be used to glue the right tools for the job when you need it to. It's definately fast enough if you just express your ideas in it correctly (avoiding many nested loops). Some people even use Ruby as a specification language, because of it's easy-to-understand syntax and lambdas. Ruby code is usually shorter and more readable than the same code expressed in other languages.
- Steeltoe
http://www.debunkingskeptics.com/
Worldwide programmer shortage? Woooohooooooooooooo!
____________________
It's rare that you're presented with a knob whose only two positions are Make History and Flee Your Glorious Destiny.
I'll admit I wasn't aware of this -- but aren't they licenscing java from SUN? meaning -- they're still at SUNs mercy ?
Free Techno/Jazz/DNB/MI Music by guys obsessed with monkeys!
That hardly is a well articulated argument.
Free Techno/Jazz/DNB/MI Music by guys obsessed with monkeys!
How long do you think java is going to be "free" for? My guess -- another 5 years -- by then it will be everywhere -- and SUN will pull a Unisys and start charging fees for it. (this is just my oponion, not fact)
I think schools shouldn't teach their students langauges that aren't free (as in speach). Theres 100 C/C++ compilers you can buy/download, but just a couple java compilers.
\editorial : For begining students I expect Python would be a good choice -- its simple, very consistent, and is very explicit about variable cohercion, and is still "powerfull".
Free Techno/Jazz/DNB/MI Music by guys obsessed with monkeys!
I've been a computer programmer for 20 years, and I write both Java Applets and Java Servlets every day. I've been working with Java for two years. I would argue that I'm qualified to make my own statements, and I'm not parroting things I've heard before.
There are currently 5 Million java developers worldwide. Java is the main language used for eCommerce. Do you want your web site to leak memory?
Are there more people who write in C/C++? Yes. Is it possible to write C/C++ code that doesn't leak memory? Yes. Is it possible to write Java Applets that unintentionally leak memory? YES. Java is not the main language used for eCommerce. You are incorrect. What language was Apache written in? What language was Windows written in? What language was Linux, BSD or any other UNIX written in? What language was your browser written in? What language was your TCP/IP stack written in? WHAT LANGUAGE WAS JAVA WRITTEN IN? I believe a more intelligent argument would be that eCommerce applications for making intranets, or serving non-static web pages are most commonly written in Java, and that the only language for doing client-side execution without a plug-in or otherwise installing software is Java or JavaScript. Regardless, that doesn't make it a good language to teach programming in. It also doesn't make it the most widely used language.
And this is Java's fault? You're hilarious. I was countering the argument that Java is cross-platform. Instead of establishing through example that it IS cross-platform, you seek to attribute blame to someone else. You have not defeated my argument : Java is not cross-platform, in the way that everyone harps it to be. Who's parroting?
Applets are hardly used anymore. Java was clearly a failure in this area Thank you for making my point for me. I can guarantee to you that if a University intends to teach Java as a programming language, they will at some point develop applets. This doesn't help anyone. They won't use that skill in the real world, and even if they wanted to, by your arguments, it wouldn't work. And in learning Java, they never learned pointers and memory management. Guess what? It'll be harder for them to learn C/C++, because of it. And you're ignoring my main point : it's EASIER TO LEARN JAVA, IF YOU'VE ONLY LEARNED C/C++ THAN IT IS TO LEARN C/C++, IF YOU'VE ONLY LEARNED JAVA!
Maybe, but when dealing with eCommerce or enterprise apps... You know what? Fine. Have your stinking eCommerce or enterprise apps. You know what? Most programmers are NOT writing eCommerce or enterprise apps. Let's prepare MOST programmers for the real world! And by the way, back to my early argument, making your web page look pretty is a small portion of your business. And no, enterprise applications are not clearly in the realm of Java, either. If you want to work for a consulting firm, be prepared to not write in Java. Because C/C++ is still king, in that market, too.
You obviously have no idea how java works. Thank you for being inflamatory. You're also incorrect.
Changing values passed into a method is not OO practice, and should be discouraged. What planet do you live on? So, it's okay for my method to return a value... But it's bad for it to return multiple values? I have to design a class, or use a Vector, in order to have my method return multiple values to you? I'm shocked that you think it's bad OO practice. I should have to write two functions? Or make a special purpose class? Or use a Vector? I can't even see through your argument to a spark of logic that might have created it!
Oh no... Please don't code anywhere near my app. I hope all your C code isn't in one file You know what? This whole discussion is about teaching programming. And when you TEACH programming, you're likely to start with small programs. The kind that are likely to be solved with one class. Like, if I want to teach about a FOR LOOP, you're proposing that I put that into multiple class files? Let's stay topical, okay? And my TOPICAL argument is that, while teaching someone programming, they're likely to do most of their coding in simple, one-class programs. And there will be the temptation to use global variables, just like there is in C/C++. But, in Java, you have the comforting blanket of it being a class variable! It's not a global variable! Having a class variable is perfectly OO! But guess what? They're using it like a global variable, and if they start coding in C/C++, they'll do the same thing. AGAIN, you're IGNORING my fundamental point - that it's EASIER TO LEARN JAVA, IF YOU UNDERSTAND C/C++ FIRST, THAN IT IS TO LEARN C/C++ IF YOU UNDERSTAND JAVA FIRST.
Java is not pure Object Oriented.
and C++ is?
I never said that. Again, you get mad at me for saying that Java has faults. Well, if they both have faults, that eradicates your argument that Java is BETTER. I'm not saying that C++ is pure OO. But I'm demonstrating that NEITHER IS JAVA.
I've had no problems developing in Linux and moving my executables to solaris or NT. Try moving them to C-64. Or Lego bricks. Guess what? You can with C. And yes, these are silly arguments, but they prove that C is more Cross-Platform than Java is. So, if your argument is that Java is more platform independent, so let's use it to TEACH - well, you're wrong. Does it take work to port code? Yes. Is it possible? Yes. I'm not saying Java isn't useful... I'm merely saying that it isn't a better language to use, when teaching computer programming. And my specific argument here is that, when you say Java is cross-platform, let me retort that C/C++ is MORE cross-platform.
Java is a very nice, high-level language; while it may not be suitable for beginners, it provides a lot of things that make it useful to people who want to get things done in business. This is going to surprise you : I agree with this statement 100%. And the whole point of this Ask Slashdot was if Java was a BETTER language to teach beginners. And the whole point of my post was to say that it's not. But you seemed to ignore that, and got mad that I pointed out that there are flaws in Java, there are flaws in the argument that Java is cross-platform, and there are flaws in the argument that Java is the perfect OO language. My point remains : Java should not be used to teach computer programming, or Computer Science.
I speak as someone who learned to program in BASIC, then in Pascal, then in C, then in Object-Oriented Pascal (like, the exact day that it became available from Borland), and then C++. From that foundation I have learned about every language that you can name. And in my opinion, the best language to use when teaching people Computer Science, is C and then C++ - when it's time to discuss OO.
Education is the silver bullet.
This is fantastic, someone brings up the question "Is Java a better language to use, when teaching people Computer Science." I say "No," and try to explain my reasoning. So, obviously, I'm a troll. *sigh*
Education is the silver bullet.
I've been programming for 20 years, and I've been coding in Java for two years. Writing both Applets and Servlets, as a professional programmer. I understand Java.
I know that Java is versatile, and can be used in many environments. My point is that C/C++ is a better language to use, when teaching computer programming and Computer Science.
Java has strict typing That everyone overrides. If you override it, every time, it doesn't exist. String a = (String)myVector.elementAt(0); Code like that appears all over the place in Java. That's not strict typing.
You can learn the fundamentals of programming in any language, even COBOL, Fortran, BASIC, and Pascal. Oh, and C/C++. Your argument doesn't mean that Java is BETTER, only that it is functional.
it can introduce many different aspects of programming to a student... without having to learn another language/environment or some 3rd party libraries. This actually isn't a bad point. I'd argue that doing GUI or event programming puts you into Java Application or Java Applets, and those are not real-world problems, you know what I mean? If you're going to encounter GUI or event programming - as a professional programmer, it'll be in C/C++. So, teach it in C/C++... Right?
Java is a good language. I'm programming in it right now, and it's useful. Another language would not be as useful, for the task I'm working on. I acknowledge that Java has its strong points. However, C and then C++ should be the language(s) that are used to teach people how to program, in a Computer Science curriculum. Mainly for the reasons I listed, which you ignored.
The arguments I brought up against Java were just to illustrate my point... When someone says "Java is BETTER than C/C++ for TEACHING computer programming," I can say, "No, it's not." I agree with you that it has uses, is useful, and is not a bad language. I disagree with anyone that says that we should use it to teach Computer Science!
Again, it's EASIER for someone to learn in C and then C++ to switch to programming in Java - than it is for someone to learn in Java, and then switch to C and C++. And since MOST people will end up having to code in C or C++, eventually - teach it to them, in the first place!
Education is the silver bullet.
In the domain of enterprise and back-end products, I agree that Java is very heavily used. I will argue that enterprise and back-end product development is done by a very small portion of the professional programmers in the world. Most people who program will not be doing that, therefore it is illogical to assert that Java is a better programming language to use to TEACH BEGINNING COMPUTER PROGRAMMERS, on the grounds that it's dominant in that market. Lisp is dominant in the AI field, but that doesn't mean you should use it to teach people how to be professional programmers.
Why are you passing values by reference?
void GetNameAndAge(char **Name, int *Age);
When I call it, I say :
GetNameAndAge(&Name, &Age);
The ampersands help me remember that the procedure will change the values. I'm passing a pointer (passing by reference) to the values that I want the function to find, and return.
I personally have the same complaint that you do, which is why I'm opposed to people passing by reference, by using the & in the declaration - leave that to the caller!
an introductory class would be much better served by discussing loops, methods, and basic algorithms I agree. You can do all of that in C just as easily as you can in Java. In my opinion, it's actually easier in C. And then, when you want to teach OOP, malloc/free/new/delete, you show them C++. And in the process, you're preparing them to be professional programmers, because they're learning the programming environment they're likely to end up using in their professional lives.
[I] have found Java to almost always be a better choice. Most computer programming is done in C and C++. It doesn't matter if you like the language better, I feel that it's more appropriate to teach someone to use the real tools they're likely to use in their professional lives. I personally like Object Oriented Pascal more than any other language. But I'm more realistic than you, apparently. Even though OOPascal is vastly superior to all other languages (tongue placed firmly in cheek), I recognize that C and C++ are by far the most widely used languages, and are far more appropriate to use, when teaching people how to be professional programmers.
Again, that's client side. When people talk about how cross-platform Java is, they're going to bring up Applets. My argument is that Applets don't work. Well, actually, they do - but it's enormously painful to get them to work right. The consumer loves it, but for the developer, it's a nightmare. You seem to agree with me on this point.
I actually had to change some of my code, when switching Java Servlets from platform to platform - Vector.add doesn't work in Tomcat, apparently... It's Vector.addElement.
And back to my point, even though writing servlets cross-platform is great fun, most people will not do that for a living! So, give them the tools that are appropriate for their upcoming jobs! C and C++! PS, if they learn C and C++, it's easy for them to learn Java! But, if they learn Java (and only Java), then by your argument that "C++ is much more complex and difficult" it will be NIGHTMARISH for them to switch to C++! How can you not agree with me on this point?!
Java is nowhere near as bad as you think it is. I use it professionally, it has many uses, and it's not a bad language. But it's not so much better than C++ that we should start using Java to teach Computer Science and computer programming! That's my only point!
[Java] is a real language capable of doing real work, in many cases much more quickly and reliably than would be possible in C++. I must have been horribly unclear in my post... I AGREE WITH YOU that Java is useful. BUT IT SHOULDN'T BE USED TO TEACH BEGINNING PROGRAMMERS! Use C and C++ to teach, and then, hey - give them a class on Java, if they're curious! Don't administer the Advanced Placement test in Java! That's INSANE! Don't teach Freshmen how to make applets! Or SERVLETS!? Are you nuts! Teach them C and C++, and then it's easy for them to learn that other stuff, later!
Education is the silver bullet.
void ChangesA(int *a) { *a = 1; }
You can't. You have to pass an Integer, instead - or use a Class, such as Vector. That's what I mean by being able to "pass variables by reference," it means that I want the procedure to have the ability to change the data that you send it. Oh, and by the way, my definition of "pass variables by reference" works in almost any language, C, C++, and Pascal included. Your definition is a technicallity, based on the difference between dynamic classes and static classes. The fact that static classes are passed in Java by reference hardly makes it easier for me to change the value of an integer passed to a method.
Secondly, this is exactly the point of high(er) level languages. You're funny. It reminds me of the HIGHEST level language : TA. It's simple to use : as a professor, you enter your program source code into the computer via answering machine, shoddy sketches, a few simple words in the hallway, or by sending an email. The result : a few days later, a Teaching Assistant (sometimes the Research Assistant) has produced the desired output!
But seriously, Java does cool stuff. Unfortunately, most people won't end up using Java in their professional programming lives. Also, learning Java first has drawbacks : namely, it makes it harder to learn programming concepts that will be needed, when using other programming languages - like C and C++. Coincidentally, the language they are most likely to end up using IS C or C++. Therefore, in my opinion, teach them using C and C++, in the first place! Especially since it's then easy for them to switch to Java! I'm amused to see that Java advocates have a hard time admitting to its weaknesses, and contemplating the proposition that Java might not be perfect for every task - like, teaching someone how to program in C and C++!
Automatic Garbage Collection is a concept that can be applied to many differing programming languages and it is a detriment in none of them. When you have Garbage Collection - it's useful. I agree. But, if you've NEVER, EVER had to program memory management yourself, it will be VERY, VERY hard for you to learn how to. Since MOST people WILL have to code in C and C++, and WILL have to program memory management for themselves - I would argue that it's BETTER to show them how to do it right, in the first place. Especially since it's not that hard! It's a good programming practice that they should learn! It's just as easy to NEW and DELETE as it is to NEW!
Maybe you should study the term encapsulation. Wow - that's mature. I've been programming for 20 years, and I've been using standardized Object Oriented programming since before it even existed as a standard in C++. I also recognize that it's possible to write encapsulated code without the help of a compiler! When CLASSES communicate, it's valuable to encapsulate the data - in fact, it's about the most important programming practice to learn, in my opinion. But, when I want to write a function that will return TWO values instead of ONE value, I think it's nice that the C and C++ compiler knows how to support that. Whereas the Java compiler DOESN'T know how to do that. FOR NO GOOD REASON. You're telling me that a procedure with multiple return values is somehow NOT good Object Oriented practice? Are you insane? Somehow ZERO or ONE are the only crumulent possibilities? (To steal the word crumulent from The Simpsons.) TWO or MORE are evil?! What world do you live on?
people learn the wrong way to write OO code I don't think Freshmen in college, or worse, High School Students, should have to write OO code in their first computer programming class. I think that data structures and procedural programming should be taught first. Then you show them how useful objects are. Otherwise, you end up with people who start writing Financial software by writing
public class Penny
Object Oriented Programming is a TOOL, it's not a way of life. It should be used when appropriate! I happen to think it's not appropriate for integer and double, Java seems to think I'm wrong.
Java allows you to solve problems, C++ allows you to solve details. Allow me to respond with another generality : All generalities are incorrect.
You can write clean, beautiful code in almost any language. (I happen to think it's impossible in COBOL, but I never really tried.) I could write the same code in Pascal, Object Oriented Pascal, C, C++, or Java - I'm competent in all of them. It happens to be easier to solve some problems in some environments. I'm arguing that Java isn't good for teaching beginning computer programmers and Computer Scientists. SPECIFICALLY, because they're likely to have to use C and C++ at some point in their professional lives. I think we should TEACH them to be good programmers in C and C++. Then, they'll be good programmers in any environment, Java included! But if we have them use Java instead, my argument is that they'll miss out on such things as memory management, pointers, passing values by reference... And at the end of the day, they're likely to have to go and learn C and C++ and how to do all of that stuff, ANYWAY! Why not show them how to do it RIGHT in C++!? It's easier to learn it right the first time!
By the way, I learned in BASIC and Pascal - and I happen to think Object Oriented Pascal (read : Delphi) is the best language, ever. But I understand that SINCE people WILL have to use C and C++ and there's nothing WRONG with C and C++, we should use it to teach them! You CAN CODE WELL in C and C++, and it's NOT HARD! TEACH people how to do that, and they'll be able to tackle ANY problem in ANY language! But, if you never let them do memory management, or use pointers, you're massively crippling them!
Java allows you to solve problems, C++ allows you to solve details. As an employer, I know which one I'd want you to deal with. As an employee, I would think that you would want me to write good code, no matter what the programming environment. I would think that which programming environment I used would be important to you, only in the context of being able to maintain, support, and reuse the code that I write. Most employeers see C and C++ as the only way to go. I'd rather prepare most beginning programmers to be able to work most places!
Education is the silver bullet.
The claim here, AFAICT, is that Java is a cleaner, better designed OO language than C++.
The claim here is that Java is a better language to teach beginning computer programmers. That claim is incorrect.
It's frequently possible to tell that people were C++ coders before becoming Java coders from the quality and style of their code.
It's frequently possible to tell that people were Java coders before becomming C++ coders from the memory leaks and from their inability to dynamically allocate objects correctly.
I don't know what you would point out as being particularly "C++" about someone's Java code. I honestly don't. I'd love to see some examples of the wrong (read C++) way to code something in Java, and then the right way. It's an entertaining notion to me, but I have as yet never seen an example.
If that's what people are being taught, then it's the quality of the teaching that is to blame, not the quality of the language. I agree. Most people argue to me that the Java language enforces good coding practices, and that's why it should be used to teach people. Laughable. You can write bad code in ANY language. I was trying to illustrate that one of the pitfalls of trying to code in C++ like one would code in Java is that there's code that's OUTSIDE of a class, and that's a weird concept to grasp.
By the way, you CAN'T write global variables in Java - everything is inside of a class! No wonder you'll never see a Java coder do it! Oh, unless they then try to write C++. What's an example of something that I, as a seasoned C++ coder, am likely to incorrectly do in Java?
The whole point of my argument is that Java is not a good language to teach beginning programmers. Every argument that I have heard about Java in favor of C++ as a TEACHING language, is illogical, incorrect, or just language-centric posturing. Java is a fine language for use in many situations. I use it myself, and it's not too bad. But I think that C and then C++ are the languages that should be used to teach beginning computer programmers. Specifically since MOST people will have to code in C or C++ at some point in their jobs, and it's (in my opinion) FAR easier to code Java, from an understanding of C++, than it is to code C++ from an initial understanding of Java.
Education is the silver bullet.
You're telling me that, having done Java programming for the last five years along with C and C++, you can honestly say that Java APPLETS crash less often than C++? Have you EVER programmed a Java Applet? Oh, wait - and then tried to VIEW it using the browsers that people are using? Like, IE 5.5 on an IMac? Netscape 4.0 on a Win box? You obviously have no idea of what I'm talking about. The VM is unstable, since every crappy version that people are still using has bugs. The latest and greatest JVM for servlets is fine - I never said it wasn't. I was talking about Applets. And I was talking about Applets because people always say that Java is portable, and then they're arguing that Java should be taught as a first language for beginning computer programmers. A beginning computer programmer is likely to be shown Applets, as a matter of course - and that will be a disappointing experience. Applets are VERY hard to get to work correctly on all platforms. There are versions of the JVM in browsers that will CRASH if you ask them what version they are!
In truth, Java is one of the most stable platforms your can find today for development. You're quite obviously not talking about Applets, which was what I was mentioning, when you misquoted me.
Passing variables by reference. What I'm talking about is the fact that Java allows you to return either no values, or one value, from a function. There's no way to return multiple values from a function, unless you use a class. Repeat after me : Java lacks the ability for the coder to use pointers. I can't write this in Java :
void ModifyA(int *a) { *a = 1; }
And there's no good reason I shouldn't be able to. Specifically, for you to write this :
void ModifyAAndB(int *a, int *b) { *a = 1; *b = 2; }
In Java, you would have to use either a Vector or a special-purpose class. That's insane. Keep in mind, I'm talking about TEACHING BEGINNING PROGRAMMERS, here. I could care less about it lacking that functionality, in my professional life. It has about zero impact on anything - and it's trivially easy to work around, in most cases. But you show that C++ code to a Java programmer, and they are LOST. Therefore, teach them C++, in the first place, NOT JAVA.
I can hardly believe your last two paragraphs were written by the same person! I agree with them, whole-heartedly. It sounds like you're saying that the way to teach beginning computer programmers is by showing them C, and then C++! That's my point!
Java is fine, and I happen to use it on a daily basis. But I recognize that it's not the best language to teach beginning computer programmers! The best language, in my opinion, for teaching beginning programmers, is C and then C++. You seem to finally agree with me, after misquoting me, and insulting me. Granted, I insulted you right back. But, remember the children! :)
Education is the silver bullet.
Oh, well, yeah. That's what true OO is all about.
This has been a recurring theme in people's responses to me, so I want to adress it. NO, IT'S NOT. Object Oriented encapsulation is about encapsulating the data in once class, so that ANOTHER class will not access that data! When I'm writing several methods in the SAME CLASS, there's no reason that the language should prevent me from changing a value in a method! That's certainly not what Object-Oriented programming is all about, "true OO" or not!
Education is the silver bullet.
You sound like the type of person who would code a Penny object for a financial database. By providing a simple example of Java's inability to return multiple values in a method, I was making the point that it's harder to write certain methods within a class. (Quickly, any way! I remember when RAPID Application Development was desirable!) I agree with you that exposing functions like mine in the public area of your class is a bad idea. But there's NO GOOD REASON why I shouldn't be able to declare functions like that in the private area of my class. Encapsulation refers to the API - the interface to your class which is exposed to the outside world, the user, the coder. FORCING someone to encapsulate their data, within the methods of one class, is madness. If my file contains NAME and AGE, there's no good reason that I shouldn't be able to fetch that data, as a private method of my class. None. Forgive my silly example, pretend instead that I had listed the function as follows :
void MySQLFetchUserNameAndAge(unsigned int id, char **Name, unsigned int *Age);
And imagine that my database is designed to keep track of who can legally buy cigarettes or alcohol in a store on campus. Imagine that every student has a student id which is a non-negative number, which is magnetically stored on their student ID. The store wants to allow people to quickly scan their student ID to verify that their Driver's License is valid. Also, they'll get a student discount. Imagine that all of the data is stored in a central MySQL database. Now, I'm writing this function to encapsulate my call to the MySQL server, because the university is thinking of switching to Microsoft Access, despite my best warnings. Now, imagine I have two hours to write the whole thing. I would argue that it's better to encapsulate a private call which might have to be changed in the future, so that it's exposing as simple of an interface as possible to the rest of my class. Imagine that this is a method in the private area of my class, which will only be called by other methods in my class - which expose a brilliantly designed API to the rest of the universe. Now does my example demonstrate poor cohesion? You're telling me that it makes sense that Java says that I should have to use a Person object with accessor and mutator methods for all of its class-level variables? In the middle of my class? In an API that I'm not exposing to the outside world? The internal functioning of methods in my class shouldn't require encapsulation. And by the way, your way takes far, far longer to code. Again, this reminds me of the Penny object, in a financial application. It might be brilliant code, but making something an object doesn't magically grant it cohesion.
Universities teach Computer Science. They also teach Art History. It's pretty hard to get a job, as an Art History major. Heck, it's hard to get a job as an English major who graduated at the top of your class. A useful function of the Computer Science education is gaining experience in computer programming. As I mentioned, there are a handful of people in the world who do Computer Science for a living, without ever doing computer programming. I think it's essential that someone who is preparing to enter the work force have useful and marketable skills. Therefore, I think that chosing the language to teach Computer Science with, is an important decision. Specifically since almost everyone with a Computer Science degree ends up programming for a living. I think it is possible to teach Computer Science by teaching computer programming, and showing what it means. Computer programming is essentially the language of Computer Science. Computer programming would be the syntax and Computer Science would be the semantics, in my argument. I would agree that learning good programming practices, and what it all means - the Computer Science of it - is the most important part. But the language plays an important part in that! It would be like trying to teach English Literature to students who are forced to read and discuss it using only Spanish. I'm stretching my example, sure. I'm just trying to illustrate that the syntax plays a role, in learning the semantics.
You have at no time in your arguments demonstrated that Java is a better language to teach OO in a University than C++. You have merely asserted it, several times. This does not form an argument. An argument uses logic and examples to illustrate and defend someone's reasoned opinion.
If you have to fight memory management and pointers, then you don't have a good teacher. Memory management and pointers are easy concepts to grasp, if you discuss it in the right language (read : one that HAS memory management and pointers available for coding - i.e. NOT JAVA), and if you have a good Computer Science background, framework, teacher... You can't debate this point with me. Address and defeat this one single point of mine and I will be persuaded.
Beginning students, as you rightly call them, should be granted the opportunity to use the same tools as advanced students. You never make the case that BASIC should be the language of choice. Why not? It's BEGINNER's All-purpose Symbolic Instructional Code! The answer is obvious - it lacks constructs that are essential in any serious later programming. Java lacks constructs that are essential for C++ coding. List for me constructs that C++ lacks that are essential for Java coding.
Hey, thanks for pointing out the whole 1.2 to 1.1 thing! That helps! I hadn't had the time to research what had happened to me.
Again : you can win this debate if you can list constructs that C++ lacks that are essential for Java coding. Oh, I suppose for extra credit, you should have to assert and defend the position that people are more likely to end up having to write Java than C++. (They're not.) And it would be nice if you demonstrated that the first thing that beginning Computer Scientists should learn about is OO. (It isn't.) And you would crush me completely if you could demonstrate that pointers aren't necessary to learn about for a Computer Scientist. (They are.)
And do it all while remaining calm.
Education is the silver bullet.
To quickly put the analogy in math terms : You are stating that all of mathematics should be taught in polar coordinates. They are far more useful than cartesian coordinates, because there are several circumstances where polar coordinates are vital!
If C++ had been taught in your program, from the very beginning then students could easily focus on learning the material that was taught, and explore the concepts, as opposed to fiddling with trendy single-task (ie INTERNET) languages. It would allow the students to develop, and the teachers to test on whatever system they are most comfortable with, because C/C++ is the most platform independent language in the world. You can run C++ on a Lego. You can run C++ on your car's Fuel Injection system. Java Applets crash in some browsers when you ask what version they are. Java servlets are far better behaved, granted. And the latest and greatest JVM is probably pretty darned good. But when people say "Java," I have to remind them that not all Java's are created equal. Granted, neither are all C++'s, but you don't get to use the argument that Java is MORE platform independent than C++. That's my point.
While some programs have different views, the one I attended, and my personal opinion as well, dictate that the objective of a Computer Science education is to teach you the theory behind the construction of a program to solve problems efficiently, as well as expose you to prior work by individuals in these areas.
You are absolutely correct. Some of those theories relate to data structures and algorithms that are impossible to implement in Java, but are easily done in C++. Take special note of the fact that William H. Press, Brian P. Flannery, Saul A. Teukolsky, and William T. Vetterling have not yet written a book entitled "Numerical Recipes In Java : The Art of Scientific Computing." (That book exists for C, Fortran, and Pascal - all traditional Computer Science programming languages.)
C++ has a larger available API than Java. By far. Java allows for rapid development of many programs in the eCommerce problem space. However, for coding 90% of your applications, C++ is just as good, or better, or far, far better than Java.
All that said, let me reiterate that JAVA IS FINE. It is awesome at some things that C++ sucks at. I use it daily, in my job. I seriously wish that Java Applets were more stable, so that more people could easily develop for them. Yay Java! But not for TEACHING BEGINNING PROGRAMMERS.
Education is the silver bullet.
By your extended argument, BASIC sounds ideal as an introductory language. After all, things getting more complex and difficult is how courses are supposed to go right? The point can be carried out, ad absurdum. But, going in the opposite direction, C++ can do just about anything, whereas Java can't. And also, C++ is far my widely used, and excepted. If you're going to pick one over the other for teaching beginning Computer Science students, pick C++.
As a student in High School, I learned about binary trees. They were on the AP CS exam, when I took it. I presume they will still be on the AP CS exam, but now in Java? That's nuts. My point is that, if you're going to pick ONE LANGUAGE to teach beginning Computer Scientists, it should be C/C++, not Java.
Huffman and ZIP are different. I did code a Huffman compressor in my Computer Science courses, and we did it in C. Doing the same thing in Java would be nightmarish. Unless you cheated, and used the Java class libraries to take care of the hard stuff! That's my point - they should be able to do it from scratch. Otherwise, why make them do it at all?
So, all of the things you're proposing to teach them, I can teach them in C++. Easily. But you can't easily teach them memory management, pointers, many data structures, operating systems, and a lot of fundamental Networking. And I can even teach them to code a real Operating System, a real Database, a real First-Person Shooter video game, and device drivers. These are valuable things to be able to teach!
Java is great. But C++ is better, if you're only going to choose ONE language to teach beginning Computer Scientists.
Education is the silver bullet.
Yes, several methods in the same class should pass variables, and they should often be allowed to return more than one value. That way you can write atomic code that is easily used for multiple purposes. You encapsulate the functionality into building blocks that can be used, in many different circumstances. This is a fundamental concept of structured programming.
Using member variables to do all of the communication within a class is akin to using nothing but global variables in a normal program. You can't write re-entrant code, recursive code, or methods that call methods that call methods... You end up with a morass of code that's impossible to maintain. At least, when you're coding a class with any significant size.
C recognizes that often, it's convenient to have one function return more than one value. This is accomplished through explicitly passing by reference - allowing the called method to change the value pointed to, so that the caller can then access that data. In Java, the only way to do that is to use a class - like Vector, or a special-purpose class.
That slows down coding, and doesn't in any way lead to better code, or better OO design. It's merely a hoop that you as the programmer have to jump through.
Back to the whole point of this discussion : most programmers will have to use C and C++ in their professional lives. Java lacks functionality that C and C++ have. Teach beginning Computer Science students in C and C++.
Education is the silver bullet.
It is widely and freely available. Not as much as C or C++. Almost every machine on the planet is capable of running C code. That's not true of Java. And you're never going to write device drivers in Java.
It is being used widely in the industry - again, not as widely as C / C++. Not even close.
I think educational institutions have a responsibility to release students with marketable skills. I agree with this statement, whole-heartedly. Unfortunately, you seem to think that Java programming is a marketable skill. Or at least, you seem to think it's MORE marketable than C/C++. Which is insane. Any reasonably competent C/C++ coder can pick up Java in a heartbeat. The converse is not true. I've seen Java coders who STILL can't figure out how to dispose of memory, basically don't understand the difference between stack and heap, and don't understand pointers well enough to dispose of an element of a linked list.
And Java offers all the needed constructs and is good to teach the OOAD methodology. No, it doesn't. By virtue of using Garbage Collection, it is taking memory management out of the hands of the developer, teaching people to be lazy when it comes to object instantiation and use. Not having pass-by-reference gives people the idea that having class-level variables is a viable option. But the problem is that most simple projects are written in one class, which essentially teaches them to use global variables - which is not good. Lacking pointers is the critical flaw...
It's possible to learn C/C++, with an understanding of Java. But it's far easier to learn Java with an understanding of C/C++.
Most people will end up coding C/C++ for most of their work. Teach them to use the language that they'll end up using. Specifically because it's easy for them to then learn Java. Whereas if you taught them Java, it's not as easy for them to then learn C/C++.
Education is the silver bullet.
Most people do not need assembly. It is an important fundamental, and it should be a part of every CS major's education, but it is not a requirement for understanding how to program in a high-level, abstract language. (It may be a requirement for writing good C code, however.) In fact, very many computer scientists hardly ever program. Programming fundamentals should be about the foundations of programming, not about the implementation on hardware.
My school now uses Java for its introductory classes. Since I TA'd these classes in both the C++ and Java versions, I think I can speak with a little authority. Java is a good language to use for introductory programming/algorithms.
The class particularly in question is called "Data Structures and Algorithms". In my experience, the students who took this course in Java had a much smoother experience than those who took it in C++ the year earlier. Programs crashed mysteriously less often, they didn't have to deal with memory leaks, they had less compatibility problems, and were able to write more sophisticated and interesting programs in the same amount of time. Since Java is simpler, we were actually able to teach almost everything in the language to them, where for C++ we had to leave out a significant amount of its core (such as templates, which meant that they couldn't really understand the string class, for instance).
All of the CS majors took "Systems programming" the next semester, which is a hard-core C programming class; most go on to take Operating Systems, in which they learn anything you'd hope they'd learn by struggling with C or C++ in the intro class. I agree totally that systems programming should be a significant part of any CS program. But systems programming is just *a part* of computer science (in the Slashdot/Linux crowd, perhaps it is the most popular). And in truth, things like manual memory management and hardware access are not important in most of the other parts of CS. For teaching algorithms and data structures, these things are a hindrance.
Personally, I'm waiting patiently for the day when only the most low-level software (a microkernel and hardware drivers) are written in C or assembly, with all of my applications written in a safe, GC language (perhaps Java, though there are better alternatives). It sure will be nice to be free from buffer overflows and memory leaks, finally! So while my recommendation of Java here is partially influenced by that goal, I think it is also quite justified for pragmatic reasons.
Here are some reasons why you are bad (I have TA'd 7 CS classes at my university, so I am not just pulling this out of my ass):
- Many people who will not be getting a degree in Computer Science (but who might interact with programmers or write some MS Access scripts) take introductory programming classes. It is important to have these people learn the fundamentals of programming rather than their actual implementation -- assembly will be practically useless to them unless they take the time to take compilers, operating systems, etc...
- Assemblers (and I might even stick C in this category, if I was feeling snappy) do not support the abstraction and generic programming features important for writing interesting programs. (Except systems stuff.) Introductory programming classes typically focus on data structures and algorithms; if you make the students program these in assembly, you are limiting the amount of material you can cover (and therefore, how much they can learn).
- Assembly as an introductory language is going to scare people away from computer science. Systems programming is pretty fun, but it's not for everyone. Many computer scientists hardly ever program (let alone in assembler), and I would wager that most professional programmers do not need to write in assembly language. Assembly is a great enhancement to a programmer's (or scientist's) knowledge of computers, but understanding it is not a requirement for programming in high-level languages.
- The world will be a better place (fewer buffer overflows (thus security holes) and memory leaks, more portable software and code reuse, and shorter development cycles) if we encourage new students to move towards high-level, abstract languages. I'm not saying Java is the best choice for this (though it may be the most practical), but assembly certainly isn't.
...of good programming.
My college is now in the experimental transition from C++ to Java. Personally, from what I've seen as a consultant at the college, all it does is make programmers sloppier code writers.
The problem I've seen with rookie C++ writers is that they fail to grasp what's going on inside with the CPU and the memory processing the program.
My fav beginners language: assembly. People who learn assembly learn about what jumps and loops do, how registers, memory, and IO ports are used, and how to be clean at using memory.
Our final program was one that used the clocks T0 and T2 to program the speaker to play line of music read from a file. Sure, you can do the same with C, but rather than using libraries, everyone got to see how things got moved in and out of the IO registers, as well as how to use them to manipulate PC hardware.
As a bonus, we then got a chance to toast our Interupt tables at the end of the semester. Sometimes, trashing a machine is the best way to figure out how it works!
Assembly gives everyone the chance to not only work with hardware directly, but also how to make your code more efficient on CPU cycles and on memory block management (because you have to manage it directly, rather than leaving that up to the compiler).
is straight and narrow.
It should come as no suprise that someone familiar only with Java should *fall on their faces* at pointers and memory leaks. These things don't exist in Java unless your building a VM. The idea that the *right way* to program means running afoul of these creatures is just polemic.
I feel about the C's the way I feel about Windows, I could spend time trying to master it, but world+dog has a 10 year headstart. And BTW, I've been writing Java for two years and have yet to build a GUI anything. Instructors relying on toy projects and libraries are lazy instructors and not valid arguments viz the language.
illegitimii non ingravare
You have to keep it simple-- whatever rout you go, you should make sure that the peripheral knowledge required is minimal to non-existant. No fair making people learn make in order to learn C. And no fair making them slog through all this crap about classes, public, static, void, and main just to write "Hello World" to the screen. Interpreted languages have the advantage of not needing a compiler, and pure procedural language skip all the OO stuff that you can cover later. (Though I believe in a move to OO once students have the basics down.) Scheme is lovely for these reasons, but anything that allows students to quickly get the matter of the lesson is fine.
The main thing is that generic concepts are stressed. It's useless to learn how to build an interpreter in Scheme if you don't see how the same thing could be expressed in Java, or C++, or whatever. It's far more valuable to start seeing all languages as data structures than it is to just build a parser. Once you see that, building an interpreter for any language, in any language is possible.
What I'm saying here is that starting from a high-level language, stressing high-level concepts, really is the Right Way to Do It. I've tutored students for several years, and I've always found that when you show them the big picture first, and keep it in mind when talking about the details, the light goes on much faster, and they remember more the next time.
<cheap shot> Then again, that's just my first-hand experience and carefully-honed intuition talking. Starting with pointers, memory management and big-endianness might be the way to go after all. </cheap shot>
-Froggy
IMO: :-)
Python = Ruby - some_neat_feature - 0.2*perl
Python is easier than ruby for newbies because it misses some of the 'perlism' of ruby (like $_ and company, assignment returning values, etc... ). Also, the iterator syntax strikes me as particularly unintuitive, if powerful.
Ciao
----
FB
I guess id depends on what you want to teach. If you want to teach algorithms, or give a programming tool for non-programmers, Python is fine. If you want to teach OOP programming, maybe is better start with Java
And if you want to teach how computer works, nothing beats C, the portable assembler.
Ciao
----
FB
(disclaimer: I am a professional Java developer)
/.er has the slightest comprehension of what's out in the "real world" -- Java's not useful for "the real world"?!? Does anybody actually realize how much server-side Java code is out there?
Seriously, you're asking *Slashdot*, which rather by definition contains a ridiculous number of C & Linux zealots, whether Java is an ideal teaching language?
That's a lot like conducting a poll of Bush's popularity at the Democratic Party Headquarters.
Judging from most the comments above, I don't think the average
Arguments about its utility as a teaching language are fine, but anyone claiming you can't get a job with Java skills hasn't taken a peek at the want ads lately.
ZFS: because love is never having to say fsck
Java, in my humble opinion, is not a good core learning language for computer science. Lisp (or Scheme, as used at my school) is a good choice. As a language to teach object oriented programming, it's not bad. Neither is C++, or several other languages.
I never took the AP computer science course (my high school didn't have AP classes). If the goal is to teach computer science, then I think Java is a bad choice. I would argue that you could design a high school introductory computer science course that could be done entirely with paper and pencil.
The problem is the computer science/programming confusion. Teachers, parents, and kids think that they want to learn programming. They demand that the courses use current programming languages so that they're not "wasting their time" with something like BASIC. They don't understand (and, perhaps, don't care) that they're not learning computer science, just a single programming language.
I have been arguing for the past 3 years (when my University had switched from C++ to Java) that it was a bad idea.
From a theoretical standpoint, Java skips two important features. First, it does not have (traditional C) pointers. Learning a linked list in Java (if you actually learn one instead of using a library) lacks the effectiveness of learning a linked list in C/C++. Along the same lines, becuase of its garbage collection, Java teaches first time programmers to be lazy with their objects. I saw countless programmers who cut their teeth on Java fall flat on their faces later on when faced with C++, with its pointers, segmentations faults, loss of memory, etc. you are much better off learning the right way before being able to take shortcuts.
I have also notice some disturbing trends with the way Java is used to teach. When I took classes in C++, our projects were Comptuer Science oriented, such as simulating a rudimentary telephone switching system. Many of the first year Java assignments I have seen take "advantage" of Java's graphical features, and involve clocks, scrolling text, etc. Instructors seem to lose sight of the real Computer Science oriented projects that present themselves when the only easily availible interfaces are file and text.
So I heartly say that Universities (and High Schools) should teach C++. And students learning Java now should do themselves a favor and learn C++ on their own.
_sig_ is away
WOW!! I wish that I could have seen one of those. A 25 millihertz processor! My analog watch can calculate 1+1 faster than that thing.
A goof like that really is just asking for some snide remark...
-dB
"It if was easy to do, we'd find someone cheaper than you to do it."
C++ has two big problems. One is cruft, and the other is memory management.
C++ has a long legacy. Too long. Not only is there the legacy of C, there's the legacy of early C++. Templates, exceptions, and references came in late. It shows. There are too many things that are done the way they are only for historical reasons.
C++ and C program design obsesses on memory management, because what you take, you must give back. The language provides little assistance with this. That's not what beginning programmers need to focus on.
C++ needs a major cleanup. I've been toying with a design for "strict mode" for C++, comparable to "use strict" in Perl, which would get rid of much of the cruft. C++ comes out of the 5-year ISO standardization freeze soon, so it's time to be thinking about this. But that's for the future.
If you *must know how a computer works at a fundamental level*, then assembler isn't it. I had a microcode class that really helped me to understand about assembler optimization. You can make the argument that you can't really understand level N unless you understand level N-1, recursively all the way to quantum physics.
Or why not start at the other end of the abstraction stack? Start with cognitive pyschology, perception, human-computer interaction, and the identification of human needs -- then you figure out an approach that best meets people's needs, which would lead to how to choose the right software tools and approach for any particular case.
For a CS class, I wouldn't start at either extreme. Choosing the right level of abstraction is important, and the answer isn't just automatically one below what the other guy suggests.
I think CS classes should start by making it clear that the point of it all is to create useful stuff for real people. Teach them what they need to know to get started ASAP doing so, and fill in the details with later classes.
"Those who have never entered upon scientific pursuits know not a tithe of the poetry by which they are surrounded."
First we're taught basic programming. CS5 is the intro class, intended for majors and nonmajors alike. It was taught in C++ when I took it a couple years ago, and now it's taught in Java. The idea is that it's an INTRO class, so you want a language that is fairly simple to learn and to use. Java is absolutely more simple than C++, you can all go and argue why to yourselves.
The next class (for majors) is CS18. CS18 is taught in a language called Dylan, which is a Lisp-like language. Dylan is fully object oriented, and has a consistent syntax. Dylan is used because it is scientifically interesting. Ignoring the fact that it is generally interpreted inside an aweful Java applet (NOODLE), it's an OK lanugage. Most notably, the class centered on teaching the students exactly what OO means and how to use it: my prof, for instance, told us all about how Java was broken from the beginning because functions aren't objects like they are in Dylan, among other things. Dylan was a fine language for this use. At the end of the course we were able to write most of a Dylan interpreter in Dylan. THAT was an interesting excercise.
One of the next classes, CS37, was taught in MIPS assembler. CS37 was a hardware class, so assembler was appropriate. Some comments have suggested assembler as an intro language, and I gag at the thought. Having a deep-down appreciation of the low levels of computing can be learned after the spark or interest has developed in a young computer scientist. If I had to write loops using JUMP and GOTO in the intro class, I might have been a (gasp!) English major.
Dartmouth's Networking class (for CS people, not for business people :) is taught using Java. That's really nice, because with the pleasant abstractions provided by Java's class heirarchy a student can get down and write a neat-o little program and not worry about Socket implementations.
I love Java now that I've learned it, and I really back it's use in intro classes. CLEARLY, Java should not be the only language used. If I were to graduate from college not knowing Java, C, C++, some form of Lisp, some form of assembler, and a few scripting languages, I wouldn't consider myself educated in the field. Dartmouth's problem is its nonuse of Perl or other such languages (I've had to learn a couple on my own). I love perl... but that's another comment altogether.
MyopicProwls
MyopicProwls
My homepage
It's what MIT teaches it's kids first. If MIT does it, does it make sense to follow suit?
Peace,
Amit
ICQ 77863057
[o]_O
Computer Science is not about the language being used. Computer Science is about the problems being solved. Yes, sometimes solving the problem involves writing a new language. As much as I dislike Java and C++ as languages, they can still be used to teach basic CS concepts without incident.
Computer Science is not about being as close to the machine as possible. That's largely branched off into Electrical and Computer Engineering. You can learn about the theoretic basis of CS using assembly, but it won't really get you anything over other languages other than a headache and a better understanding of ECE. It's still CS, but not magically "more" CS because you're working closer to machine level.
I learned the basics of Computer Science (not just "programming") in college using C and C++. I really don't like to actually have to use C, even though I think it's a nice language theoretically. I abhor C++. Java is annoying as hell, but I'd much rather do app-level coding in it any day over C++.
You can learn linked lists, hash tables, recursion, and everything else is almost any language. It makes a lot more sense and can be easier to teach CS concepts in some languages, but you can do OO, procedural or functional programming in most any language, it just may be a lot more work.
Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
I was 13 when I learned my first programming language - BASIC. I did not have a computer, so I wrote simple programs on paper and later copied the programs into Atari 600 that I found in our school. At 15 I was learning Pascal and Turbo Pascal in my college. At 16, when I bought my first IBM compatible PC, I continued Pascal and started learning Assembler. About a year later, I started C and by 20 I was programming in C++ as well. I started Java in 1997 doing a project for AT&T Canada, and now I am going to tell you the following: :) )
Programming a computer should start from understanding logic and learning to express logic statements. In fact, the hardware should not matter for the first year of programming. Once you understand the logic well, then it makes sence to learn about the internals of your computer. Of-course this is debatable - I did not have a computer when I started, so all I could do was programming logic, not hardware. Later, when I got to the hardware, I was really interested to see my logic work. However I also became aware of things that are happening inside my machine. The hardware aspect came alone naturally as extension of my self training once I found out that logic is not everything in programming. I was building my first games and realized that the graphics libraries provided by Borland (such as egavga.bgi) are not fast enough and do not do everything I want. So I learned the memory management and video memory management for the 86/87 architecture and learned Assembler on the way to build my own graphic libraries.
Later came the object oriented approach, when I found out that I could not do GUI well in functional programming. I had such problems to solve as event handling, menu call-backs and AI for my games. So I learned that Turbo Pascal 7 (if I am not mistaken) handles these better by allowing real objects and event handling. Of-course C++ proved to be way more powerful (BTW at UofT - University of Toronto the first OO language they taught to us in 1996 was OOT - object oriented Turin
It seems to me that learning programming should be more intuitive and should be coming from the problems that need to be solved.
You can't handle the truth.
"...Should we start by teaching an easier, higher level language (ie Java) to get programming concepts down, then move to lower level "closer to the machine" language for advanced topics, or should we start with the lower level language and then treat additional languages as extras?...Personally I think the first option is the more viable..."
Now you're thinking like I'm thinking. If a small child were to ask about a car, would you explain its general use and major parts or would you immediately cover the finer points of the internal combustion engine? While it may be important to know about the internal workings of a car, these things are best introduced after a good general introduction.
I remember the first programming course I took in high school, and I hated it. There was a period where I fiddled around with my calculator, and I thought that programming would be fun to learn, so I signed up for a course in C. The person teaching the class was a originally a FORTRAN programmer, but had learned C on his own. He was so bogged down in the details of the language that he completely lost most of the class. Here I was wanting to be able to write simple little question-and-answer games, and this guy was covering the finer points of binary representation and overflow, right from the get-go. Needless to say, I bailed after the first semester, taking my barely-passing grade with me.
If we're talking about a good starting point for programming, it's usually the same answer as in other disciplines: start simple. Show some of the easy capabilities, and then peel back a layer, so to speak, to show what goes on under the hood. If you start under the hood, they're not going to appreciate it, because they never saw the big picture in the first place.
You can download Forte from java.sun.com, after registering. The "community edition" is free.
I've been running it on Debian potato, and it is far better than any java I've used to date.
Two gui's later, several hours of use, not a single crash.
The performance, as always, is the tough pill to swallow. But the component design and robustness are great for learners.
Treatment, not tyranny. End the drug war and free our American POWs.
Treatment, not tyranny. End the drug war and free our American POWs.
See my user info for links.
There are NOT that many people who will use Java, in their professional lives©
There are currently 5 Million java developers worldwide© Java is the main language used for eCommerce© Do you want your web site to leak memory?
Applets are a pain in the ass, because every browser / version on the planet behaves differently©
©©©and this is Java's fault? That's the browser's fault that java behaves differently, not the language© By the way, Mozilla's applet support is pretty nice© This brings up another problem: Applets are hardly used anymore© Java was clearly a failure in this area ¥because of buggy browser support so it's focus has been running eCommerce and enterprise wide applications©
Memory management© Real, professional programmers need to know how to manage memory, both in RAM, and on a physical medium©
Maybe, but when dealing with eCommerce or enterprise apps, additional hardware ¥to compensate for GC is still cheaper than programming time© I'm sure assembly programmers complained that C didn't give access to the registers and that activation records take too long to create©
Passing by reference© In order to pass values by reference in Java,
You obviously have no idea how java works© Changing values passed into a method is not OO practice, and should be discouraged©
And since your entire Java code is likely to be in one class
Oh no©©© Please don't code anywhere near my app© I hope all your C code isn't in one file©
Why are there integer and Integer? double and Double?
to avoid something like this:
Java is not pure Object Oriented
©©©and C++ is? You can write completely not OO c++© Try making one java program without defining at least one class©
HAVE TO use them both just shows that it's a horrible class library
Oh yeah, you have ints, and that negates all of the other objects in the class library©©© Come on© Java has one of the most useful class libraries of any language© Let's say the fact that you have to use ints might be a little sloppy© Dont' negate the class library though© It also saves you from oh, overriding the shift operator to become an io operator ¥"<<" a la C++©
is NOT cross-platform
I've had no problems developing in Linux and moving my executables to solaris or NT©
Some versions of Java crash when you ASK THEM WHAT VERSION THEY ARE!!!
This is a low blow© In RedHat 7©0, the vm was broken due to the new C libraries© RedHat shipped the wrong VM, yet it's somehow the language's fault that it didn't dynamically re-compile itself©
Java is a very nice, high-level language; while it may not be suitable for beginners, it provides a lot of things that make it useful to people who want to get things done in business©
"This is not a company that appears to be bothered by ethical boundaries."
Attorney General Mike Hatch on Microsoft
Ok... let's all calm down here. You stated repeatedly that you started out in BASIC then to PASCAL...etc. Your code snippets show that. Your function getNameAndAge(&name,&age) demonstrates poor cohesion (cohesion is the amount a method or object makes sense). Why should name and age be tied together? You could just have easily called it GetNameAndAgeAndAddressAndZipAndState(&name,&age,& address,&zip,&state);
Where do you stop?
You should have a Person object with accessor and mutator (get and set) methods for all its class-level variables.
I actually had to change some of my code, when switching Java Servlets from platform to platform - Vector.add doesn't work in Tomcat, apparently... It's Vector.addElement
You were developing on a 1.2 virtual machine and moved it to a 1.1 virtual machine.
Other than this, you make some sense. However, I think your argument is fundamentally flawed. Universities teach Computer Science, and they will continue to do so. You want them to teach raw programming, and I believe they would be derelict in their duties if they did. My computer science education taught me how to "Program". They taught me the fundamental concepts that most programming languages share. These concepts won't change for a long time. The language they use might, but the concepts stay constant. I learned pascal,modula-2, SPARC assembler, C, C++ and Java. I believe that if you want to train a bunch of Coders in a Trade School type setting, then by all means, teach C or C++. If you want to teach concepts of OO in a University, use Java. That way, the student can learn about encapsulation without fighting memory management and pointers. A University should also offer courses about memory management and lower level things, but Beginning students should not be exposed to that.
"This is not a company that appears to be bothered by ethical boundaries."
Attorney General Mike Hatch on Microsoft
I agree that C is good as a first language, for exactly the reasons you stated. However, for an *object oriented* language, I believe LPC is an excelent layout, and really gives coders the "feel" of objects. C++ and Java really fail in their use of objects, in comparison.
;)
As to your term "garbage spewing", well, this obviously shows you have never used LPC. LPC actually is generally very memory-streamlined (since big muds have sooo much text and code to load at any given time). Garbage collection is left to the library - most libraries do object-level garbage collection, but not all, and it is quite simple to disable.
Using terms like "garbage spewing" also convey just the opposite feel of the language. It is *incredibly* coder friendly (thus, making it not a good choice for a first language, but a good choice for a first object-oriented language). It... quite simply, lets you do what you want to do, without making you do time-consuming workarounds. Think of the amount of time it would take to, in C++ or Java, do a switch on arbitrary objects from a handle a string-indexed hash table. In LPC, its one line of code
- Rei
P.S. - anyone know of a project to extend LPC to be a full-featured development environment? I.e., be able to attach a *graphical* description to each object, and to be able to handle visual input and output?
You know when it's okay to shout fire in a crowded theatre? When it's on fire.
Ah, I apologize too :) I didn't realize it was a technical term (I've never programmed in Perl, though I've been meaning to learn it). Glad we cleared this up :)
:)
I still feel that, for a first OOP language, its ok to be nice to the coder. They've already learned your basic language syntaxes, all of the little early "gotcha!"'s. Object "gotcha"'s differ with each language, as a general rule; in my experience, there weren't too many things you have to learn to deal with (such as '=' vs '==', pointers, threads, etc) that were the same across different object-based languages. So, I feel its ok to be nice to a coder for their first OOP course, so they can get the understanding of how to set up the interactions in a nice object-oriented design. But, its just my feeling
- Rei
P.S. - I've never used Lisp before, but I've used scheme, and I've heard they're similar. How close are they?
You know when it's okay to shout fire in a crowded theatre? When it's on fire.
That's not a switch. And its a lot more code.
- Rei
You know when it's okay to shout fire in a crowded theatre? When it's on fire.
Of all of the languages I have ever had the pleasure of using, none had such a beautiful object-oriented design philosophy as LPC (nor was as fun!).
;) ). For example, strings are basic types. You can do a switch statement on a string, and have string cases. You can do a switch statement on an object. You can use a 'mixed' variable type. A mixed could look like this:
;) And, with the power of the language, you could have incredibly adept functional elements at the same time as the interactive visual elements.
;) ). Then, I'd clone an object into their inventory which would prevent them from acting at all (or, perhaps, leave them the ability to scream or something, perhaps even changing their words ;) ) (ahhh, word filters were fun ;) ). I had my Star Wars dest, dests that were parodies of other people's dests... I always liked Blizzard's "Pulp Fiction" dest, though ;) Oy, that place was fun. Sometimes when I was bored, I'd destroy the main posting board, set myself to look like it ("7th Sign Wizard's Main Board says: What are you looking at?"). heheheeee..
For those unfamiliar with LPC, it was initially designed for use in MUDs - as such, it is missing many of the non-text interface and output features needed for a full featured modern language. However, what it had was so beautiful. There was one type of object variable - object. All objects can talk to each other, call whatever functions they want on each other, etc, just by obname->do_something(). You can even call functions on not-yet-loaded objects, by doing things like ("path/filename")->do_something(). You can call functions like FindObject to get the objects of a certain type. You can run through a list of all objects. Etc.
LPC is based on the principle of letting the programmer do whatever they want (I know, some people don't like this
mixed blee = { some_int, some_string, { some object, {some_object, some_bool }, some_float pointer, some_object }, some_object pointer };
It basicly acts as a struct you don't have to declare in advance (of course, you can still use structs to your heart's content). So, for example, if you just wanted to store a complex value, you could use a mixed of { some_double, some_other_double }, at any time.
Then, there's mappings. Mappings are a built in, arbitrary-formatted hash table that is an internal datatype. For example, you could have (and I may not be remembering the format exactly):
mapping blee = [ "foo" : 1.5, "bar" : 8.2 ];
Etc. (naturally, you can use mixeds, objects, whatever, as your indexes and values.
Most LPC libraries are designed to give objects a (text-based) visual representation. You give them a name, a description, a short description, etc. Objects are created in a virtual environment, and you can see them - hold them, place them inside other objects, etc. An object can talk to its environment (what it is inside), or anything in its inventory. A coder can manually call functions on various objects, or set up interface elements for them to be called at any time, not nessisarily by a coder. This visual environment, and "existance" within the code, leads for incredibly fun code wars, like you wouldn't believe
For example, I was the loki-type character coding on a mud once. At one point, I had fun by calling functions that would change the name of people's character-objects around, so that they'd be confused when talking to each other. Naturally, they'd seek retribution and fire off a dest, once they found out it was me (a 'dest' is a piece of code that artfully kicks someone off the mud). But, once I got to know other people's dests, I set up protective objects which would fire off counter-dests when I saw their dests start to go off. So, instant dests started becoming popular. So, I set up objects which propogated themselves into other coders's inventories and would filter out their commands. Instead of instant dests, to maintain artfullness while still preventing them from counter-desting, my dests first cleaned out their inventory and the inventory of the object (room) they were in, to wipe out all local protective objects (sometimes they'd mess with global commands, but well, if they did that they deserved to win
Ok, sorry, I got sidetracked. But... LPC is a fun language, and has the best object-oriented design I've ever dealt with. Its a good language "for love of the code".
- Rei
You know when it's okay to shout fire in a crowded theatre? When it's on fire.
With C, being so close to the hardware, it is often easy to see which calls waste the most time. It is easy to see where memory is allocated and deallocated. It is easy to find "beginner" mistakes.
if (x=5)
always seems to execute. WHY? These things allow students to make a mistake that can be learned from. A student should NEVER learn Perl as a first langauge. Why? Because even the shittiest of code seems to "do what it should." That is no way to learn the basics. CS courses are not designed to teach one language and then send students off into the work force. Chosing a language like Java seems to support that mentality, though. What happens when a CS student who learned on Java tries to get a job programming C on embedded systems? There are many pressing reasons to learn Java, C++, and Perl at some point durring the CS curriculum, but why start with one of those and then drop down to the less expressive languages like 68K assembly and C?
I see the reason not to start with something like 68K assembly: too frusterating for a first langauge. But C has some wonderful compiler warnings (assignment in a comparison statement generated compiler warnings when I was taking a C class) and syntax rules that are easy to fix and not too forgiving as to teach bad programming habits.
Besides, there is a lot of history and lore to be learned when taking entry level CS courses, and Java just doesn't have the history behind it to make it for those purposes. No "and this was the logical error that caused a whole sewage processing plant to shut down. So remember those break statements."
Network Security: It always comes down to a big guy with a gun.
WHich language you use is totally irrelevant. Teaching programming using Java or C++ of Visual Basic, it's all the same. If you don't understand that the language is not teaching you how to program, but the teacher, you'll also not understand that the question if Java or C/C++ should be the language of choice is irrelevant and in fact, stupid. Yeah, stupid, since asking that question shows you don't understand what programming really is...
--
Never underestimate the relief of true separation of Religion and State.
I'm thinking +1 Unconventional. The parent of this post certainly shouldn't have been moderated Funny.
For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
I think that the question of what language to use in an introductory course depends critically on who you expect to be teaching. A lot of people here are suggesting that the first language taught should be a comparatively low level language in order to introduce students to low level concepts as early as possible.
That's great if you're primarily interested in teaching computer scientists, but that's not necessarily the case. Many people- and I might even venture to suggest that it's the vast majority- of people who want/need to learn prgramming concepts are not going into a pure computing career. Instead they're going into business, the sciences, or the arts and need to learn enough programming that they are not completely dependent on CS professionals to get their jobs done. There's a real need for an introductory programming course for non-CS students that teaches very basic programming concepts- data structures, algorithms, etc. Languages like Java, Python, and the like are very appropriate for that sort of introductory class specifically because they do free the programmer from worrying about low level functions so that they can focus on high level concepts.
There's no point in questioning authority if you aren't going to listen to the answers.
However, we should look at a few requirements for a good teaching language:
Programming is hard! A teaching language should not be unnecessary difficult. This, IMHO pretty much rules out C++ and Perl. Not that those languages doesn't have their place in the real world (they certainly do), but their complexity distracts from the purpose of learning to program well first. It should be simple to make a simple program to experiment with ideas (hello world line count is not such a bad measure). A top-level interactive loop helps this further, but equally good is a fast compiler and a good development environment. Languages that are simple to learn would at least include Pascal and it's cousins, most scripting languages, as well as various lisp-dialects
Students want instant gratification. This can mean different things to different people, personally I was instantly gratified when I learnt C and later assembly language. It made me understand more of how the machine really worked, and gave me an opportunity to actually improve on something (e.g. a faster strcpy than the one in libc) without really putting too much effort in it. Programming simple games and animations, usable GUI's and so on is also something than can be very rewarding for a fresh programmer, provided the language facilities for this are easy to use. So put in logo, Visual Basic (I've never really learned the language, but it doesn't seem to be as bad as people will have it), Tcl/Tk, Postscript and others as well.
Good software engineering skills should be taught from the start! Therefore it's important to have a language that supports at least reasonable levels of modularization. Java fits this category well, as does Python, but also many others, such as Common Lisp, Eiffel, Ada, and SmallTalk.
Depending on what direction the students are going in later, it might be a good idea to introduce some advanced concepts early. For the EE direction, more low-level languages might be better, such as Forth, C, or assembler. But eventually, everyone should know something low-level stuff so it could be done by everyone.
For the same reason, Haskell and other functional languages (such as scheme, although it really isn't functional) is popular among CS people The value of choosing a CS-oriented language (most functional and logic-programming languages will do) are that they pave the way for understanding more advanced concepts later, such as term-rewriting, parsing theory, the value of trees, and of course recursion. I would really believe that a student who only knew Haskell would most likely know more about how to build a compiler than one who only knew C, as there are more advanced concepts gained simply by choosing a more CS-directed language.
Market and bragging value is important for ambitious young boys (although perhaps not for girls, who usually accept that they are there in order to learn, and don't think they know more than their professor). I would believe most students would be pretty alienated by finding out that their first programming language is a weird ivory-tower programming language that nobody except in academia uses, and that has little in common with C++ or Java (which their friends uses, and there are ads in the papers for programmers). So unless you really want to limit your audience, your language should be somewhat mainstream.
To summarize, I have tried to tabulate some languages below on various categories from 1 to 6. Note that this is highly subjective, and most people would probably not agree, but at least they summarize how I feel about them. The categories are (in this order): EasyToLearn, InstantGratification, EnginerringSkills, HowItWorks, CS-skills, and Bragging (unfortunately /. doesn't allow tables).
Java: 4 4 6 3 4 6, total: 27
C: 2 5 3 6 1 5, total: 22
C++: 1 2 3 5 6, total: 17
Perl: 1 5 2 1 1 6, total: 16
Haskell: 2 3 6 1 6 1, total: 19
Forth: 3 3 1 6 4 1, total: 18
Postscript: 5 6 1 1 3 3, total: 19
Common Lisp: 4 4 6 2 6 1, total: 23
Scheme: 6 4 4 2 6 1, total: 23
Python: 6 6 6 1 4 4, total: 27
Logo: 6 6 4 1 4 1, total: 20
Pascal (or cousins): 6 4 4 5 3 3, total: 25
SmallTalk: 6 5 6 2 5 3, total: 27
Assembler: 4 3 2 6 2 6, total: 23
Well, I guess the winners are Java, Python and SmallTalk (on the other hand, the differences between all the languages here are so small that all would make good teaching languages, depending on how you weight the factors). Java is a relatively good all-round teaching language whereas most others seems to lack something (a 1 or a 2) in at least one of the "requirements".
I think the question here is this: Should we start by teaching an easier, higher level language (ie Java) to get programming concepts down, then move to lower level "closer to the machine" language for advanced topics, or should we start with the lower level language and then treat additional languages as extras?
Personally I think the first option is the more viable. Java is a fairly easy, very portable language on which students can create fairly elaborate programs somewhat quickly. With the Swing classes, one can create GUI based programs that will run almost anywhere after probably less that a semester of learning. Java has all the necesary pieces of a fully functional OO language, and it spells them out in a very easy to understand way. It also enforces compartmentalization. I remeber as a freshman, one of the most frustratin things about the way CS was taught was that none of the programs we wrote seemed "real". The assignments were written to develop skills in algorithm analysis and to point out uses of specific structures, but they always looked like a home work assignment, not a useful piece of software. With Java (or hell, even an interpruted language, like Perl or Python) I think the same skills could have been taught while allowing for more... err.. Satisfying .. assignments.
Once the basics of programmiing and software development were learned (and I don't know about anyone else, but my Uni spent most of the first year, and a chunck of the second on these skills. learning "how the computer works at the lowest level" was Sophmore and above classes) C would certainly be appropriate to tech as a lower level "how the machine thinks" langauge. Our low level systems classes were taught in Vax assembler (I never actually learned C in collage, we used Pascal as the teaching langauge, them SmallTalk and assembler in later classes), and I'd have found C both easier and more useful in "real life".
I don't need a million points of light, just two points of multi-mode fiber and a 10 Gig-E router.
- Java can be used on the web (ooh ahh).
- It is object oriented, even if clunky and weird
- More "user friendly", but many people would debate if thats a good thing, I mean Unix isn't exactly user friendly.
Anyway we then go on to take C++ on the next course, and use that in most classes down the line. So people who just take the intro can get a nice feel of applets and coding in a fairly simple, if weak, programming language. Now I dont really agree with the industry standard of using C++, and I wish that a functional programming language was a required course, but many people seem to like C++. (let me just say that its syntax can be quite frustrating at times, I mean how many different ways can you use the ampersand?) anyway thats just my two cents.I agree completely. I've long thought that Smalltalk should be the first computer language taught for three reasons:
1. It's a very clean and succinct language that allows developers to focus on core design issues, not idiosyncratic implementation ones.
2. The Smalltalk environment (class hierarchy & GUI framework) is a wealth of terrific design patterns that are used in most other GUI frameworks. Practically every good idea in other frameworks (Swing, JGL, Collections API, etc) comes straight from the Smalltalk environment.
3. It makes you use OO & design patterns. There's no way around it in Smalltalk. The flexibility of the environment (incremental compiles) fosters the habit of constant refactoring, which is extremely valuable.
As for the comment above about using C so that beginners become aware of hardware issures, I strongly, strongly disagree. I'd much rather have a developer who can think in objects from the get-go, who has the discipline to constantly refactor specific classes into a generally useable ones, who uses design patterns. In my experience, developers who focus primarily on issues like optimizing memory tend to cloud up the code and lose the "design forest" for the trees.
Another question is: is Smalltalk too advanced for a college freshman? I don't think so, unless the college freshman spent his high school years coding in C or VB. The largest part of the Smalltalk learning curve is *unlearning* the procedural mindset.
I think Scheme is a wonderful general-purpose language. I also think it's great for learning. It's abstract, flexible, and powerful. As for not using it on the job... well, I've used it once or twice for "serious work". :) Then again, I've got a bit of leeway in some areas of my work. These days, however, trendy languages that are likely to be used by employers are the languages that are taught in class.
N4st0r, trixx0r h0bb1tz0rz! Th3y st0l3 0ur pr3c10uzz!
Scheme and Lisp support macros, but they're a bit different than the C preprocessor. A macro in a Lispy language is an expression that gets evaluated, and the result is an expression that gets evaluated again to give your final answer. It's quite powerful, actually, as it allows you to extend the language inline.
Lisp and Scheme are not really heavy wizardry, unlike hacking DSPs on the bare metal. It requires a different, abstract mode of thought, almost like that of an artist. (Please, no K5-esque "code-is-art" debates). Once you understand how these languages work, they are literally a snap to use. Students don't get bogged down in syntax because there is no syntax to speak of, except that whatever is in parentheses represents a function and its arguments. The read-eval-print loop enables students to talk to the computer, and see the results of their experimentation immediately. The functional and recursive approach lets you see with crystalline clarity the proper way to analyze the problem you're solving. (This translates well to other languages, by the way, even icky things like Visual Basic.)
In order to learn programming, you need to dig through all the design cruft and really understand the principles behind solving problems with a computer. Once this is done, that knowledge carries over into every programming language out there.
N4st0r, trixx0r h0bb1tz0rz! Th3y st0l3 0ur pr3c10uzz!
--I decided around Java 1.0 that I was going to learn to program with Java.
--I bought some books and began failing miserably almost immediately. In one of the books it said something like "If you know Visual Basic, you'll get this."
--Back to the book store I went got some VB5 books and did fairly well with them. Then I started reading about this wonderful thing called Perl. I still have Learn to program Java in 24 seconds and Mastering Java and both look like new.
--I would recommend Python or for the brave at heart Perl as a 1st language. But really Python.
---
This
Not that I'm particularly fond of Smalltalk, but it is a simple language to learn, it's well-connected to its development environment (thus, very, very simple to prototype in), and Object-Oriented at its very core. Java, on the other hand, is much too complex and idiosyncratic for placement as a learning language ... ditto C/C++. I think a more straightforward language benefits the student of OOA&D.
Plus, some of the better CS departments (GATech, etc.) seem to agree. Check out Squeak.
What'dya mean there's no BLINK tag!?
Man, I got that thrown at me, too. Don't get me wrong, FORTRAN has it's place (garbage pail, septic tank, the city dump...kidding), but it's just not terribly relevant to modern software development, except as an historical exercise. I was actually stuck with FORTRAN 77 (in about 95) for a grad-level course on Scientific and Numerical programming I was taking from a local university. Talk about USELESS. I've been a professional developer for 10 years, write component-based (COM/CORBA) code in C++, and have absolutely no FORTRAN tools excepting the GNU stuff. How was I supposed to apply this course?!
I suggest closely reviewing the curriculum of any CS school you might attend. It becomes pretty obvious who's real and who's not.
What'dya mean there's no BLINK tag!?
I don't think it serves the needs of students looking to fully understand the internal workings of a computer, which is in my mind what an AP computer science course should be directed towards.
IMHO, then the course isn't Computer Science anymore, it's computer architecture, or computer engineering.
I remember in High School, my first experience in programming was with a basic program for the mac, then we moved on to Pascal, and we covered the concept of a compiler and an actual program executing. The actual AP course was then in Pascal, and it covered (for the most part) pure programming. Language syntax, construction of a program, debugging, and actual results of the program were what was stressed by the AP course.
When I started college (at RIT) our initial exposure to OOP was Eiffel (and I still think it's a decent teaching language, but not overly practical (read: not used too often). Where did that leave us after our freshman year? Unemployed in our field. Not having any practical language experience (read C++, Java) hurt our chances of finding any summer employment with the skill sets we had.
RIT followed up the first year of Eiffel with one quarter of C++ (10 weeks). That was about it for languages directly taught.
RIT has since switched over to Java. Those of us in the last year of Eiffel were kind of jealous because now the freshmen had marketing skills having 30 weeks of training in a demanded language. (Translation: They were more employable than we were.) By the time the department got around to offering a Java course to the upperclassmen, most were ineligible because of the requirement that students had not taken a Software Engineering course, or other course in Java (which most of the upperclassmen had by that time. Also twice offering only one section of it with 25 seats didn't help matters much).
In all, I think Java is a decent teaching language if you can work around the 1: speed issues, 2: IDE issues, 3: building simplified libraries for students to use until they knew what they were doing.
--You will rephrase your request for me to go to hell. Goto statements are not acceptable programming constructs
The University of Wisconsin Madison teaches Java as its introductory Computer Science course (they switched from C++). Interestingly, the UW Oshkosh (a full 4 year school in itself, 1/3 the size of Madison) still teaches C++ as the Introduction to Programming class.
So at least in some schools Java as a CS intro language is not a question, it is reality. It has been for over 3 years (I'm not sure when Madison switched). However, a computer science major still has to take classes in assembly, c++, even Visual Basic to complete his or her degree.
"The universe seems neither benign nor hostile, merely indifferent." --Carl Sagan
when I first started at CS, I was taught a specially designed imperative language, not quite unlike C, but without the hassels of a real-world programming language.
The language implemented only some simple types: int, real, char and string. More advanced type could be constucted as tuples of other types (struct) or choice of other types (union, with tags).
The language prevented accessing a union without branching on the type-tag (a bit like functional style: case e of X(x) => f(x) | Y(y) => g(y).
Funther more, pointers, and recursive types could be created for any of the above types.
The language had only one kind of branching: if, one kind of looping: while.
The language had nested scope of variables and functions, and type-polymorhic code using a construction not wholly unlike C++ templates.
We were taught the sematics of the language in terms of transition theory between states in the computer (well suited for the imperative paradigm).
Fast execution type was not a goal for the language, cleanness of semantics of the availible constructs was.
We were the taught (and given exercises) to implement various programs, and other language constructs, such as: for, switch, recursive types using pointers and other nice stuff, and charged with proving the correct semantics of our solutions (including, of course, loop-induction).
This has given a clean, well defined understanding of programming, which we can "adjust" to any given imperative paradigm we encounter, somewhat like: Oh, the for construct of C is a way to structure loops, their invariants and progression
We were given a lecture in, how the world would have looked if all was nice and pretty, and the means to understand the more "polluted" (i.e. post-increment; i++) semantics and "real-world" languages in terms of well-defined simple building blocks.
This approach has given a very flexible way to understand the exact semantics of other languages, as opposed to knowing, partly how i++ works in C++ and not understanding the full implications of that semantics
Morale: Learn the "pretty-stuff" in the beginning, you want code anything that's work anything the pair of years anyway (that's true, don't kid yourself, you'll do everything much better, cleaner, more efficient a couple of years from now ;)
SLOGEN [ http://ungdomshus.nu : Sebastian cover music]
I just realised I should add something in important. In the lights of concepts like Extreme programming, UML, reafcotring and pattern design concept, Java really does perform a lot better than C++. In fact, Java is itself build on these concepts. It's allready IN the language, whereas C++ just allows for these concepts to happen. This gives Java a much more high level entry point than C++ does. It might be interesting to teach students the high level concepts first and work from there but I think it defeats insights in the historical growth of languages allttogether if Java is the first language people get to get their hands dirty on. Furthermore, I think it's too abstract. You don't feel your registers ticking. Experience on that level IS important, as it aknowledges the theory in practise. You can allmost touch the evidence, whereas a Virtual machine is something you'd have to live with. In that regard, C++ also connects with other courses that deal with how the metal side of the picture works.
Best regards,
Ignace
With great power comes great electricity bills.
We have had the same question discussed. Normally in the first year of the course, we teach students about OO programming concepts using The Oberon language, a wirthian language much like Pascal and Modula-2. The benefit of starting with this language, is that practically no one knows about this one when they start. This levels the field for everybody starting the course. The second benefit is tthat it is fairly similar to Pascal and Modula-2 syntaxes, but allows for concepts like pointers and garbage collection to be explained. Basicly, it as good as any other OO language, but we have satisfactory results in teaching OO with this language. The incredible downside to this language, is that students will never ever use it again. That's the first year, in the second they are taught C++ in a strict Stroustrup way.
Our question has been whether Java would be better. Certainly, as an assistant, I would have said Java all the way 2 years ago, because I just like Java much more than Oberon (and incidently the students do too), but Java really misses out on a lot of key concepts that C++ do have. If Java would ever be taught on our university in C.S., it would replace Oberon, not C++. We consider C++ a difficult but necessary level of experience students should have endured, simply because when they will work in a company 3 years later, the majority will be either in Java or C++. BUT. In the Mathematics and Physics classes, we HAVE switched to Java. To these people, a language is more a tool than a subject on it's own. In fact, we didn't just teach them Java, we gave them a Java environment that allows for allmost functional linear programming, an interpreter which simply translates their code (which looks just like Java code, only everything is purely functional) into 'real' Java. So far, the results are promising. They actually get the concepts of recursion, which, for a mathematics and physics 1s't year class may be easy to get down on paper but harder to get done in reality. This is the first year we're doing this, so we have to consider the end results in a few weeks when exams are over. We have also taught Java to Physics PhD students, with very good results. Most of the programming in Physics labs is now in Java because it delivers faster than C++ and is simply easier to maintain and update.
From personal experience, I think C++ has a few benefits on it's own. First it is a valuable leach that leads into the UNIX world, something most people have never had the chance to experience before. You will simply have to get the UNIX concepts and commands and syntax and phylosophy right before you can say you're able to pull a C++ thing off on a server compiler. Second, I think C++ is obviously valuable once you are done studying. This should not be the major issue here, and we dislike the idea of studying C.S. because it makes good money, but it's a reality nonetheless. Thirdly, C++ has influenced more languages in the 10+ years it exists, and thus makes transition to these languages, including the Java language, easy. Fourth, c++ allmost offers every concept that an OO language should offer, so in the world of paradigma's it's a fantastic example of OO programming. Fifth, the syntax and semantics makes people think mechanically, and the ancient C subset allows for making the distinction between lowlevel and high level programming. Learning how to debug is one of the key elements that C++ offers and needs, and students will benefit from that knowledge. And finally, transitions form C++ to Java are easy, but the opposit transition is incredibly tough, even if you DO know C++. I've made the transitions about 4 times in the last few years, and I can tell you every time I had to switch back to C++ all hell breaks loose again. You simply forget the hard parts because that's what Java is, the 'nice' version without the pitfalls that C++ experienced in it's more or less uncertain growth.
I hope this has some valuable insights for you.
With great power comes great electricity bills.
Tell me how to write this in Java:
void ChangesA(int *a) { *a = 1; }
calling it?
with obvious optimization if you are calling it frequently...
Java primitives are clunky and are IMO a holdover/crutch from C++.
I think one of the biggest problems I see with newbie Java programmers with a C++ background is that they never learned proper OO techniques. So they find clever ways to write procedural programs in Java...
Don't give up on BASIC yet! There's a whole family of BASIC-like programming languages out there. A couple summers ago, I spent some time teaching at computer camp, and we used 'True BASIC' to start kids off. It's a very straight-forward procedural language, and we pretty much just taught the kids variables and basic control structures. (Maybe using functions, if they were really quick).
After that, it wasn't much of a jump at all to move the more advanced kids (who came back from the previous years) up to some basic C++. As a first language, True BASIC teaches very clean habits that serves kids well when they move onto more sophisticated languages. One of the things that works well with younger kids is that you start off working with a GUI. (Drawing lots of squares and circles to make a house, that sort of thing.) Working of a command line is fairly boring for kids when it is their summer vacation.
You'd be surprised how much you can do with the language, actually . When the instructors started competing with each other, some nifty things started happening.
-Cassia
Vericon is coming!
I disagree, assembler is still too high level. What I cut my teeth on and cursed it going through it, but understand now that it was for the better; was good old psuedo code. Exactly what is a "while loop", what are it's parts, where should it be used. Syntax does not matter, methodology does; once one has the proper methods down using/learning Java, C++, Assembler, etc. is fairly easy. I think the first 2 semesters we actually did maybe 10 programs total on a computer; we did a whole lot more on paper using psuedo code (in fact not a single test was done using any computer equipment). As I moved through the courses, I did assembly, heavy duty algorithmic design, project programming theory, built our own pascal compiler with pascal, and even did some coding on a bread board. That gave me a very broad understanding of how a computer works and how best to get it do the things I want/need it do to.
CS students, it seems to me, are getting introduced to programming languages too soon, before they have a firm grasp on actually being able to program properly, not just syntactically correct for whatever language you are using.
Then give them a complex data manipulation program to think about (say, converting a Postscript font to Truetype). Start them thinking about better ways of handling the data.
During this discussion introduce OO concepts and a clean OO language (Smalltalk, say).
Once some progress has been made introduce them to a "real world" OO language like C++ or Java. They'll then have three languages and a grounding in what OO actually helps with as well as what compromises are made between the "ideal" OOL and the ones in use.
Personally, if I need OO I use Forth. That way I can define "OO" to fit the problem. Anything that doesn't need OO I just use Perl, C, or assembler depending on how important speed is.
TWW
"Encyclopedia" is to "Wikipedia" what "Library" is to "Some people at a bus stop"
I think c# would be a very good introductory language for a computer science course, ignoring the Microsoft stigmata and the fact that since it is a new language there are few books/compilers/debugers/teachers out there.
.net language for server side stuff. So you could go get a job after your first semester at college.
1) It has support for many Object oriented Mechanisims.
2) It looks like c/c++/java/javascript so you could move onto them after you completed the c# class.
3) It has automatic garbage collection, but you can work in unsafe mode and have access to pointer arithemetic. So it is nicer than both c++ and java in that respect.
4) It is the Microsoft
If your first program doesn't SEGFAULT are you really learning anything?
There is an important reason for this. Aside from dealing with I/O and memory management it forces you to choose your algorithms carefully and to actually put thought into what you're doing.
A first language should not be a language that tries to abstract detail and make things easy for the programmer. Languages that make things easier for the programmer are great but I'm a strong believer that you should learn to do things the hard way first.
We're getting too many under qualified people in the computing field these days because they were only taugh the latest buzz languages in University or College.
I'm also noticing an increasing amount of programmers who don't even want to learn C/C++ because they learned VB or some other toy language first, and they find it more rewarding because it's easy and they get results faster without giving much thought into what they're doing.
--
Garett
- the needs of the industry (clearly Java/C++/something similar)
- languages that enforce good programming practices and keep simple tasks simple to implement (Python, Lisp, Pascal)
Yes, I listed Pascal as a good language for the latter category. Don't act so shocked.Unfortunately, good teaching languages are often not considered because languages like Java, C, and C++ are in higher industry demand and are therefore more attractive to beginning CS students. What we seem to end up with is students that "know Java" but suffer from poor programming style and techniques.
I have no sig.
"Computer Science is no more about computers than astronomy is about telescopes." - E.W. Dijkstra
that is because the concepts are very uncomfortable! they do not fit very well with many types of programming. object inheritance is a kind of anthropomorphisation of data ("a square is kind of like a triangle but with an extra point"). I look at all the blather that people spout about OO programming, and I look at the actual programs produced, and I think the truth is self evident.
the only problem is that so many people have invested so much rhetoric in the OO concept that they will defend it to the death, despite its manifest failure.
sigh.
Personally, I don't believe that Java is the right way to go in that respect (although there are worse languages: my old comp sci dept started to teach Ada as a first language after I left...). Two main reasons:
My personal choice for a first language to teach would be Limbo, a beautiful language, designed by some of the original designers of C (who've come a long way since then!). Amongst other things, it:
- encourages simple, understandable code. Reuse is through encapsulation rather than inheritance.
- has a powerful set of primitive data-types with natural and useful semantics.
- runs on many platforms under the Inferno OS, e.g. Windows and Linux.
- is completely type-safe (unlike Java)
- has a simple but powerful set of libraries which can be understood, and are useful, in isolation from each other.
The language primitives make it quite feasible to teach different aspects of programming without moving to different languages:- Lisp-style lists are nice for teaching recursion ("car" and "cdr" become the more natural "hd" and "tl")
- Proper by-value strings (unlike Java's) make string handling sinple and natural.
- Interprocess communication is supported in Limbo by first-class channels, enabling threading and concurrency to be explored without constantly struggling against thread primitives and associated pitfalls which belong to the 1970s.
Overall, the syntax is extremely clean, but very expressive (although still recognisably derived from C). It has hardly any "gotchas", and is generally programmed in a simple, direct style, ideal for beginners (and advanced programmers who want to write maintainable code, for that matter). Moreover, it's very sparse on resources.I'd love to teach it as a first language. No more "ahh yes, that array just turned into a pointer because you looked at it funny"... oh happy memories...
I'll state my biases right off the bat: I'm a C++ programmer, and like it because I can do Object Oriented programming, Generic programming, and procedural programming within the same language set. Java does not support templates or generic programming as the term has come to be known, and delving down from OO is pretty tricky.
The question arises though: what are we trying to teach here? If it's a course in computer hardware, teach BASIC (10 PRINT "HELLO WORLD" 20 GOTO 10), then assembly. If it's an algorithms course, teach it in Python, then Java, sure.
But if you're looking for a catch-all language to teach any and all kinds of programming tricks, you can't go wrong with C/C++. Java? Without pointers, it's pretty tricky to teach em as a concept or teach classical linked list programming. I don't think you can embed assembly in it either.
Throwing OTHER languages in as well isn't a bad idea, so that at the end of it you can come out with knowledge of Java, Python, etc. etc. etc. But for a firm grasp of the basics you'd have to go with a C or C++. Any good program worth its salt will teach procedures, object orientation, memory considerations, architectural considerations, generic programming, templatised programming, etc etc etc... I can't see other languages coming close, which could explain C++'s popularity.
--- Jump!! Fire!! Bullet time!! - Lego version of the Matrix
I have an unfortunate bias; I work at a video game middleware company, and we're strictly C++, as is most of the game industry.
My Java is very very very rusty, and I can't responsibly teach it.
My career has been entirely C, C++, and Objective-C. (I've used Python and Perl for a few scripts.) Maybe I'm just weird, but I haven't used JAVA professionally once, and my coworkers and friends haven't either. WEll, they may have, but it just hasn't come to my attention.
People are into Java servlets, but beyond that, I'd be at a loss to say where they are being used; perhaps you could help me out here? I know that our local metro uses Java to display bus schedules, but that's because it was a university project.
If my students got stuck away doing maintenance on 5 year old systems, I don't think they would mind to much; it beats a lot of their current jobs. They'd continue to come to the classes to further learn, and develop their skills, provided that they didn't have to move away. Once they get to a certain level, they feel comfortable teaching themselves and learning on their own, as a few of my students have done. They can keep developing, and get out of the maintenance positions.
One of my students wants to do embedded work; He learns C from me, and teaches himself Ada. I don't think Java will do him too much good. Then again, I don't know much about embedded stuff.
Sure, Python is like this too; I encourage you to check it out.
Here's hello world in Python:
print "Hello, world."
Here's a simple encounter on the python interpreter:
>>> x = 5
>>> x
5
>>> y = 10
>>> y
10
>>> x = y + x
>>> x
15
>>> l = ["hello", "my", "friend"]
>>> l[-1]
'friend'
My students can write whole functions and play with the language with incredible ease. Many walk along in their python interpreters as the lecture progresses in real time.
No compiling, no fiddling, just raw, unadulterated interactive programming.
When my students can just type, interactively:
>>> def foo( bar ):
... print bar*3
...
>>> foo( "Hello!" )
Hello!Hello!Hello!
>>>
...it's a very good thing. It makes everything so easy.
Actually, GoF does describe just why patterns are good, and furthermore gives a rather in depth (if terse) description of just how to couple your classes. Most people skip the entirely crucial beginning of the book ("I already know what OOP is, I don't need to read that") and head straight for the catalog.
How to judge if an OO book is good or not:
Most books go into the "It just feels right" diatribe. Or, they go into the "Reuse, reuse, reuse", as if we could inherit the world (hell, all our programs should just be 5 little lines of modification to some other program, right?). My favorite are the Zen books that talk about how it's a whole new [cosmic] way of thinking.
I put these books in my mental shredder.
Design Patterns is different. It explains rather rigorously (but not mathematically rigorously), supporting it's claims rationally.
If you've read the design patterns book, read it again. The real treasure is not the catalog, but the introductory sections, from which the catalog can be derived.
I'm of the opinion that a student should come out of a CS curriculum knowing at the very least, 6 languages. An example set: a shell language, a little LISP, a little prolog, C, C++, and Python. 10 would be preferable. (Add a couple assembly languages, a little Java, SML-NJ). They don't have to master them; they just need enough to use them and understand what they can do.
Mastery of a language only comes through years of industry use. Mastery is only necessary for, say, 5% of programming tasks, and comes from self-teaching. I do not know any programmers who gained mastery of a language as part of a class. Mastery is self-taught, and mostly learned in industry.
I recommend Python as a primary language.
Now, on to mainstream. One, Python is becoming mainstream. But Two, you can teach someone a mainstream programming language quicker if you first introduce them to Python. In Python, they work out their mistakes with variables, flow control, and functions very quickly. THEN, you can go to C, and they already understand how they work. It's just a matter of syntax, and you're all ready to go with bits and bytes. Even greater savings if you are going to C++.
I've noticed a disturbing trend in the replies; That is, most of them focus on language features.
For example, they say, "Oh, they should use this, because it has good OO," or, "Oh, use [C/ASM], because it's low level, and good programmers know how low level stuff works", or, "Use [C++/Java], because that's what the industry uses", or "Use XYZ because it's got a good set of libraries," etc., etc.,.
These folks have obviously never taught people who haven't programmed before.
These are people who are going to struggle with variables. These are people who can't write a for loop to save their lives. They can't use a function, much less a method.
OOP, pointers, bits&bytes, libraries; None of that matters for at least 3-6 months.
This is why I highly recommend either LOGO or Python as a first language. These are interactive interpreters. You need to be able to say, "X=4", and then say, "what is X?", and then reassign X. You need these basic things.
Once the concepts of variables, loops, and functions are in place, then you can easily map to other languages. I know this because I've taught it. I also know this because I've consoled students crying over their Java homework (quite literally) at the end of the semester, incapable of using a for loop. These are good students.
As programmers, we take a lot for granted.
So forget all this "X features OOP, Y has a good lib, Z is low level," and think: Variables, Flow Control, Functions. The rest will follow naturally after these are ingrained and easily used.
I teach free programming classes in Seattle. Since I teach classes for free, I don't have the economic pressure to teach JAVA or C++. I could write whole articles about the damage that certification programs do to people. Another problem is that people look at the Jobs page, discover that most industry programmers are doing something called "JAVA" or "C++". They open up the university catalog and see, "Learn JAVA in 3 months!!!" ($1500), right next to the A+ certification houses. Since the ads are all over the place, they figure that it must be the way. They take a class, and drop out halfway through. The experienced programmers with CS degrees taking JAVA to learn a new language make the newcomers feel pathetic, and they decide programming isn't for them. If only I could copy the experiences in my mind for y'all... It's really bleak.
College is a different situation. I think the reason the profs teach JAVA is because they actually bought (and contributed to!) the hoop-lah about OOP, in a theoretical rather than economic way.
I teach my students in the following order:
It is with great sadness that I teach my students OOP, as it is over-hyped, and people believe in it religiously and without question. I teach it in order to prepare them for the world that will hire them.
The primary value in OOP, as far as I can tell, is thinking about the data first, and language features supporting polymorphism. Also, the book "Design Patterns" is the most (and quite possibly only) valuable piece of literature from the OOP community. I stress that it doesn't require a particular language or ideology to implement polymorphic behavior, or to think about the data first, or to implement a common pattern. (Device drivers and web servers are great examples of objects exhibiting polymorphism and encapsulation. In Non-OO speak, that's the product of paying attention to coupling and cohesion, which takes us right back to... The Unix Philosophy.)
I teach C so that they see low level stuff, and Python, for reasons to numerous to list. I teach C++ so that they can get hired.
One of the reasons for listing Python: They can start writing programs from day 1, second 1. No fussing with heavy class notations, like Java forces you to. (Just look at Java's hello world.) To believe that new students learn about OOP by using Java is hopelessly naive. Most students I've seen working with Java as a first language struggle with making for loops, while loops, and using variables. (Of course, several students will defend their teacher and difficult learning by give you the rhetoric that OOP is the way, and that Java is great because it's... OOP! You can feel the difference!)
I'm now a junior as a comp sci major, and my school uses Java as an intro langauge for CS majors. Math and engineering/physics students still need C++ and don't care about Java, but the first 2 years of the CS program are almost solely Java. Having aced the course and tutored people on both Java and C++, I think Java is a little easier for them to understand as beginners. Later on, once students are used to programming concepts, they are introduced to perl, c++, sql, and others...
no comment
True, esp. for gui's. (We all know about listener leaks, right?) For other uses, however, such as web-enabled db apps, it can actually make more efficient use of resources -- and Java can remove most of the pain from tasks like session management.
the teaching language be C/C++ - once you know that, you can learn Java, Perl, PHP, etc. with little effort
The problem of using C/C++ for teaching is, a student can get distracted from learning how to program well by the idiomatic syntactical complexities that make C/C++ such a powerful language in the first place. I say, learn Java first, so you understand the classic algorhythms, simple OO, and things like threads. Then, find out what else you can do with C/C++, and others.
True, Java's cross-platform... :*)
Do not forget, Java is not the only cross-platform language -- emacs-lisp is available for many many platforms, and uses such nicities as "byte-compiling", just like Java.
First courses should be about teaching fundamentals, and creating good habits.
Hardly typed, autocleaning languages are therefore not suitable. Modula2, Pascal, C, C++
And I also think a procedural language is better as introductional course than an object oriented one, pretty much for the same reasons.
Schools often seem to take fashionable languages as primary one to increase contacttime with those languages, but since most time in introductionary courses is lost in wrestling with fundamental concepts, I think that is severely overrated, and hinders actually acquiring the actual, supposed to be learned in an introductionary course, basic skills.
Also, in Java, there's no way to pass variables by reference. So, in order to have a method change a value that you pass to it, you have to encapsulate it in a class. Either a custom one, or something like Vector - which is not cleaner. Also, teaching someone to rely on Garbage Collection is insane, it teaches someone to write sloppy code. Java is not a cleaner environment, and it doesn't teach people to write cleaner code.
Obviously you don't understand the language, because your "pass variables by reference" comment is completely inaccurate as shown by this response.
I've seen Java coders who STILL can't figure out how to dispose of memory, basically don't understand the difference between stack and heap, and don't understand pointers well enough to dispose of an element of a linked list.
Secondly, this is exactly the point of high(er) level languages: To eliminate details that are better solved by the machine, or previously by someone else. I've seen C/C++ coders who still can't produce binary output by hand from their source files. They're so stupid they have to use a compiler.
No, it doesn't. By virtue of using Garbage Collection, it is taking memory management out of the hands of the developer, teaching people to be lazy when it comes to object instantiation and use
Garbage Collection is completely unrelated to the concepts of Object Oriented Analysis and Design. Automatic Garbage Collection allows one to focus on solving a problem. Forcing manual garbage collection is a step backwards in any modern language. It's a detail that the machine is better able to deal with, as it should be. Automatic Garbage Collection is a concept that can be applied to many differing programming languages and it is a detriment in none of them.
So, in order to have a method change a value that you pass to it, you have to encapsulate it in a class
Or behavior more commonly known as a side-effect. And also best to be avoided when dealing with Object Oriented Programming. A common mistake of many C/C++ programmers is to get caught in the procedural traps introduced and taught by C and adapt those same concepts, wrongly, into their OO work when using C++. This is probably the reason why you think encapsulating your value in a custom class is a poor decision. Maybe you should study the term encapsulation.
And as for your comments about ease of learning. It may be easier to learn C/C++ (which is the biggest source of problems: C is a procedural language, C++ is not, but the grouping of these two together produces disastrous results), but that ease is because people learn the wrong way to write OO code. Java teaches, or forces, the correct way. After learning the proper way in Java, you'll find that you actually write better OO C++.
Java allows you to solve problems, C++ allows you to solve details. As an employer, I know which one I'd want you to deal with.
I dont see what all the fuss is about.
To answer some of the questions in the article:
> If you were going to structure a curriculum to
> teach Object Oriented concepts, would you teach
> it using Java, C/C++, or something else?
Java. I'd totally forget about C++, mabey throwing it in as a pointer intensive crash course. Learning C++ would be there as a non-compulsory course available Not For Credit ONLY. Any serious programmer MUST know C++, but it is not required for computer scientists. You use the best tool for the job.
> 1) Java is a fine development language,
> and it will help me as a programmer to learn it.
True. You'll think like a programmer, learn OOP. Mabey a few design patterns. All in all, you could be learning Object Pascal and you'd pick up the same programming mindset. Java is more crash resistant so you'll tend to get the coding done faster.
> 2) I'm right. Java is a fad, not worth much
> more than the Windows OS in terms of quality,
> and my CS faculty is doing me a disservice by
> cramming it down my throat.
False. Scientists are not uber computer programmers. They do not care about programming. They want to describe their thoughts in the quickest way possible. Like wise, they have a limited amount of time in which to tutor you in concepts of AI, Image Processing, etc.
> There's a little truth in both the above
> statements.
False.
> The language taught, which has progressed from
> Pascal to (currently) C++ is changing once
> more. Next year will be the last for C++. The
> new language will become Java. My question is,
> realistically:
> Which is the best language for an AP Comp class to learn?
Answer: IT DOESNT MATTER. Who Cares? You have to adapt in the computer world, or you'll be unemployed @ 35-40, or in stuck in some horrid legacy development company that cant find anyone else to do their development.
If you think you're going to leave highschool as a "Master Guru Programmer" and get employed for some ludicrous amount, you're wrong and have a long way to go. (The uber geek is the exception).
You miss the _entire_ point of University & High School. The university system does not care if you come out with no technical skills. Universities do not train students technical skills. (If they do, its probably a cheesy University) Universities are supposed to train your mind to THINK in a manner that will allow you to adapt to change and create change.
Learning java at university does not have the goal to teach you how to program in Java but rather, to get you to "THINK" in a logical method to plan programs and put your thoughts into computational programs. The university doesnt care that you come out with Pascal / C++ / Java. As long as you can program successfully. Ie: You're mind is structured in such a way that programming is natural. (Like driving a car).
Their primary goal is to get you to a point that you can do your Image Processing & Artificial Intelligence assignments. All those advanced 4th year modules are what computer Science is. The first few years in undergrad is getting those less geeky students to THINK and Program.
Once you know how to program in one language, you'll quickly be able to pick up another language. The more languages you learn, the easier it is to learn new languages. This is because PROGRAMMING in different languages use different models in which they describe their language, BUT, there are only a few such models. Most languages are extremely similar, only changing in syntax.
When it comes down to the one person who cares what you know - Your Employer - You'll realise that you'll use the best programming language for the job. That may mean that you'll have to learn something new while employed. If you do not adapt in the computer world, you'll be unemployed at the age of 35 (unless you're either a manager, or a leacturer).
If you're thinking you're wasting your time, you're _so_ wrong. While learning how to program, downtime caused by crashes and pointer problems make learning difficult. Java is definately the perfect educational language. If anything, knowing java will make you a better C++ programmer by enforcing OOP methedologies.
Bonus points if you can program in java and your employer develops in Java. But dont think you can only get away with learning one language. If so, go to www.darwin.org for usefull tips on how others get by this problem.
> C is a language that has been designed to be
> very close to the hardware, and its
> ideosyncracies and power reflect that. Through
> this relationship, C reflects the realities of
> the hardware your programs run on. Memory
> management, low level process and I/O control
> are all things that a computer
> scientist should understand at a very low
> level, to better aid in future programming and
> debugging no matter which language is chosen or
> inflicted upon said scientist.
> In contrast, Java has been designed to take
> such concerns away from the programmer. Memory
> management? Low level IO?
This is the information age. To push research further, you stand on the head of previous technology. You do not start back at the wheel developing everything up until your research area. You take the best tools for the job, you specialise your research and focus on what you're trying to achieve.
What Scientist are you refering to? Mathematical Computer Scientist, Info Computer Scientist or Electronics Computer Scientist and Systems Scientist? Only the last two apply. If you want to build operating systems, you've gotta know alot of the bones. If you want to do AI, you're working in Prolog, or something so far from the hardware : Because you dont care. Sure, everyone HAS to know the principles of programming. You learn this in C, C++ and Java. It is not exclusive to C. Ideally, our thoughts would be mapped directly onto the computer. Scientists want to describe their thoughts, not silly programming languages.
Oh, So you want to be a programmer.
If you want to master a programming language / programming in general. Go to a technical college, or some skills training. There is no place for C in general computer science unless its some operating systems course / low level electronics integration.
> In short, since I believe that AP CS courses
> should focus on the low level architecture of
> computing, Java is an inappropriate language
> for that course.
Are you a scientist or a programmer?
There are different objectives. Every student should ask themselves this question. Some students blindly think that they are thinking.
> When is Java appropriate? In your college ?
> sophomore comparative languages course, or,
> alternatively, in an OO course or two?
Its appropriate when they can teach you to program in it, quickly, ensuring that you can do Image Processing / AI / Algorithm Analysis / Whatever else they decide to teach as a Science. Computer science is not a technical training school.
---
All uber geeks dont actually learn how to program in university. If you're not an uber geek, stick to the syllabus until you can think, mabey take some extra courses.
-Tim
OO is high level, teach them assembler first and how the machine works. I've seen way too many people writing really crappy code because they have no idea what's going on inside the machine.
Excessive forking causes un-wanted children.
I agree with you in that Java is fine for an education language but it definitely shouldn't be limited to that. For example, one of the new recruits in my company has just graduated from a university where they were only taught Java. Consequently, he doesn't know what a pointer is, he doesn't know what linking object files means and he doesn't know anything about memory allocation.
As I see it, University (College) is about education not about industrial training. You shouldn't be taught specific tools at university rather you should be taught theory. That way, when you leave university you will be able to apply your theory to different languages or applications. For example, one of the Universities here in the UK teaches all the programming in Visual Basic. I mean what is that all about? How can you possibly claim you know how to program when all you know is Visual Basic! A good programmer should pick a language to use like a carpenter picks a tool for a job. Different languages are good for different jobs and university should give you the theory so that you can easily understand new languages.
A university should really teach you a mixture, pure object-oriented (like Smalltalk), imperative (like modula-2 or C), functional (like Miranda) etc. The student will then have firm foundations for being a good programmer.
perl -e 'print $i=pack(c5, (41*2), sqrt(7056), (unpack(c,H)-2), oct(115), 10);'
But why assume that everyone in the intro class is there to become a "skilled programmer?" How about science or math majors there so they'll be able to write some small apps when they need to? Or history or sociology majors who need to satisfy a science requirement or just like computers and think learning to code a little would be fun?
Unsettling MOTD at my ISP.
Seriously, the managers who invented the "C/C++" phrase need a horse whippin'
Point me to a standard that talks about "C/C++", anything other than some lame "job requirements" document written by Dilber's boss. You can't. "C/C++" doesn't exist. The two languages are diverging, more obviously with the C9x standard.
One of the interesting things I've noticed about CS is where various programs began. At Carnegie Mellon University, where I went to school, CS developed as an offshoot of the Math program. At other schools, CS developed as an offshoot of the EE program. (Both of these are gross oversimplifications and may be inaccurate, but please bear with me.) As a result, programs grow with a different foci; these differences have affected the curriculum.
At schools where the CS program developed as part of an Engineering curriculum, the CS focus has been on the architectural and EE aspects of CS, rather than on the algorithms. At these sorts of schools, you can expect to see classes taught in lower-level languages like C and assembly. At schools where the CS program developed as part of the Math curriculum, the CS focus is more on algorithms and theory. At these schools, you see more classes in higher-level languages like Scheme, Lisp, and SML.
Which method is "right?" I think it depends on the class. For example, it would not make a ton of sense to teach an operating systems class in a language other than C. The best language for a graphics class is probably C++. SML is probably a suitable language for a class in computer languages, and Scheme or Lisp is probably a good language for a data structures class. Personally, I find Pascal and Java good languages for Intro CS classes. For someone just getting started with computers not in a classroom situation, an interpreted language like Basic is nice because of its shallow learning curve.
Ultimately, I consider the choice of language in CS to be a moot issue. I feel that CS and programming are two different things. Programming is a craft and important in it's own right, but with respect to computer science, programming languages are tools, not goals.
--Sam
You are absolutely right. Java shouldn't be the only educational language. No language is so complete, so useable, so widely used, so feture rich that it demonstrates everything an comp sci degree needs to know.
As x approaches total apathy I couldn't care less.
I think Java is a fine education language for the following reasons.
It is cleaner than C++.
It is widely and freely avalaible. (though so are many other languages.
It is being used widely in the industry, and I think educational institutions have a responsibility to realease students with marketable skills.
As for performance, it is slower than some languages closer to the heart of a computer, but speed is not the point of an educational language, constructs and methodology are. And Java offers all the needed constructs and is good to teach the OOAD methodology.
As x approaches total apathy I couldn't care less.
Smalltalk is much cleaner OO than Java which is much cleaner than C++. I think the main reason Java is chosen over Smalltalk is Java is more widely used in the industry. It is a tradeoff purity versus use, Smalltalk wins in purity and c++ wins in use, but Java is a good middle ground
As x approaches total apathy I couldn't care less.
I took the grade 11 computer course last year, basically they started us in C/C++ until Christmas and then switched to Java. Needless to say most of the people in this class would not have gone onto do computer nor did they have any experience but I noticed a distinct lack of interest when we swithed to Java. I think it had something to do with re-learning everything but it also had something to do with them finding C/C++ more intuitive. The point remains, whatever you go with, especially at the highschool level, stick with it all year or you will loose half the class right then and there.
More imporantly if you want to keep as many people interested in computers, especially their first introduction to programming, keep the language simple, worry about whether or not a high level or low level expericne is better later.
I listen to Java zealots defend their chosen language day in and day out as the best possible lanuguage for any possible application. They tout its speed, portability, and power.
What they fail to recognize is that Java application environments are horrible. For example: I hate trying to set up any of the Freenet software, just because of the pain in the ass involved in making sure I have the fastest/best/non-proprietary Java VM installed. There are many more examples of people developing software that relies of Java.
If you have any sense at all, DO NOT TEACH Java as an application language, just because that means the rest of us will have to use crappy JVM-dependant apps once your students find their way into the real world. Use C, C++ if you prefer to get your students wet in OOP before structured programing, or Perl, which offers both kinds of environments.
Installing or running an application should never be more difficult than writing one.
The next Slashdot story will be ready soon, but subscribers can beat the rush and slashdot the links early!
Well, isn't that special? I think you're absolutely right about the nullPointerException, but there is a significant difference between knowing an abstract fact - "Every object variable coded is a pointer," and actually having to deal with pointers and the consequences of screwing them up. An example occurred recently when I was trying to do a compareTo method on a Graphics object, which required an impossible explicit cast. I asked someone for advice, and that person said, "Well, just use a pointer." Great idea - in C. While I was eventually able to solve the problem, I really think it would have been much more informative for me if I were simply able to use the pointer, and see what happened.
And, quite frankly, I really resent the implication you made at the end of your statement. I'm as totally opposed to the Microsoft business practices as you are - my question was with an academic issue regarding Java programming as a teaching language - and since when did Bill Gates benefit from a CS department switching from Java to C++ anyway?
political_news.c: warning: comparison is always true due to limited range of data type
Agreed. While C\C++ is a good language and lies at the root of Perl and Java it and the imperative paradigm is not the center of the programming Universe. Without exploring languages from other paradimgs such as prolog, Haskell, etc one cannot get a good feel for the different ways to approache a problem. This tends to lead people into such dogamtic fun as the belif that recursion in all forms is "just plain wrong" as my C\C++ teacher put it.
In terms of which language to start with Java has the advantage over c in that it's syntax is cleaner and has less of the fun archaic elements such as the need for heavy pointer arithmetic. This makes the into learning curve too damn steep. Unfortunately it too is limiting to the iterative world. I'd recommend something like Pascal which was written to be a teaching language (if you must stick with imperative).
IMHO the best language to start with would be Lisp. It is more mature than python. It is quite tolerant allowing the students to play with less pain. It includes higher level elements such as lists that allows people to get into real programming in shorter order. Rather than forcing them to put off any real programming until after they have mastered the arcane nature of c's memory allocation. Lastly and most importantly as a teaching language it can be used for purely functional, purely iterative, and for object-oriented programming. Thus you can introduce your students to three of the major paradigms (you can do some Psudo-logic programming in it but it just isn't the same as prolog) under one roof. As a result the excess learning time is lessened.
Irvu
The refused to budge. I took FORTRAN. I have never used FORTRAN. It was so much like BASIC on my old C64 I wanted to cry. I learned NOTHING (or, at least that's how it felt).
The next year, the cirriculum was changed to C/C++. I was rather pissed.
I am by no means a good programmer. I'm not even a crappy programmer. I do almost no coding. But, every time I look around, I feel that had I learned C I'd have been better off.
I've played with Perl, I've played with Python. I've not played much with Java. But even with just playing, it has felt more useful than what I had gotten out of FORTRAN.
Hi! This is the Sig, blatantly attached to the end of this comment.
When I were studying CS, they usually didn't offer something like "Programming in XXX", "Fundamental of XXX". They usually went straight into "let's do this assignment in language XXX". The best they could do was to provide reference materials of this languages.
:D
I still remember I've to program in ADA, which I never heard of before, in Software Technology course, for a section about OO(OO was very new then). No one taught you how to program in ADA, and I must admit it was fun.
It's very different nowaday. When you design a course which requires students to program, you must offer a seperate programming course as a prerequisite, or spend enough time to teach them programming in that course.
I were involved in the design of a course Computer Architecture for a local university. There is 2 assignments for programming in 68000. The course coordinator said since we don't have a seperate course for 68000, we must spend enough time, say 3 weeks, to teach the students how to use 68000. That would greatly affect the content of the course, but I failed in the argument. "May be that's today's trend, may be in the future we must spend enough time to teach students how to do mouse click" - you guess, the CC was VERY unhappy about it.
I think you shouldn't whine when you school don't offer the language course you like. If you want to learn a language, learn by yourself.
Remember that most software development is bespoke (i.e. it will never get out of the company that wrote, for whatever reason).
.NET...), thanks to Enterprise Java Beans and XML.
And I can tell you that whenever number crunching is not required, Java takes over. Java on the server is really gone rule the business world for the next 10 years (unless
As a learning language, I would say that Java being easier to learn, it's easier to teach OO concepts with Java because you don't have to make sense of this huge thing call C++ first.
Nobox: Only simple products.
I agree with Chris. With a solid understanding of the low level aspects of the machine, OS, and language, learning a language like Java or Smalltalk is not a large hurdle. Someone who has been working with Java or even VB only typically is lost when asked to learn C/C++. Because of a lack of understanding of the machine, OS, and language, many more errors are created and frequently the approaches are flawed. This is a pattern that I have seen repeat itself over the years I have been in the industry.
You think you had to wait long to build your project! You would have to wait in line to get your punch card run on the machines and hope that your code worked the first run through.
He wishes he could have us do the same today being that this prevented the so-called "shotgun" approach to programming. You better have thought your code through so that it works the first time or risk being in line all night waiting to submit your punchcard.
A far cry from the capabilities of the students today to compile every five minutes.
__________________________
william lane
CS is not about writing programs. It is about problem solving and computation. Java is no more appropriate than HTML in this sense.
However, since writing programs is the method of dealing with the above issues, it begs the question of what language would be the best to teach.
Ideally, a good language should have at least the following features:
1) Enforces good design
2) Supports procedural programming
3) Supports OO programming
4) Is compiled
5) Is interpreted
6) Is useful outside academia
7) Is limited, to provide students an easy foundation
8) Allows direct memory manipulation
9) Disallows bad things like pointer manipulation
10) Is assembly language
In short, no one language is good enough to take a student through all four years of schooling.
Dancin Santa
Java's like candy-- it takes care of so much of the annoying stuff that C++ programmers get used to dealing with. While C++ sucks in this way, if you're looking for a high-performance language you can't rely on a system with garbage collection and run-time linking. Not to mention that truly understanding what's going on with memory and pointers, while posing a steeper learning curve, really helps you understand how the machine deals with your programs.
I haven't looked at Python hard enough yet, but at first glance it does look like a pretty good candidate for the first language. One of the big questions here is just what should be taught in the first course: how computers work (C or even assembly), or how to program in a clean and easy language (Python or some other very high level OO language). I'd get them programming first, then do the low-level stuff in the second term, then cover the languages you'll need on the job the second and subsequent years (C++/Java and database programming). C++ is just too darned hard for the first programming course. Java is better, but I think (I haven't used it) there are still too many traps for novices.
By the way, I've been wondering if my grandson (a very smart and hyper 3rd grader) could get started on programming this summer. 10 years ago it would have been BASIC, but I wouldn't inflict Visual Basic on any beginner. Python maybe? Or does someone have other suggestions.
C.
I can do anything in C, including implement 00 recompilers if I want to simplify some code files.
The bug is that this is an intro class.
Does that mean it's a gut course, taken by people who will never take another formal class but need basic real-world skill? Or does that mean it's a foundation in the vocabulary and skills needed to make the journey through the meaty classes to follow, but not necessarily to enable any real-world proficiency?
Those are different goals.
In the former case, I'd go with a language that sits at the highest level and has the most intuitive interface. Believe it or not, this is National Semiconductor's LabView. Drag-and-drop coding, almost done right. G2 might be okay, too, but last time I saw it in action, it was several thousand dollars per developer seat, several hundred dollars per runtime license, and two major revs away from being high-level clean.
If the latter goal is needed, I'd want a spectrum of knowledge. Assembly to teach what the native objects and operations are in a computer. C to bridge the gap between a machine schedule and a language. And Smalltalk rather than C++ to show off the power of OO. Save it for the second-level course offerings.
The problem with Java is it's weak. The problem with C++ is it's been sold primarily as as OO but it's bloated with stuff that has nothing to do with OO. It's a buff and a polish away from MainSail, the language built by hacking in every Stanford AI Lab student project since 1969.
--Blair
"Please leave your hymnals on your pews."
My opinion is that universities should stay away as much as possible from commercial bastardisations as humanely possible. There is a plethora of open languages that can be used in introductory courses. Python isn't a bad example. There is also something to be said for understanding pointer arithmetic in C. Most programmers bred on java have little understanding of underlying hardware architectures and it often bites them in the ass when it comes to real world problems. Java is also not as elegant as Sun Inc. Containers that just store Object(s) are a nightmare on larger projects for instance. Java's reliance on reflection is also a sign of bad OO design. C++ at least offers a partial solution to the problem in the form of templates and the language itself is not controlled by a single organization. Also its multiparadigm structure allows students to get grasp of concepts other than OO. It's not an easy language to learn and may not be the optimal choice for courses in a community college but all self respecting universities should think twice about picking Java as their teaching language. They should be training scientists not code monkeys.
Your pizza just the way you ought to have it.
I am a high school student, and completed an AP computer science course a year ago. The thing that you forget, when you suggest that multiple languages be emphasized, it that the students have approximately 4-5 hours of class time, and 4-5 hours of homework for a given subject in a week (at least in my school). I knew a bit of Java, a bit of C, and a lot of Basic before embarking on a mission to learn C++. By the end of the year, I wrote some games in which the computer had rudimentery intelligence, and could learn to beat me at Yachtzee. If I were forced to learn, as you suggest, the libraries for several different languages, and the quirks of themk as well, would it have been possible for me to write a progrm in any language with such a degree of sophistication? Not likely. When setting the AP curriculum, educators re trying to determine which language can best introduce the most sophisticated concepts in the least time. I like the idea of using Smalltalk, because from what I know of it, it would encourage this, however, my guess is that somebody on the AP board liked the idea of using a language that's used in real life. They saw it on the bottom edge of their web browser.
My Karma is so good, I'm the Dalai Lama...or something.
I think you mean "interactive" rather than "interpretive".
Actually, I was primarily addressing the question regarding college CS, not the part about AP programming. I don't expect that one should necessarily pursue several languages in one course. But in the course of working through a (let us say) eight semester college CS degree, one surely has enough time to learn a goodly number of languages. As I suggested, Smalltalk would be good for a course emphasizing OO programming and concepts. A nice functional language like ML might be good for algorithms and data structures. When looking at lower level issues one could work in the context of C and assembler. And so on. And one gains because one is actually using tools appropriate for the problem at hand. I don't think it's an unreasonable thing to ask that a college student majoring in CS learn a language or two a semester, especially when it is relevant to the topic actually being studied (where we realize that the languages are indeed most often secondary to the other concepts being expressed).
As I qualified before, I did not go through a CS program, but this is more or less what I would want to see (and be willing to do) if I did. (And who knows, perhaps someday I'll get the chance. :-)
Well, I agree with you about Lisp. The language I use most is Common Lisp, and I feel it works very well on a wide range of problems (yes, including real-world ones, for the skeptics out there). If someone had merely asked me what I'd recommend as a first language, it would be my pick. There seem to be a lot of lingering prejudices against it though (which seem to be mostly based on the state of Lisp 20-30 years ago); if there's any one result that I am grateful for coming out of my lack of formal CS training, it's that I never picked up this bias and thereby missed out on Lisp. :-)
Well, at the risk of just making up numbers, let us say that one gets significant exposure to six or seven different languages and has to take 12-16 classes that involve programming of some sort. Then isn't it pretty likely that at least one of them is used for three semesters? (Especially considering the likelihood that in the later semesters there is some sort of specialization in the direction of study.)
I think this is a red herring. Learning a syntax ought to be relatively easy for a CS student. And presenting a concept in a suitable language would seem to me to emphasize that concept. Let us say that (just as an example), the introductory course is in C. Won't the concepts of OOP come through better in Smalltalk? Functional programming and its related issues in ML? AI in Prolog or Lisp? To understand what is going on in the hardware with assembler? I agree that the language is not the main point - I don't advocate learning a lot of languages just for the sake of knowing a lot of languages; the point (IMHO) is that using an appropriate language makes it easier not to be distracted by the language itself and to see the important points and concepts of what one is actually studying.
It's interesting that you should pick this particular example. It's one of the early examples in Ullman's Elements of ML Programming , for example, and I don't think it's all that difficult.
The reason I mentioned ML in particular in this context is that ML datatypes can correspond pretty naturally to abstract notions of data structures. Then algorithms on them are often easily expressed using pattern matching. Once again, it is (IMHO, of course), a matter of picking the language so that language issues avoid clouding the real concepts, which here are (IMHO again) understanding how the structures and algorithms are useful and how to analyze their properties. (You are of course right that there are some potential difficulties (or perhaps it would be more accurate to say differences) if one commits oneself to remaining exclusively in the functional realm; however, I don't know if I really believe that this is that much of an issue for a first course in data structures and algorithms.)
(As an aside, let me plug Okasaki's Purely Functional Data Structures as a reference for data structures in functional languages.)
For the express purpose of teaching OOP, why not use Smalltalk, which makes it difficult to fall into other methodologies and easy to use OO techniques?
But as a greater question, why restrict the field to one or a few languages? I'd think that in a CS curriculum (I insert the disclaimer that I came from mathematics and not from such a curriculum) one would want students to explore as many languages and paradigms as possible, ranging all the way from assembler to Prolog. This would presumably encourage a student both to develop many different ways of thinking about any given problem and to be able and willing to select an appropriate tool for any problem encountered. Far too often we see (as evidenced by responses on Slashdot to articles like this one) that many people are rather narrow-minded about language selection and unwilling to deviate from using their one pet language. Why not start to discourage that immediately in the course of formal CS training?
Honestly, I think Java is a good compromise. It is OOP, although more or less OOP is debatable given that it doesn't implement multiple inheritance.
Remember that we're talking about a beginners class here. C++ would put them into shock. The other alternatives are few, and not practical. For those who don't think there is money in Java, take a look at the sales of BEA Weblogic and IBM Websphere, and the corresponding numbers of developers programming on those platforms. Java is here to stay, the momentum has reached critical mass.
So, start 'em off with Java, and then toughen 'em up with C++. But for God's sake don't start with Visual Basic! (as I have heard some schools do)
"What are we going to do tonight, Bill?"
www.lucernesys.comHorizon: Calendar-based personal finance
Our computing science department switched to Java for first year programming courses a couple of years ago, much to the dismay of most of the professors.
The idea that teaching it because it is "easy" is the wrong way to think about it. People learn and retain more when they are challenged. If it all comes easily from reading the API docs, retention isn't going to be as high.
Furthermore, OO seems to be the golden child of programming these days. In our curriculum, however, OO design philosophies are not taught until at least the 3rd year, and then only the surface is touched (there is an in-depth 4th year course in OO design). A lot of good that does to people taking Java in their first year - that's 2 years to develop poor habits!
I remember talking to a couple of profs (both who are well-respected and rather famous in computing science, as are many of our faculty) about it. They both referred to Java as "C++--" and seemed to be totally against it. They urged me to go to the meeting about it saying that a student saying they didn't want it would be worth 1000 professors saying they didn't want it. Alas, I never went to the meeting - I wonder if it would have made a difference...
Why was I opposed to it? Even at that point in my academic career, I was of the opinion that the first language to learn should be an assembly language. Then maybe C in the second year, Java and C++ in the third. Only then would you have a real appreciation for what each languages' strengths and weaknesses are. When something "just doesn't work" in C or C++, you'd have insight as to WHY it didn't work. You'd really understand different addressing modes and how data is stored in memory.
One of the things that pro-Java people put forward is that you don't have to worry about garbage collection. Is this really a Good Thing though? Maybe, once you understand WHY you need garbage collection.
I dunno... What do you wanna do?
I figured this deserved more than the one line it got. A friend of mine from college said the same thing for his exit interview for the CS major. It's a great introductory language for people. It's complex enough to be worth an entire semester, allows for the teaching of OO techniques, and also doesn't make students feel utterly worthless (as C has been known to do. Do I malloc (amount + 1), or just (amount)? Argh!).
;)
Python is the perfect way for people to get their feet wet. Especially as it doesn't "break" a person's perspective on what to expect from languages, as perl might.
I agree that you need to know how a computer works at the low level. But this does extremely little to help you design software with typical real-world requirements - you need to also have experience thinking at a high-level, where the design of software systems takes place. I know many programmers (usually with electronic engineering background, where software development isn't emphasized) who know assembly etc very well, but don't know even the most basic things about object oriented programming, and it really shows through in the software they produce (e.g. having the base class know about ALL types of derived classes and using a "type" variable combined with lots of switch statements in functions to call derived-class-specific code - exactly what virtual functions are there for!). Likewise, I've seen people who have only learned about programming at a high-level, and their coding shows problems, because they don't understand whats going on when their code gets compiled (e.g. not understanding the difference between heap allocation and stack allocation - try "char array[10000000];" inside a function!)
You absolutely need both, no question. My 1st year CS course at university included introductory assembly as well as object-oriented programming. Personally I think Java is quite a good introductory language, C++ is too complex for beginners, you want to teach the design principles without all the pointer problems etc getting in the way.
I don't see how you can claim that "teaching java to beginning programmers only encourages sloppy programming". If anything, only teaching assembly would encourage some seriously sloppy programming. You cannot learn good high-level design from only doing low-level programming, thats like saying that you can learn good social skills by studying how neurons in the brain function.
In my mind, no OO language should be the first language taught. There are too many fundamentals which ought to be learned first. If students don't understand what's going on at the machine level, we may as well teach them in HyperCard!
I started with left-taught BASIC, then I moved to self-taught C, then Assembler, Lisp. I really cannot think anything would be so different if I had learnt C in the first place. Or Assember, or... well, perhaps Lisp would have made a difference, although I'm not sure in which direction :)
I have afterwards taught languajes, and there are mainly two types of people, those who have problems with programming, and those who not. No language will help the first group, who has problems to understand the most basic concepts, and no language is going to seriously hinder the second group.
--
Rome taught me patience and assiduous application to detail. Virtues which temper the boldness of great, general views.
My CS class (thru Scheme) taught me not just how object oriented programming is structured, but the converse (data directed) works. We spent the
first week learning the language and the rest of the course actually learning computer science. Most languages require all this extra time learning their syntax and weird libraries and stuff that has no place in a class room.
This class would've been extremely clunky and nasty in C or Java. Those languages are good if you're interested in writing applications, but if you want to learn how to *program*, then use a language that lets you learn computer science.
Computer Science? Its not really about computers and its definately not a science.
Looks like Smalltalk enforces every OO paradigm I can think of.
Getting back to the topic of Java as a teaching tool, I don't see the problem with it. You can teach OO with it, you don't have to worry about pointers, and it makes you marketable (OT - I still get quite a few Smalltalk job offers, so it's still useful in the workforce).
Help find a cure for cancer!
The real problem is: how far do you peel back the onion? Why stop with assembler?
Thirty years ago, I learned machine code to program the PDP-8. Why not teach that today? Or why not go further down and teach VLSI processor design, or semiconductor physics?
Semiconductor physics has nothing to do with computer science. VLSI processor design is not fundamental anything, but an engineering discipline based on a particular fabrication technology (more-or-less 2D semiconductor electronics).
Learning the machine code is part of learning assembler. A small part. There's no need to memorize it, just to be able to assemble by hand to understand what's going on (with references, of course). A few hours doing such exercises should suffice.
Once this is learned, assembler is a simple convenience giving full control over the machine code with fewer headaches.
A CS student certainly should learn about logic gates and how they build up into addition, multiplication, RAM, etc. This is also fundamental CS. How to build these gates from transistors (or vacuum tubes, or tinker toys) is not, and should be left to the engineers.
If you don't understand how a functioning computer is built out of logic components, you have no theoretical basis for why one operation should be slower than another, or why there is limited memory. Without this base, all programs that work are equally good, and if one works slower than another in practice, or can't run because it needs too much memory, it is merely a quirk of the hardware design. A machine could be built which always sorts any billion entries in the same amount of time as it takes for it to add two 32-bit numbers, machines are built which take the same amount of time to multiply as to add, but addition is fundamentally simpler and faster than multiplication, and adding two 32-bit numbers is certainly fundamentally faster than sorting a billion entries. The supersorter is a quirky machine, but without knowing about the gates from which all digital computers are built, you have no valid mathematical basis for saying so.
Similarly, if you don't know anything about machine language, you have no reason for saying why one HLL program should run faster than another, or which will consume more memory.
The heart of CS is the interaction between the gate logic and the data fed into the gates. Anyone who doesn't understand the fundamentals of this interaction is not remotely a computer scientist. Learning a machine language is making one case study.
--
As my CS II prof said at the end of the semester, "You now know the complete syntax and and workings of C++... One day in the future you'll graduate, and you'll need to get a job. If, at an interview, they ask you whether you know Java, say yes, then go read a Java book over lunch." And, this is about what I did. I had a little java experience when I interviewed for my current student job. Now I know java really well. And why? Because I understand OOP pretty well. It's just about learning the concepts, not a specific language. If you feel like you know C++ but don't think you can learn Java, then I don't know how you got a BS in CS. Java is a LOT like C++, just easier to use! Go pick up a java book and start making a few extra grand per year...
--chadwick!
I further disagree. The purpose is for teaching. To do so, you really don't need to learn much of the standard libraries to get a feel for OOP or simple things like 'Hello World.'
When you want to get advanced, Java becomes much easier, especially for graphical programs.
Personally, I taught myself Java and now use it 99% of my time. If you know C++, Java is a snap...so my recommendation would be start them with C or C++ so they can get into some really ugly, cryptic, self-documenting code!
bleh
if I ever saw one. I guess tomorrow we can do emacs/vi, and round up the week with PC/Mac. Wonder if the original poster is intending to read all the answers, or if he just wanted to see if he could set a new ./ record?
-- Another senseless waste of fine bytes.
I think most people forget that the purpose of education isn't to teach material in a curriculum, but to teach students to learn.
I still don't have a degree yet, but I learned Pascal in high school, then went on to teach myself various other languages (including C and PHP). I worked at an ISP as a self-taught programmer for 6 months and earned a decent pay ($4k+/month) before I decided to go back to school to get a degree.
Being able to teach your self, IMHO, is especially important for programmers because of the nature of the industry. No matter what you "learned" in college, five-ten years into your career, your "knowledge" will be outdated. If you learned to learn, however, you will never be outdated.
So to get back to the main thread, what language you learned is, IMHO, inconsequential. It's just a language. Any good programmer should be able to learn a new language in at most a few weeks. There are other fields in CS that can not be mastered as easily, and any good college program should concentrate on such topics.
---
Open Source Shirts
The main advantage of Java over C and C++ (and the reason why C and derivations are discontinued as teaching tools in my university) is it's relative platform-independence. When you want to test the programs that people have written at home, it's a real pain in the ass to get their Borland C++ programs running under Linux, you know. This disappears with Java.
On the other hand, Java is not the most highly structured language, especially in recent versions. That greatly lessens its didactic qualities; I have had several students here who started to experiment with all sorts of arcane features like inner classes and operator overloading without learning how to write good programs first. It's a bit like comparing Niklaus Wirth's original Pascal to Borland Delphi. Deplhi is more powerful, but you need a thorough knowledge of the class hierarchy and in order to deliver good OO programs, you have to be a good OO programmer beforehand.
Therefore, I now prefer either more systematic languages like Eiffel, or script-like languages like Python - the first for their higher level of abstraction and cleaner design, the latter for their greater ease of use and wider field of applications. Both are, in my opinion, better suited as didactic tools for learning OO programming.
And BTW, over here in Germany the high dependence on symbols such as {} or [] or /**/ is a didactic problem in itself because these aren't so easily reached on a German keyboard. This may sound harmless, but we get endless complaints from people who hate to perform strange Alt+Key acrobatics to get a simple thing like a curly brace.
There is absolutely no reason to panic.
I think that the best programming language for a new programming student to learn first is not C or C++ or Java. It's Pascal. I know it isn't all that powerful, but it has two very nice things going for it:
1. The Borland compiler gives extremely helpful, precise error messages, and is free.
2. Pascal is not at all forgiving in terms of syntax. You WILL code one way, the only way, the tidy way, or your program will not run. Nothing conditions a programmer to be neat and organized better than Pascal.
The disadvantage, of course, is that pascal does not allow low-level access to a computer unless you integrate ASM. However, I really think that the first thing a programming student should learn is not how computers work at a system level, but the logic they use. An understanding of recursion will get you programming effectively a lot faster than if the same time were spend on memory allocation.
I'm the stranger...posting to
"Python maybe? Or does someone have other suggestions."
If he's willing and able to code neatly, I'd recommend pascal. It's free from borland (go to community.borland.com and click the museum link), it allows for some interesting graphical functions, and it forces the programmer to be tidy. It also is very easy to get programming in quickly - your grandson can have "Hello world!" running in five minutes at most, unless there's a compiler problem. In another five minutes "Hello world" will be blinking and beeping at you. This will be a good time to teach programming etiquette ("Not all end-users like flashing text or beeps").
Alternatively, you could buy the kid a Lego Mindstorms set and turn him loose. You can program those robots in their own visual RCX code, asm, a basic-like language, C, C++, python, ada - pretty much any language you want. This would allow for your grandson to first learn an easier language, then progress to more complex and powerful ones. Also, if you buy the Mindstorms kit I can assure you you will be his favorite grandparent ever.
I hope this was some help. Feel free to email me if you have any questions.
I'm the stranger...posting to
It's "computer science", not "computer language science". In your CS and professional career, a programming language is both an end and a means to an end -- if you're smart. You get work done with a programming language and receive either marks or cash.
But if that's all you do with it, if you can't see the potential to learn about other languages -- about CS principles in general -- by abstracting beyond one language to many... well, then be gone with thee!So, what are we teaching in CS? Just programming languages? Just one? Might not students be best served by a survey of languages, even in the tender stages?
Today's students would do well to "peel the onion", starting with Python and it's clean simple OO model, high-level built-in data structures and emphasis on consistent style; then on to Java for a deeper look into data structures; C++ for a nasty dose of design elegance shot to hell by implementation realities. Well, the list goes on.
Ummm, you are obviously NOT well versed on Java. It is used for a lot more than just Applets. In fact a lot of web programming is changing to Java Servlets/JSP. And Enterprise Java Beans are excellent should the need arise for component based development involving multiple systems while enforcing security, transactions, database connections, etc.
.... get the point?
You also can write solid client/server systems in Java, and network programming with sockets or RMI, or using it on the command line to process text files into a database, or interfaces on cell phones/printers/copiers/Palm devices or
Java has strict typing, and is an excellent learning language because you can learn the introductory fundamentals of programming very easily. Not to mention the fact that it can introduce many different aspects of programming to a student (GUI/event programming, network programming, OOP, database interaction, etc.) without having to learn another language/environment or some 3rd party libraries.
After all, assembler is just an abstraction of binary. So. Like. In fact, binary is the most fundamental language. 8P
bmongar has the best post I've seen on this topic: both correct and succinct. I teach Java at Northeastern University, and I've lived these tradeoffs.
Smalltalk is pure OO, but introductory students aren't sophisticated enough to understand the beauty of immutable numeric singleton objects and other such OO extremes. It is my second choice for a strictly OOP/OOD course in the 2nd year, after Java.
C++ is the best language out there for production of real application software. It is difficult to teach and basically requires that a lot of difficult low-level concepts are pushed into the first year. It is my first choice for a strictly software design course in the 2nd or 3rd year.
Java is the best language for introductory programming and here's why:
That's all you need in the first year. They need to learn abstract thought; a lot of the other posts ignore that fact.
Check out our pedagogical Java toolkit available here. This summer we are moving from toolkit implementation to developing a real good Java curriculum.
PBk