21

EDIT: This question at first seems to be bashing Java, and I guess at this point it is a bit. However, the bigger point I am trying to make is why any one single language is chosen as the one end all be all solution to all problems. Java happens to be the one that's used so that's the one I had to beat on here, but I'm not intentionality ripping Java a new one :)

I don't like Java in most academic settings. I'm not saying the language itself is bad -- it has several extremely desirable aspects, most importantly the ability to run without recompilation on most any platform. Nothing wrong with using the language for Your Next App ^TM. (Not something I would personally do, but that's more because I have less experience with it, rather than it's design being poor)

I think it is a waste that high level CS courses are taught using Java as a language. Too many of my co-students cannot program worth a damn, because they don't know how to work in a non-garbage-collected world. They don't fundamentally understand the machines they are programming for. When someone can work outside of a garbage collected world, they can work inside of one, but not vice versa. GC is a tool, not a crutch. But the way it is used to teach computer science students is a as a crutch.

Computer science should not teach an entire suite of courses tailored to a single language. Students leave with the idea that all good design is idiomatic Java design, and that Object Oriented Design is the ONE TRUE WAY THAT IS THE ONLY WAY THINGS CAN BE DONE. Other languages, at least one of them not being a garbage collected language, should be used in teaching, in order to give the graduate a better understanding of the machines.

It is an embarrassment that somebody with a PHD in CS from a respected institution cannot program their way out of a paper bag.

What's worse, is that when I talk to those CS professors who actually do understand how things operate, they share feelings like this, that we're doing a disservice to our students by doing everything in Java. (Note that the above would be the same if I replaced it with any other language, generally using a single language is the problem, not Java itself)

In total, I feel I can no longer respect any kind of degree at all -- when I can't see those around me able to program their way out of fizzbuzz problems.

Why/how did it get to be this way?

29
  • 9
    Don't worry. Give Oracle half a chance and they will remedy the situation:) Their lawsuits against Android and Apache are just the beginning of driving developers away. I teach at an institution that has taken the above as a cue to start teaching Python, in anticipation of the future market.
    – SamGoody
    Nov 2, 2010 at 10:55
  • 3
    What academic settings are you referring to? I don't offhand know anywhere where CSci students are expected to learn only one language. (Last I was in school, you could have gotten by with C and Scheme, I think, if you picked your major and classes carefully, but you'd be using at least two dissimilar languages.) Nov 2, 2010 at 13:57
  • 17
    Can you explain how your L1 cache works? Can you design an ALU? Can you explain Maxwell's equations? What about the thermodynamic properties of your motherboard? Could you build a USB drive? Do you REALLY know how your computer works? Or did you pick a level of abstraction appropriate for your interests and go from there? Feb 7, 2011 at 19:52
  • 5
    Because deciding that you need to understand memory management to "fundamentally understand the machines they are programming for" is a completely arbitrary level to stop at. If it's not necessary to understand the problems you're interested in, your time is often better spent studying what you are interested in ( since nobody has enough time to learn everything ). And any argument you present as to why Java programmers need to learn memory management could be extended infinitely until everybody needs to know atomic physics to "understand" anything. Feb 7, 2011 at 22:32
  • 7
    Furthermore if anyone has a straw man argument here it's you, given that I've never heard of a single CS program which only presents Java as a programming language. Feb 7, 2011 at 23:38

16 Answers 16

30

This isn't a Java problem, it's a teaching problem. Not knowing how to program is not a languages fault, it's the students fault. Same goes for all your issues, GC, basic machine knowledge, how things work "under the hood" so to speak.

Your major gripe about garbage collection throws me slightly. Unless you're doing C or C++ garbage collection is typically very good and not an issue. Would you rather they all learn assembly? Higher level languages that are strict are very useful for teaching. It gives you the flexibility of libraries, packages, and other niceties when you need it, without any of the confusing language "sugar" present in most other higher level languages (PHP, Ruby, Python, Perl).

19
  • 5
    I'm not saying that the higher level languages should not be taught. But I am saying that something lower level (on the order of C or Fortran or some other systems programming language) should be taught as well. (Going lower than C is less useful because below that level anything you learn there is going to be specific to a single machine architecture). I'm not saying that all CS grads should be great low level programmers. But I am saying that if confronted with a low level problem, they should not sputter and die, as all the students around me seem to do. Nov 2, 2010 at 3:00
  • 3
    @Billy: Going lower then your initial learning level is hard. I find myself looking at C++ / C code and having a bit of a fun time wrapping my head around it. Don't expect miracles, but don't expect angels either. Programmers need to have drive, lacking that they will all "sputter and die" quite quickly no matter what level the problem is.
    – Josh K
    Nov 2, 2010 at 3:04
  • 5
    @Josh: Fair enough, but IMHO formal exposure to at least one other programming environment should be a necessity to be given a CS degree. The degree doesn't say "I understand Java", it says, "I understand CS". The two are not the same, and you cannot achieve a full understanding of CS using Java (or for that matter, any language) alone. (BTW, +1) Nov 2, 2010 at 3:13
  • 2
    @JoshK: An inability to debug at low levels, and a greatly reduced ability to properly reason about the implications of the code they write. Jul 13, 2012 at 2:38
  • 1
    I know programmers who only learnt Java and are scared by C++ or C because they have to use pointers. I do not know if someone who cannot program with pointers can be considered a real programmer: after all, all modern computers and runtimes are still based on a basic architecture involving registers, main memory, stack, heap. So I prefer to program in Java rather than in C++ (it is definitely easier to get things done if you do not have to bother about memory management) but I agree that teaching should definitely not be restricted to Java.
    – Giorgio
    Jul 13, 2012 at 8:40
12

Are universities really doing this? Or is this just a perception people get when they get a bad job interview candidate?

I got my CS degree 4 years ago and while Java was used in the intro classes, it was not particularly emphasized after that. Off the top of my head, the core required courses required you to learn Java, C, C++, SML (functional programming language), assembly, matlab and CAST (circuit description language). This doesn't take into account all the math and theoretical CS courses and of course, the half dozen elective CS courses that would have exposed you to a whole bunch more. From talking with friends at a number of different universities, it didn't sound like what they were doing was much different.

If there are universities solely teaching Java, then that is indeed a tragedy. Not because Java is bad, but because it is just one tool of many that should be available to a programmer. A developer who only knows Java is equivalent to a carpenter who only knows how to use a hammer. However, I have trouble believing that's really the case, at least for respected universities. I suspect that this is just the perception from seeing bad candidates and blaming the school for the candidates' incompetence rather than the candidate's own lack of drive/motivation/curiosity/professionalism/etc.

2
  • 2
    Agreed. I just graduated a few years ago, and while most of my classes were taught using Java, it was hard to graduate without taking a class that was taught using C or C++, and we also had a programming language course that emphasized the use of Haskell.
    – mipadi
    Nov 2, 2010 at 15:01
  • In my degree we did Pascal first, then Java as our OO language. Past 2nd year though, 90% of profs didn't care what language you used. Some of us used c/c++/ruby/C#/python/even haskell, but most people stuck with what they knew, java. Only a handfull of courses required using assembly/c/c++ namely things like our 3D graphics (optional) course prettymuch enforced c/c++ for opengl. And obviously the basic systems course enforced SPARC assembly (because we were intentionally working & a low level). I hear they've moved to python/c++ in 1st year now though....
    – Aren
    Aug 10, 2012 at 22:55
11

I'm really surprised this is the situation as many schools. When I got my CS degree, I had a series of languages courses that between them included all the popular languages of the day (this was almost 40 years ago): assembler (Univac 1108 and MIX), FORTRAN IV, SNOBOL4, COBOL, Lisp, and Algol 68. I can't imagine having just one language being taught. Or how I could appreciate what compilers had to do without having written some assembler programs.

We did use Algol and FORTRAN for most of the data and algorithms courses. I would have liked to have spent more time with Lisp -- instead we had just an introduction and now am trying to re-learn some of the concepts. We used SNOBOL4 for writing parsers -- and its pattern matching with backtracking built a good foundation for later work the regex libraries included with many modern languages.

This introduction to half a dozen languages sparked an interest in me that has continued ever since.

0
8

To get the real reason, you would have to ask the people who run those institutions (and even then, they might not tell you).

Several possible reasons (and I'm neither defending nor accusing anyone here, just guessing):

You can get things done in Java

Java it is a general purpose language and as such can be used to solve a lot of problems.

Lots of teachers understand Java

It is difficult to teach a language that you don't understand

Java is popular

Which means that there are plenty of Java resources - books, an active community, code libraries etc.

Java is easy

You don't have to understand lots of low-level stuff or theory to do Java. You may not do it well, but at least you can get things done.

Java is pervasive

You can run it on more or less anything.

There are jobs for Java programmers

There are lots of jobs that need Java - teachers are supposed to be preparing students for the real world.

There is limited time

On many courses, there isn't time to teach multiple languages, theories, low-level concepts etc.

It is what students want

Lots of students have already heard of (and even used) Java. They like because it is familiar.

6

That's what the industry asked for. There was a shortage of Java developers so schools starting creating them. Companies got developers who can start work as soon as they walked through the door.

Anyway, the language doesn't matter. They could teach a non-GC language and still produce bad programmers. The language schools use is an implementation detail. Schools should teach concepts. If this isn't the case then it's the school that is the problem not the language they teach with. Just because someone doesn't know what a pointer is doesn't mean they can't be an effective programmer.

GC is the way of the future anyway.

8
  • 4
    You don't need to know what a pointer is. But you need to be able to pick up the concept relatively quickly. Not being to understand pointers, or concepts similar to pointers, indicate lack of understanding of computer science as a whole. I'm not saying all CS grads need to be awesome low level programmers, but I'm saying they should at least have a conceptual understanding of what's going on when they receive a 4 year university degree. Nov 2, 2010 at 3:05
  • 1
    CS isn't about programming.
    – Javier
    Nov 2, 2010 at 5:19
  • 1
    @Javier: How is CS not about programming? Sure there's that branch of CS, "Theoretical Computer Science", which is not about programming, but for the most part it is about programming. Nov 2, 2010 at 15:20
  • 1
    @Billy ONeal: the wikipedia definition is a little long, but the part that gets closest to programming is "the study of practical techniques for their implementation". that is, it's not about the implementation (programming) but studying the implementation techniques (algorithms, structures, languages, etc)
    – Javier
    Nov 2, 2010 at 17:28
  • 1
    @Javier: I think "the study of programming" and "the action of programming" are one in the same. After all, code is read much more often than it is written. But that's beside the point -- when you receive a CS degree, the thing you're going to end up doing is programming. Nov 2, 2010 at 18:06
5

Laziness and profit motive. Java gets most people 80% of the way, with 20% of the effort. However, this often produces "monkey see monkey do" voodoo coders who don't have deep understanding of what is happening, and are unable to dig deeper than high-level tools.

Teaching C/C++ properly is difficult. Even when done well, quite a few won't fully understand low-level concepts like pointers (there are studies on this). Moreover, it does not seem immediately relevant in the job market.

1
  • 2
    But if yuo understand pointers, you can understand references much more easily.
    – Michael K
    Nov 2, 2010 at 13:45
3

I mostly agree but to a certain degree.

If you are to teach CS cource focused on data structures or algorithms. Getting most of the unnecessary stuff out of the way is a good thing. You don't wan't students to deal with low level stuf when learning high level concepts.

On the other hand low level stuff should be also taught. Just so we get more all-around programmers.

1
  • I'm not talking about a single course. For a single course, that's fine. For an entire curriculum, it is not. Nov 2, 2010 at 13:09
3

As always it is a question of what you want to teach and how much time you have to do it in.

Doing things in Java means that you don't have to deal with stray pointers and free/malloc. That means quite fewer hard-to-find bugs.

This doesn't mean that you shouldn't learn about the underlying machine - which you must to be good at the trade - but that perhaps you should choose the right tool for the job. High-level algorithms are perhaps not the best topic for the assembler course.

2
  • For an intro-to-programming course or a data structures course, Java is fine. Not for an entire 4-year curriculum however. Nov 2, 2010 at 13:12
  • @Billy. Agreed. I am just mentioning that using Java buys you some things you do not have to worry about. You should learn the basics in other courses without Java.
    – user1249
    Nov 2, 2010 at 13:56
2

Is it too much to ask that they be taught something about how computers really work? It makes no sense to me that any CS course outline would not include something of operating systems and computer archetecture. I'm not saying you should be able to design a computer on the back of an envelope, but a general overview puts all languages into perpective. I mean, Java runs in a virtual machine!

2
  • 1
    Are there good computer science programs that don't include an OS course and a computer organization course?
    – mipadi
    Nov 2, 2010 at 15:02
  • I certainly hope not!
    – Michael K
    Nov 2, 2010 at 15:13
0

In all honesty I do not think that you should lose respect for all degrees and especially not CS because the only language taught is Java.

Any decent comp. sci student understands that his CS degree is nothing more than a piece of paper and that real knowledge will come from personal projects and personal study. I would like to think that the good students know they need to know C and learn how to get things done in Linux / Unix and learn how to NOT have their hand held by modern languages.

-1

I don't see a problem with using Java. The biggest problem (as you mentioned) is when universities teach imperative programming as the best and only way to solve all your problems. This is very far from the truth. For example instead of using three imperative languages (or even worst the same language) for three different courses, they should use three different programming paradigms. An example is Java (imperative), Prolog (declarative), and Haskell (functional).

As for why this happens, I think it's a combination of (1) politics - chairmen are not open minded or have personal benefits/sponsors, and (2) laziness - professors were once students and they teach whatever they know or like.

-1

Calvin college in Grand Rapids Mi. Once they switched from Java to Python for introductory programming classes the professor in disbelief mentioned to a group of us near the end of his semester, "A lot of them can actually program, it's incredible". His amazement was in contrast to the previous experiences with Java. This doesn't make Java a bad language, just hard to pick up from scratch. I would argue the same thing about C, or C++ or any language that requires intimate knowledge of memory allocation schemes or types.

4
  • 1
    Erm, Python requires intimate knowledge of types just like the other languages you mentioned. Aug 10, 2012 at 20:57
  • I expect that languages with interpreters will be much easier to learn, since students can get feedback statement by statement rather than compile by compile. Aug 10, 2012 at 21:56
  • @BillyONeal You misread me, The context was memory allocation in my last sentence. I have yet to be concerned about the size or # of elements of a str() or dict() or tuple() or list() or set() ... I just 'use' them.
    – Ben DeMott
    Aug 11, 2012 at 21:57
  • @kevincline Thanks Kevin - this was what I was trying to get across. Judging by the downvotes I need to work on my communication skills ;)
    – Ben DeMott
    Aug 11, 2012 at 21:58
-2

I got a degree in computer systems engineering, so I did study assembly, microprocessors, VHDL, what the logic gates are and how to create a flip-flop out of them, I studied electrical circuits, operational amplifiers, low-pass filters, amplitude modulation, built a circuit in a lab that would sound like a telephone keypad, messed with a logic analyzer, took some physics classes. On the Linux side - I recompiled a kernel before, wrote a tiny device driver, and a homework file system.

But then I realized that I like more high-level stuff a lot more. I prefer Python over C. I like C# and I love the garbage collector. I like math and algorithms and data structures, but I am not a particular fan of pointers - I can mess with them; I just do not want to.

So, you think that the university should teach more C, less Java. Someone else thinks that they should teach everything in Scheme. Spolsky will take both.

Yes, it is true that a university degree is merely a piece of paper, but "do not let schooling get in the way of your education". There is always Wikipedia, Stack Overflow, Coursera.org, etc. Looks like the traditional universities will become less important.

If I could do undergrad all over, then I would have gone to a different school, I would not have studied any of the electrical engineering stuff, but rather Math, CS + minor in Physics and French. Scratch French; I should have studied abroad in Switzerland and learned 5 natural languages while at it. I would also go back and find a person who convinced me that I absolutely must take some intro to economics classes in college in order to survive it in the real world and smack him on the head with my collection of Milton Friedman's books (the only few books on the subject of economics that I read which do not suck). I also would not pay money for the book Freakonomics 1 or a book about Perl language.

In a hindsight, I would have done many things differently. All I can do now, and I recommend this to you, is choose your own adventure: http://www.codinghorror.com/blog/2008/03/choosing-your-own-adventure.html

Having hindsight I would have made 100 billion dollars on the stock market by now, and I would have invested it in cancer research, I would have hired scientists to rid the world of plastic waste; I would have donated enough cash to Ron Paul campaign so that the war in Middle East would be over 3 years ago.

Recognize now that you will never get your time back, so try to spend it wisely.

1
  • Downvoters, please elaborate.
    – Job
    Aug 10, 2012 at 22:22
-2

A few years ago I read somewhere that, in the UK, the Java decision was made to entice more students into programming. Apparently it was easier on the brain because of the lack of nasty pointers and memory management etc... I'd guess that this is the reason why Python is being quickly adopted as the new 'learning tool.' I'd be of the opinion that your typical uni course is not going to make you into a programmer. All it is meant to do is arm you with a certain amount of knowledge and prime you for programming. The day that one can call oneself a programmer generally comes a fair bit of time after uni and when that time comes, pointers, garbage collection and programming paradigms other than OOP, should not be a problem.

0
-2

Why is Java used?

Three reasons:

  1. Java uses C-style syntax. Many programmers are familiar with it, so it reduces the learning curve.

  2. Money was spent to market Java as cool and modern. But compared to lisp, java is living in the stone age.

  3. The JVM. JVM is the one cool thing about java that is legit, not just marketing hype. Although the JVM should be praised as a platform for running programs, it does not by itself merit the existence of the Java language. You can theoretically and practically compile many different languages for the JVM.

1
  • 1
    Welcome. This looks like if might be your first post to Stack Exchange Programmers. Please take a look at the faq page programmers.stackexchange.com/faq for some advice on reputation, asking and answering questions. A key point is that answers should be informative, not provocative. If you make an assertion like Java is stone age and Lisp is modern, explain why. Many readers may know Lisp was specified in 1958 and is just slightly younger than FORTRAN. If you want to say that something about Java that is shared with FORTRAN or Algol drives its design and limits it, describe it. Sep 29, 2012 at 13:41
-3

Your question is supporting the findings of another person who wrote a paper saying Java is so cool but not heavy enough for scientific computing. I think he should just use Big Decimal with all its fine precisions, NANs etc..and get on with it.

I want to live only in a automatic garbage collected world. Its healthier, cleaner, neater, aesthetic, prevents money wasted on health expenses, is more desirable - don't have to tag something as unwanted - simply by dereferencing it or setting it to null or when I move out of scope the item gets automatically tagged for garbage collection..

Ok, now I am talking about Java only but it would be most helpful if this works in the real garbage scenario too. Java is write once run anywhere which is good enough for me for it to be used as a language in schools. No memory leaks and being liked by happy programmers who don't want to spend time tagging every object they use and stop using itself is good logic on behalf of Java.

Java has pointers - well we call them references.. String s1 = "Hello"; String s2 = "Hello"; String s3 = new String("Hello");

s1 and s2 will be pointing to the same String object - which is by reference s1 == s2, s1.equals(s3) but s1 == s3 is false because s3 is a new reference object - this is java arithmetic of references and I understand all this so sorry, I do not wish to be labeled as someone who does not understand the under lying complexities of pointer arithmetic from C or C++.

1
  • 2
    References are not pointers. You can't use them arithmetically, and you can't use them to reinterpret a piece of memory to which they point. And of course, no matter how much you want to live in a garbage collected world, the fact of the matter is that the world is not a garbage collected world. I'm not saying that Java is a bad language, or that people shouldn't use java. If you like it, use it, there are things about it that are great. I just think it's inappropriate as a beginner language because it hides things that are essential for new programmers to understand. Jul 13, 2012 at 16:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.