3

I hope this isn't too off-topic and/or opinion based.

I'm looking for examples and reasons why Java is an acceptable language for education purposes.

Here's why: I learned programming on my own in C at the age of about 15. In school we used Pascal (which I think is quite OK, especially in educational context). In University, Java was used and I was disgusted. Examples:

Verbosity:

RenderingHints rh = new RenderingHints(
     RenderingHints.KEY_ANTIALIASING,
     RenderingHints.VALUE_ANTIALIAS_ON);
g2.setRenderingHints(rh);

Listener classes instead of functions.


No overloading (resulting in ugly .equals() and .get() instead of == and []).


When I was able to pick a programming language on my own again, I chose Python and everything "felt just right".

Now the problem is that I'm going to become a teacher for computer science in german secondary schools (grade 5-13), where I will be forced to teach Java.

So I'm looking for the pretty parts of Java. What is especially easy/readable/... to implement in Java?

Preferably in an educational context, but also from a professional programmer's point of view.

closed as too broad by gnat, Doval, Telastyn, user7043, GlenH7 May 16 '14 at 14:20

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    I suspect imperative languages in general are awful from an educational standpoint. They have weak type systems and encourage unnecessary mutation, which destroys your ability to use parallelism and reason rigorously about non-trivial code. Mainstream OOP languages are even worse, because inheritance is bad. Dynamic typing is also a trap. The main benefit to learning Java is that you'll have to use it in the real world; however, learning Java can come later, after the introductory courses. Further reading: existentialtype.wordpress.com/2012/08/17/… – Doval May 16 '14 at 13:45
  • 2
    @Jasper I think it's important to understand that everyone's definition of "pretty" will vary depending on a variety of things (personal history, level of proficiency, types of projects attempted). Without keeping that in mind, I doubt you'll be satisfied with any answer. As a sidenote, I'm slightly curious how it is that you were happy with both Pascal as well as Python, since they are nothing alike (IMHO). – Daniel B May 16 '14 at 13:58
  • 4
    Java: The Good Parts - shop.oreilly.com/product/9780596803742.do – Mike Partridge May 16 '14 at 14:14
  • 1
    This is an opinion, not an answer. The reasons that I like Java as a professional are not really applicable to education. Personally, I think MIT took the right path by using Python for their 6.01 class (replacing Scheme). But unless you can convince your superiors to change, you're stuck. And in the US, at least, Java is the language of the advanced placement test, so there's a strong barrier to change. – kdgregory May 16 '14 at 14:19
  • 1
    We all feel a little discust at something new. Personally all dynamically typed languages (and that includes python) discust me a little because they are missing all the verbosity that is actually checks and ballances catching my mistakes as I make them. Write something big in java and it will all make sense, it feels only a little harder than writing something small. Whereas other languages start off easy and get exponentially harder as the program gets bigger – Richard Tingle May 17 '14 at 23:23
2

The usual reasons for teaching Java are:

  • Object Oriented Design
  • Cross-platform development
  • Popularity

As a long time programmer, and former Java Developer, I've grown to hate Java. I was taught it in college (like everyone else), and I left college and went straight into Java development. Over time though, I was given more leeway on what platforms I could develop on, and I moved away from Java with some relief.

It's slow to develop in, it doesn't result in notably less buggy code, it doesn't result in faster code, and it doesn't result in better designed or more readable code. On top of that Oracle is more than a little evil, and I'd be more than a little leery of wedding myself to a technology they control.

Still, knowing Java will get you a job. The shit's everywhere.

  • 1
    "It's slow to develop in, it doesn't result in notably less buggy code, it doesn't result in faster code [...]" - compared to what? – m3th0dman May 16 '14 at 19:21
2

I think java is a great language for education purposes because it teaches some very important computer science / software engineering concepts such as

  1. strong typing - the most important of all. For those who are learning, I think this is the most important thing in a language. Students don't have to struggle trying to guess what's the return type.
  2. OO - Java has many influences from Eiffel and C++, it was being designed having OO concepts from the scratch (main() is a method from a class)
  3. I18n - it may be seem silly, but I think it's one less barrier to learn a language
  4. JVM - another thing that may be silly, but again, one less barrier to learn a language. No core dumps. You can always (almost always) get a reasonable error message. The same for garbage collection.
  5. Distributed / Parallel - Java had some nice features about serialization and, in the newer versions, some very very nice features for algorithm parallelization
  6. Last but not least, lots of free industrial-strength IDEs and libraries around there.
  • 1
    hm, I can see where my question is going... @1: Duck typing is one of my most favorite features of python, but we are really going opinion based here :( – Jasper May 16 '14 at 13:50
  • @Jasper "Duck typing" can be achieved in statically-typed languages with more powerful type and module systems, like Standard ML. It's called structural subtyping there, but the concept is the same - you can use anything that satisfies a certain set of requirements. The difference is you can turn runtime errors into compile time errors. – Doval May 16 '14 at 13:57
  • @Jasper this is why more than one language exists. Your idea of "a nice feature" is my idea of "hellish chaos". Although my more reasonable compromise (which I don't really believe) is that "scripting style" dynamically typed languages are most appropriate for small or temporary programs and statically typed languages are more appropriate for large projects (because you can more easily break them up in your head and trust the rest of the program to follow their method signatures) – Richard Tingle May 17 '14 at 23:38

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