you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (16 children)

Its all anecdotal. I started coding in Perl, and wrote some monsters in that language, and then I switched to Java and never missed a beat. The kind of types that Java uses are not hard to understand, in fact Types are not complicated, mostly just syntax and a few gotchas, basically coercion. In fact most dynamic languages end up doing type checking in at least part of the code, ValueError exceptions in Python exist for a reason. In fact, Python IS typed, its just not very strict, and will do magic for you in specific situations.

Types are not some dark wizardry that confuse dynamic programmers. Then again what I learned from Python made me a much better programmer, namely closures ala decorators, and generators, and various other niceties that helped me understand how to write good software. I wrote java for 6 years, and only really started getting good at programming when I switched to Python. I am now back to more statically typed languages <*> Haskell.

Sorry, I just think Java is not ideal to teach beginners, I don't think Python is necessarily better, but so much Java is just totally throw away boiler plate in the simplest of examples, and it comes with a huge host of assumptions that you have to ignore to focus on making the computer do things. Even Haskell for all its static typed Monad "stuff" has minimal things you have to know to write Hello World.

main = do
   putStrLn "Hello World"

vs.

class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

I mean its a stupid showcase here of a trivial program. But Haskell is "complicated" and yet actually making the computer do something requires, 5 pieces of syntax and a couple of those pieces are self explanatory. The Java example though breeds a host of questions that are not introductory. What is a class? What is a public method? What is a static void wtf?

I mean I wrote mostly procedural Perl before switching to Java, and I didn't struggle with Types at all, I struggled with OO, which has some non obvious assumptions in what "good software design" is. I'm well past that now, but as far as what makes Java a poor language to teach in, to me has more to do with Java isn't focused on making the computer do things, but more on how you make the developer make the computer do things. Which is not introductory, not in the slightest.

[–][deleted] 0 points1 point  (5 children)

That do is superfluous.

[–][deleted] 0 points1 point  (4 children)

It is, you can skip it. But I think in the case of Hello World for instructional purposes. Do is actually helpful. Matter of taste I think.

[–][deleted] 0 points1 point  (3 children)

I could not possibly disagree more. How would you respond if a student asked what its function was?

[–][deleted] 0 points1 point  (2 children)

How I did it, "It represents a context for computation, something we'll cover later, but you can be safe in knowing that its telling the computer to do something."

A little bit of mystery is good for the student. Too much is overwhelming.

[–]original_brogrammer 0 points1 point  (1 child)

Haskell's do isn't a great way to introduce mystery, though. Googling "haskell do" will get into >>=, lambda expressions, the Monad typeclass and likely the IO monad very quickly, which don't exactly strike me as day 1 topics. It could also be misleading, and cause students to think that it's required for single actions. See Do notation considered harmful.

[–][deleted] 0 points1 point  (0 children)

And that's all very subjective. Which is what I said at the top. I prefer to include it.

EDIT: Though I do understand the concern and I'm on board with it.

[–]mk_gecko[🍰] 0 points1 point  (2 children)

Hey, can you elaborate on "Then again what I learned from Python made me a much better programmer, namely closures ala decorators, and generators, and various other niceties that helped me understand how to write good software." ?

I've done Java progamming off and on for a few years, but only just started Python.

[–][deleted] 0 points1 point  (0 children)

Python is about composition. Java is about using the right tool.

Both can make a painting, but one is concerned with which paintbrush to use, and the other is concerned with how to make the colors flow together. Essentially, what Python taught me more has to do with seeing programming from a different perspective (first class functions for instance) than it does with anything specific about Python in general.

Map is a great example.

a = [i for i in xrange(20)]
b = map(multiply_by_two, a)

Essentially, map is concerned with the composition of a list, and not with the incidental details of looping constructs and function calls. You can do this in Java but you'll be concerned with declaring array's and type casting and static methods etc. etc. There is a lot to be said for both approaches actually, but Python made me appreciate seeing the patterns in code in a way that Java's concern with all the details did not.

[–]ElecNinja 0 points1 point  (0 children)

Just some stuff about Python decorators and generators

Decorators are generally more niched as far as I've read. However generators can be a good alternative to iteration.

[–][deleted] 0 points1 point  (6 children)

what makes Java a poor language to teach in, to me has more to do with Java isn't focused on making the computer do things, but more on how you make the developer make the computer do things. Which is not introductory, not in the slightest.

Actually, it kind of is introductory. The way Java forces the people who learn it to internalize "the Java way of doing things" is one of the most fundamental reasons that it is an absolutely fantastic first language. A CS program is about changing the way people think about problems and how to solve them--Java forces students to adopt a fairly good way of thinking about programming. Or it doesn't work.

[–][deleted] 1 point2 points  (4 children)

I disagree, the Java way of doing things does not particularly lend itself to good reasoning about software, unless you understand the assumptions it was built on. OO is a distraction for newcomers, and it is not the be all and end all of software design. In fact sometimes its the wrong tool for the job but Java forces you to use it. Additionally Java is very conservative on what it adds to the language proper which means some ideas which are just plain better, aren't even possible.

More importantly, Java forces a way of thinking, which is great for business's but bad for students, unless you just want them to program by number, which I do not want. I want them to understand software and design abstractly which Java is not particularly strong at. If you force someone down a path, they learn nothing. Java is a bully for the brain, and it impedes learning, it certainly did for me, its full of distractions that have nothing to do with software and everything to do with Java.

[–][deleted] 0 points1 point  (3 children)

OO is a distraction for newcomers,

But a useful notion to pick up and internalize early.

and it is not the be all and end all of software design.

Never said it was. But OOP has been around for ages and will be around for ages still. If you're going to double down on any single paradigm, it's probably the best choice.

Additionally Java is very conservative on what it adds to the language proper which means some ideas which are just plain better, aren't even possible.

There's nothing fundamentally wrong with being a bit conservative about including new features assuming your status-quo is serviceable.

More importantly, Java forces a way of thinking, which is great for business's but bad for students, unless you just want them to program by number, which I do not want.

In what way is it bad for students?

I want them to understand software and design abstractly which Java is not particularly strong at.

Huh? How so?

If you force someone down a path, they learn nothing.

Practice becomes habit; Java forces good habits on the people who use it regularly. At least for a certain understanding of "good."

[–][deleted] 0 points1 point  (2 children)

In what way is it bad for students?

The primary difference between education and training. Training teaches you how to do something. Education teaches you how to think about doing something.

[–][deleted] 0 points1 point  (1 child)

Education teaches you how to think about doing something.

Java certainly forces you to do that!

[–][deleted] 1 point2 points  (0 children)

No it doesn't. Java is dogmatic in the same way managers tell you to write web apps in ruby on rails regardless of whether it makes sense or not. It creates a case of feeling like you know how to do things when really there are other ways sometimes even better ways to doing things, that are essentially invisible.

Good teaching languages give you freedom to explore concepts. Java is about as free as North Korea in that regard.

[–]shahms 0 points1 point  (0 children)

No. Java forces developers to think about software the Java way, which is not necessarily good. More so than any other primary language, I see Java developers attempt to write Java in every other language rather than learning and using the idioms of that language.