Hacker Newsnew | past | comments | ask | show | jobs | submit | atomicpuffin's commentslogin

Java is great for exactly that reason. It gives students an introduction to compilation, runtimes, stacks and heaps etc. Perhaps you had a poor learning experience due to who/what was teaching you rather than Java? My second comp sci course in college (first if you count high school AP credits), taught me all of this, and prepared me for the "full details" of MIPS and C.


My main complaint about Java as a pedagogical language is that it's just so big, with so many complexities around semantics, compilation, runtimes, etc. So my fear is you end up spending as much time learning Java as you do learning how to build software. I wouldn't choose C# or C++, either. My sense, from working with others who came out of CS programs that relied on Java, is that they end up only really knowing how to work in Java, and therefore only really knowing their way around the ways of solving problems that come most naturally in Java.

It could be my chauvinism speaking. I'll admit to having some. My CS program taught us three relatively small programming languages (Scheme first, followed by C, and then MIPS assembly) in the first year before introducing OOP in the second year. So we ended up getting exposure to a variety of programming paradigms and environments, and came away with a lot of tools in our belt, and a fairly deep understanding of programming language theory and paradigms. And I did eventually find myself settled in a Java shop. When I did, I found that within only a couple months I had already developed a deeper understanding of the language than colleagues who had spent their entire careers working in it. And I believe a lot of that is because I had enough background knowledge to distinguish between, "This is how programming is done," and, "This is how programming is done in Java."


Pass by reference / pass by value is so syntactically batshit insane in Java that it shouldn't even be considered as an intro language option.

And before someone points out that, actually-technically, Java is always pass by value, I will pre-retort that reference-as-value isn't an argument we should ever be having about an intro programming language.

Either teach a systems language with unambiguous pointers, or teach something that abstracts consistently.


The only problem here is using the term "reference" for reference variables. If you would say "these are pointers to objects, but you can't actually do any pointer arithmetic", this would be a non-issue. The pass by value is not the problem here.


C and Pascal and even C++ have a very simple model. An address of a variable is a pointer. You can actually understand how memory is layed out on hardware and why you would want to pass references or pointers instead of copying very large data structures.


I'd sum up my feelings on intro Java as requiring too many "except when..."s.

I understand why (now), but at the time, it just added unnecessary cognitive load on top of already learning hardware models.

C and Pascal require fewer exceptions, despite a larger base knowledge requirement.


C# while isn't as bloated as Java isn't a good choice because, like Java forces OOP on you and doesn't allow free functions.

C++ is ok. Students can use a very simple subset of C++, they don't have to use the more advanced parts of it.

C is even better.

Go is fine, too.

Typescript is a good enough choice.


Learning C first would also introduce students to all of that as well, outside of the magic shell of Java and its tooling; get your compiler, get your text editor, and you are so much closer to the action. If I could have chosen what I started with I would likely have picked C, or possibly a LISP as well.


I went through Basic - > Pascal - > C - > C++ - > many other kinds of languages.

Thanks to C and C++ I did understand the most important bases of programming, how a program runs, how hardware works and the most important algorithms and data structures.

I think it's important to learn something that doesn't do too many abstraction but it isn't too low level like the assembly language.


The point is, it's a terrible first language because it's impossible to actually understand what's going on even in a basic "hello world" program until halfway through the semester. So inevitably you have to start them off by saying "here's a bunch of noise that you don't understand, but that's OK, just copy and paste it" which is a terrible habit to reinforce.

You need to understand

* access modifiers (public/private)

* classes

* static methods

* void return values

* the main() function

* modules (System.out.println)

Just to understand a basic "hello world". It's too much for first-time programmers.


Actually, the hello world doesn't seem that bad to me. And I program mostly in Python nowadays.

    class Test {
        public static void main(String[] args) {
            System.out.println("Hello world");
        }
    }
And then

    javac Test.java
    java Test
The class acts as a kind of namespace here, you don't need to go into OOP concepts for hello world at all. The beginner will have to understand

* Class is in file with the same name ¯\_(ツ)_/¯ and contains functions (maybe it'll help me later in organizing code?).

* Command line arguments (not strictly necessary concept but not too problematic either)

* Types - why is there String[] in the definition? (A must have in a statically typed language anyway)

* void - the function doesn't return anything (OK)

* public (not OK, some magic here)

* static (not OK, some magic here)

* Compilation vs. run step (a must have in a compiled language)

So IMHO there are just two concepts that could be thrown away. Or three, if you accessed CLI args from a library. But the meaning of public and static will come naturally when the students will learn about OOP.


> "here's a bunch of noise that you don't understand, but that's OK, just copy and paste it"

Sounds like excellent training for a long and successful career in enterprise Java.


  > * access modifiers (public/private)
I think you can omit the "public"s in the Java hello world (thereby making everything package protected, and sneakily sidestep the issue), but I don't want to ruin this machine by installing Java on it to make sure.

To be super thorough, you would also have to understand:

- semicolons (and the related issue of newlines being semantically equivalent to normal spaces)

- naming conventions (to explain why it's not "System.Out.Println" and "Main")


You can in C#, but not in Java. You can make it an enum, I think, to shorten all that. But my Java golfing knowledge is a bit rusty by now, admittedly.


I've just tried it and the main method indeed needs to be public.


You are right about first time programmers. But should people come to university without any prior programming knowledge?

If someone applying for an architecture degree or engineering degree is required to have basic drawing skills and basic math knowledge, why we shouldn't assume the same for CS?


Because computer science isn't about programming? That's exactly why a simple and elegant language should be chosen, one that allows to express the concepts that are taught. Java is such a horrible choice that it's laughable that it enjoyed this success at universities.


Yes, a simple language is better to teach CS. CS is not just about programming, but I think CS is about programming too and having a reasonable level of programming is useful.

If I was a teacher and I'm going to teach someone what a linked list is, or what a binary tree is, I can of course use natural language and drawing, I can use abstract algebraic concepts.

But the student should be also able to construct said structures and observe how they work. The same for any other concept.


Yes, and that's why a simple language is always preferrable to Java. It doesn't matter if a student has previous exposure to programming languages if this language can be taught in about two or three weeks worth of class.


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

Search: