Hacker News new | past | comments | ask | show | jobs | submit login

Completely agree. I'll be teaching my kids Java first, if they want to learn programming.



My kids, like their dad, won't have the patience to create a singleton main object, with a print method, just to run "print 'hello world'".


  public static void main(String[] a) { System.out.println("Hello world");}
Yeah you're right. That's an insane amount of typing which would take any kid hours.

I had to muster up all of my patience just to type all that code out. You're right! Java is so verbose!

Your "argument" if you can call it that, is like people saying lisp is crap because it uses too many brackets.


So let me say first that Java was my first language, and I don't believe I've been corrupted in any nasty ways.

I was 10 when I learned Java, and it always threw me off having to copy those first two magic lines which I never understood. What is 'public class'? Why 'static'? What even does the word 'void' mean? 'String[]'?!

Sure, after a few months I figured out the meaning of all of those words -- but it wasn't nice having to do that "open up last file I wrote / copy magic header to new file".

I don't think it's wrong to teach Java as a first language, but I think that there are better first languages which show what real computer science is faster than Java does. Less coercion of a language to do what you want and more free-flowing ideas.


First off, even removing line breaks it is still verbose. I can't think of another language that's even close. Even C++ would give you a shorter version.

Far more important though is how much stuff is in that one line of code that needs to be understood in order for what you are typing to be more than just arcane magic words. Pedagogically speaking that is an awful way to get started, so I think the claim that that is not a great way to teach kids is pretty valid.

To be fair I fully agree that 'Hello world' is not a good way to assess the worth of a language in general, but the ease of getting started is a valid concern when using a language to introduce programming


You forgot the class:

    class M { public static void main(String[] a) { System.out.println("Hello World"); } }
The problem with using this as learning material is that the teacher has to treat the majority of the code as "magic" until the student is ready to learn about classes, access permissions, methods, arrays, namespaces, types and so forth.

In many other languages, there's much less boilerplate to handwave away:

    print("Hello World")
    puts "Hello World"
    (println "Hello World")


But you don't actually need the main:

class a{static{System.out.println("Hello world");System.exit(0);}}


I'm not sure that's any better. The static block is rarely used in Java, so I think you'd probably be better off teaching them how to use main.

It also doesn't cut down much on the amount of boilerplate you need.


Your example illustrates one of the main problems with verbose languages. Imagine showing this line of code to a child! I think anyone new to programming would be completely baffled. Before they could understand even the "simplest" Java program they have to know what is meant by public, static, void, main, String, arrays and more...


> which would take any kid hours

> Your "argument" if you can call it that

From Hacker News guidelines ( http://ycombinator.com/newsguidelines.html):

"Be civil. Don't say things you wouldn't say in a face to face conversation. When disagreeing, please reply to the argument instead of calling names."


I would certainly say a lot worse face to face :)


I think the guidelines assume you act socially in real life.


No no no...lisp is crap because it has too many parens not brackets. ;-)


You forgot the

    class foo { ... }
And that it has to be in a name called foo.java. And that you have to compile it and run it with

    java foo 
instead of simply

    ./foo
And that startup time of JVM is orders of magnitude worse than pretty much anything else.


"And that startup time of JVM is orders of magnitude worse than pretty much anything else."

Sure, let's throw out of the window all the optimizations the VM can do at runtime because it takes a whole second to start the VM.

And you need to actually compile the source file before executing it!

Those server applications should all be written in bash because it's instantaneous!

Kidding aside, one prof at my university once told me that she wished students should still have to compile and wait for a program to start. When there is such a delay, it pays to read your code and try to understand it before running it (as opposed to run-and-see-what-happens).


> And that startup time of JVM is orders of magnitude worse than pretty much anything else.

This one never ceases to annoy me.

The JVM is optimized for LONG RUNNING PROCESSES. It's targeted specifically toward running on servers, because that's the default use case. There's about a million options switches, gc controls, etc if you want to run it in another way.

If you want fast startup time, try compiling with gcj or something.

In any event, I run a javac->java loop many times an hour when developing, and the startup time is un-noticable.


Yes, I think what you allude to is that Java is just too verbose and unnecessarily complex and I agree. That said, the tools available for Java (i.e. eclipse) are pretty nice.


Sure. You obviously don't want them to learn anything else after that.


My kids will get the full C drill. Basically the same way I learned programming.

Training wheels are only necessary if you could hurt yourself by practicing. Where there is no such a danger there is no reason not to start with the "hard" stuff. It's like learning guitar or piano - you don't have a practicing instrument with only two strings/5 keys that always sounds good and forgives errors.


I'd skip C and learn assembly personally.


For which architechture?


6502, 68000 and ARM are the most elegant.


Best way to learn is to do, so depends what hardware they have to play on.

I personally went Z80->x86->arm with a few others thrown in.

I'd probably suggest most people learn x86 and then arm.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: