News for hackers. Stuff that matters.
[dead]
Re:New language features since Java 8 to 17 by dang on Sunday October 24, 2021 @05:20PM (#28982045)
Please don't take HN threads on boring generic tangents (by making grand shallow claims), and especially please don't take HN threads into tedious programming language flamewar.

Also, you broke the site guideline asking people not to go on about downvotes in the comments. Would you mind reviewing https://news.ycombinator.com/newsguidelines.html and sticking to them in the future? We'd be grateful.

Re:New language features since Java 8 to 17 by brundolf on Sunday October 24, 2021 @04:16PM (#28981468)
Counterpoint: it's become a fairly multi-paradigm language at this point, and a multi-paradigm language is exactly what should be the defacto language in curriculums

Whether or not Java is the best one for this purpose is up for debate, but I think it's no longer a bad one

Re:New language features since Java 8 to 17 by Athas on Sunday October 24, 2021 @05:09PM (#28981947)
> Counterpoint: it's become a fairly multi-paradigm language at this point, and a multi-paradigm language is exactly what should be the defacto language in curriculums

I'm surprised you would say this, as it is the exact opposite of my experience as university teacher. I think we should teach concepts, and concepts appear much more crisply in small and focused languages. I think students gain more from being exposed to specialised languages than to more muddled multi-paradigm languages. For example, functional programming is much clearer in a language such as SML or Haskell than in Scala or F# (although the latter isn't that bad), because you can actually teach the whole language without any part of it muddling the concepts. Similarly, I would rather teach object-oriented design and implementation with, say, Smalltalk than OCaml.

Now, industrial usage is a different matter - here I have no problem with multi-paradigm languages.

Re:New language features since Java 8 to 17 by brundolf on Sunday October 24, 2021 @05:19PM (#28982030)
An assortment of specialized languages in different paradigms would probably be better than a single multi-paradigm language. But I was assuming the "CS 101" case, where you're just trying to get a feel for code and probably don't want to be overwhelmed with learning several different languages at once. In this context I think laying a foundation with a single versatile language makes the most sense - a "sample platter", if you will - and then later courses could dive deeper into different paradigms using more specialized languages (where those paradigms would already be familiar because of that base language, but they'd get brought into more clarity).

Another advantage of laying this kind of foundation is that even if the initial course stuck to a limited set of features, students could then go out and use the things they've learned and explore other features adjacent to them at their leisure, without going too far outside of that initial comfort zone (and - maybe most importantly - using the same tooling/environment setup, which can be the biggest barrier to new programmers who want to try out different technologies)

I'll admit though that this is mostly speculation on my part

Re:New language features since Java 8 to 17 by Athas on Sunday October 24, 2021 @05:29PM (#28982110)
I suppose it depends on how long that CS 101 course would be. At our department, we used to have an initial half-semester course that taught computational problem solving and programming using Standard ML. It was necessarily based on functional programming, although Standard ML is impure enough that we could also do simple IO. In the next course, they were taught object-oriented design and programming in Java. This has been replaced with a single course that uses F# (a multi-paradigm language) to teach a mixture of functional, imperative, and object-oriented techniques. It is not my impression that the students are left with a very clear conception of these ideas afterwards. Mostly they just seem to loathe F# - more than prior generations loathed Standard ML, even though F# is far more practical and has far better tools.

There can be many reasons for this, but I think people completely new to programming do not have the maturity to juggle multiple paradigms within such a short period of time, and within the same language. Perhaps switching to a materially different language when switching concepts actually helps them, so they don't mix up things too much.

Re:New language features since Java 8 to 17 by brundolf on Sunday October 24, 2021 @05:40PM (#28982184)
Interesting. I guess my thinking was that "paradigms" are mostly artifacts of a) history, and b) ways of describing ideas which at production scale may lend themselves better or worse to a given problem space (in terms of maintainability, etc), both of which are good to learn eventually, but neither of which matter that much when you're just trying to figure out what code is.

But I guess when you're just trying to figure out what code is, it helps to be able to form very consistent and concrete understanding around basic atoms like "what is a variable?". So if a language has different syntaxes that look similar but don't follow the same rules, that could get bewildering fast. Especially in languages that have sprawled over time and have competing ways of doing the same things.

Maybe the best answer is a language that was designed holistically to be cross-paradigm from the outset? In contrast with a kitchen-sink language that's gathered features over the years

Edit: Another thought; there may be a distinction to be made between "mixed-paradigm" and "cross-paradigm", where one takes the best pieces from multiple paradigms and works them together into a complete whole, while the other just dumps multiple entire paradigms into the same language. Rust for example does a great job of mixing-and-matching without sprawling (not that it would necessarily be a good first language, but for the sake of example)

Re:New language features since Java 8 to 17 by igouy on Monday October 25, 2021 @12:29PM (#28989747)
> … a language that was designed holistically to be cross-paradigm from the outset?

http://mozart2.org/mozart-v1/doc-1.4.0/tutorial/index.html

https://www.info.ucl.ac.be/~pvr/book.html

Re:New language features since Java 8 to 17 by kaba0 on Monday October 25, 2021 @04:09AM (#28985498)
I agree with you - so teach both Java (for OOP) and Haskell (for FP). But I do find Java a perfect candidate for teaching about “traditional” development, where students get the benefit of static typing with easy to digest error messages (not that much runtime failure in specific circumstances that is really hard to debug as a beginner), well-defined behavior all-around (okay, not with regards to concurrency but that’s another topic — but not having your program segfault is very useful), understanding lower level memory details is in my opinion easier tacked on knowledge of a higher level language, so GC is a great start, and all around an easy/small language where the language primitives can be built upon in basically every other language.
Re:New language features since Java 8 to 17 by kjeetgill on Sunday October 24, 2021 @07:55PM (#28983079)
I've never taught, so naturally I'd defer to you on such matters but I feel completely the opposite. I suppose it depends on what year students you're teaching too but for me, elements of functional programming first clicked for me in Python precisely because I could compare how to solve the same problems in the same language so differently.

I didn't get as lost in the incidental differences between languages like how do I print or import function, etc. but just how I might implement just one part of my program more functionally, how it'd help me reason better about that chunk.

I suppose it shows that I rep Java and Python all day, the champions of compromise, jack-of-all-trades languages.

Re:New language features since Java 8 to 17 by igouy on Monday October 25, 2021 @12:25PM (#28989697)
> … concepts appear much more crisply in small and focused languages.

How about a multi-paradigm language that isn't muddled?

http://mozart2.org/mozart-v1/doc-1.4.0/tutorial/index.html

Re:New language features since Java 8 to 17 by dunefox on Sunday October 24, 2021 @05:22PM (#28982058)
> it's become a fairly multi-paradigm language at this point

It's still very much an OO language with borrowed features.

> a multi-paradigm language is exactly what should be the defacto language in curriculums

Debatable. Multi-paradigm languages without a strong focus can overwhelm someone completely new.

Re:New language features since Java 8 to 17 by weatherlight on Sunday October 24, 2021 @05:02PM (#28981885)
Is it though? just because it has lambdas, does that make it functional?
Re:New language features since Java 8 to 17 by kaba0 on Monday October 25, 2021 @04:12AM (#28985515)
Yes.

Like there is no one definition of most paradigm’s, but what used to be the most FP language, LISPS definitely don’t conform to the more strict FP-definitions like pureness, strong type system, etc. What remains is simply having functions as first class citizens and you can very much save functions into maps or whatever in Java.

Re:New language features since Java 8 to 17 by weatherlight on Monday October 25, 2021 @09:12AM (#28987369)
...and therein lies the problem.

having some sort of syntax for lambdas does not a function programming language make.

There's nothing about the Java syntax or design that lends its self to FP. Lambdas were bolted on to the language after the fact..

That's like saying Scheme is Object oriented because its trivial to make objects from closures, and should one decide to go deeper, you could easily define macros for classes, methods, etc.

It's grossly disingenous to call Java functional, or even compare it to other functional programming languages.

Re:New language features since Java 8 to 17 by grishka on Sunday October 24, 2021 @04:25PM (#28981538)
Being verbose is a plus. I really really really hate the terseness of Kotlin and how it's basically unreadable without an IDE.

Languages should be dumb. Standard libraries should be smart. Not the other way around. The number of syntax constructs that generate standard library calls when compiled should be minimized as much as possible.

Edit: one more thing, operator overloading is extremely harmful for readability.

Re:New language features since Java 8 to 17 by BMorearty on Sunday October 24, 2021 @04:31PM (#28981601)
Being verbose is one of the biggest negatives a programming language can have. When you’re working on a team with other programmers and reading someone else’s code, verbose code takes much longer to read and grok because you have more boilerplate code to read.
Re:New language features since Java 8 to 17 by grishka on Sunday October 24, 2021 @04:35PM (#28981634)
But reading terse code requires a lot more prior knowledge, which you might not have. You learn to recognize patterns in the boilerplate and just glance over it, taking no additional time.
Re:New language features since Java 8 to 17 by BMorearty on Sunday October 24, 2021 @04:43PM (#28981712)
It definitely does not take “no” additional time to read verbose boilerplate code.

As for prior knowledge, that argument doesn’t fly. A lot of the verboseness of Java could be addressed VERY easily with clear syntax that doesn’t require a lot more prior knowledge. An example is getters and setters, which are very easy to understand in languages that have built-in support for concise syntax but Java has somehow ignored the advantage of concise syntax for 25 years.

Besides, if your argument is that Java doesn’t require “prior knowledge,” I beg to differ. E.g., correct usage of arrays vs. ArrayList.

Re:New language features since Java 8 to 17 by grishka on Sunday October 24, 2021 @05:01PM (#28981876)
Heh, getters and setters. An unpopular opinion, but imo you don't need them most of the time. Usually, a getter just returns a field and a setter just assigns it. If that's the case, and unless you're writing a public API of a library, just make the field public. Make it public final if it's read-only.

The difference between arrays and ArrayList is simple: an array has a constant size known at the time of allocation.

Re:New language features since Java 8 to 17 by skneko on Sunday October 24, 2021 @04:50PM (#28981771)
> E.g., correct usage of arrays vs. ArrayList.

Arrays vs lists is a thing in all languages, not Java. They just have different names (list, vector, sequence...)

Re:New language features since Java 8 to 17 by kayodelycaon on Sunday October 24, 2021 @04:56PM (#28981821)
I don’t think Ruby or Python have linked lists, only arrays.
Re:New language features since Java 8 to 17 by mattnewton on Sunday October 24, 2021 @05:10PM (#28981951)
Ruby and python only have an equivalent to Java’s “array list.” It’s not in the standard library, but you can trivially make linked list nodes yourself if the problem calls for it; I don’t remember encountering a need for the data structure over the built in array-list type outside of interview questions anyways.
Re:New language features since Java 8 to 17 by skneko on Sunday October 24, 2021 @05:06PM (#28981924)
ArrayList is not a linked list, it's an array-backed list like List in C# or other languages, like the name implies. Linked list is `java.util.LinkedList`.
Re:New language features since Java 8 to 17 by weatherlight on Sunday October 24, 2021 @04:38PM (#28981668)
garbage collected programming languages are for people, not computers.

Kotlin isn't terse.

Re:New language features since Java 8 to 17 by edoloughlin on Sunday October 24, 2021 @05:03PM (#28981893)
I think I could make the same argument for terse code.
Re:New language features since Java 8 to 17 by filoeleven on Sunday October 24, 2021 @05:11PM (#28981968)
> Languages should be dumb. Standard libraries should be smart. Not the other way around.

This is a strong argument for Clojure. The language makes helpful and readable guarantees about data shape, and provides a wealth of functions that operate on its core data structures.

Kotlin has a bunch of inferred classes, and Java has a bunch of explicit ones. Clojure recognizes that data does not look like either of those: it’s fundamentally a sequential list of things or a key/value map of things. Everything else is a special case that only your program cares about, and it gives you the tools to build a system to work with them as generally or specifically as you need it to.

Re:New language features since Java 8 to 17 by kaba0 on Monday October 25, 2021 @04:14AM (#28985527)
That is data. Not every problem is fundamentally about data though — the special case you mention may very well be the whole problem domain. Eg. what percent of data does a compositor work with vs state-holding objects with proper structures like WindowLayoutEngine and the like?
Re:New language features since Java 8 to 17 by filoeleven on Tuesday October 26, 2021 @12:36PM (#29002549)
I’m not familiar with compositors, so unfortunately I don’t have a ready answer, only more questions.

What makes a WindowLayoutEngine “a state-holding object with proper structures?” How is it different from “a data tree with proper structure,” except that the former includes methods inside the class instance while the latter relies on functions to operate on the data tree?

Re:New language features since Java 8 to 17 by aww_dang on Monday October 25, 2021 @02:38AM (#28985022)
I like verbosity. I like knowing what I am getting. I like explicitly specifying the defaults, rather than assuming or having the details buried in the documentation.

Solving problems and formulating a problem solving approach takes time. This is the important part of writing software. A few extra keystrokes are relatively minor in comparison.

"I want to write software, but I don't want to type too much", never made sense for me.

Re:New language features since Java 8 to 17 by goatlover on Sunday October 24, 2021 @05:14PM (#28981989)
"The utility of a language as a tool of thought increases with the range of topics it can treat, but decreases with the amount of vocabulary and the complexity of grammatical rules which the user must keep in mind. Economy of notation is therefore important." - Notation as a Tool of Thought by Kenneth Iverson
Re:New language features since Java 8 to 17 by V-2 on Sunday October 24, 2021 @05:09PM (#28981942)
If Kotlin is unreadable without an IDE, it's Kotlin done badly. You can misuse its features to obfuscate the code, but in and of itself it's an extremely clear language.
Re:New language features since Java 8 to 17 by grishka on Sunday October 24, 2021 @05:12PM (#28981978)
Kotlin relies on the developer to write readable code, and just generally offers way too many ways of doing the same thing. Too much freedom of expression. Java, by virtue of being more verbose, requires writing everything out explicitly, so you really have to expend some extra effort to make your code unreadable.
Re:New language features since Java 8 to 17 by V-2 on Monday October 25, 2021 @05:09AM (#28985843)
"generally offers way too many ways of doing the same thing"

Such as?

"Java, by virtue of being more verbose, requires writing everything out explicitly, so you really have to expend some extra effort to make your code unreadable."

Boilerplate is what makes code unreadable. Getters, setters, backing fields, all that noise, takes lots of space getting in the way of grasping the meaning of the code. Java is too much about how instead of what.

Re:New language features since Java 8 to 17 by grishka on Monday October 25, 2021 @11:20AM (#28988807)
Incapsulation is very much overrated.
Re:New language features since Java 8 to 17 by wyager on Sunday October 24, 2021 @04:45PM (#28981733)
The tradeoff space you’re describing doesn’t reflect reality. Adding more brackets and pointless keywords to a language doesn’t meaningfully improve the programmer experience in any way. There are plenty of terse languages that don’t require an IDE to understand. If anything, Java effectively requires an IDE to use because it’s so verbose.

The things that I write in a computer program’s code should correspond as closely as possible to what the program means - nothing more and nothing less. Java is terrible at this.

Re:New language features since Java 8 to 17 by BMorearty on Sunday October 24, 2021 @04:51PM (#28981780)
Excellent counterpoint about Java requiring an IDE because it’s so verbose. In fact when I complain about Java’s verboseness, Java fans tell me “who cares, just use your IDE’s ability to auto-generate code!” But of course that doesn’t help with the _reading_ of verbose code.
Re:New language features since Java 8 to 17 by kaba0 on Monday October 25, 2021 @04:18AM (#28985564)
Counterpoint counterpoint: an IDE is most definitely not required to write Java, but due to the ecosystem’s size, reliance on IDE and language’s simplicity (that does cause some additional verboseness), Java’s IDEs are top notch and I wager that you actually type less characters for the same codebase in Java than in some less verbose language due to them. So all in all, win-win with more readable code and less typing.
Re:New language features since Java 8 to 17 by ksec on Sunday October 24, 2021 @04:26PM (#28981556)
>if the point is to teach OO.

Is it really the point to teach OO though?

Java is being used everywhere. And you get to learn the basic as well as the huge ecosystem behind it. Apart from possibly Python, are there any language that get you both in terms of market and learning?

And Java have make huge improvement in every part of the ecosystem, from languages, standard library, VMs. While I still dont like the language much, but I have gotten off the so called busy and verbose code view as I age. As they do serve some purpose. We need better balance, right now languages design are binary and polarised options.

Re:New language features since Java 8 to 17 by dukeyukey on Sunday October 24, 2021 @04:26PM (#28981550)
I agree with everything here except the "should stop being taught as the defacto language in computer science curriculums". Realitically, a CS curriculum needs to at least vaguely prep a student for life in the industry, and Java is not only massively popular, but is also a great way of showing how OO is used in practice i.e. kinda badly. No point teaching everyone about beautifully architected Smalltalk programs just to have them work on hacky Java monoliths from 2003 (not to mention BusinessObjectTpyeFactoryGenerator.java).
Re:New language features since Java 8 to 17 by tialaramex on Sunday October 24, 2021 @07:32PM (#28982916)
> Realitically, a CS curriculum needs to at least vaguely prep a student for life in the industry

It's sad that people see the primary teaching language of a CS course as somehow important for this purpose. Sad that students see it this way, sad that their parents see it this way and particularly sad that would-be employers often see it this way too.

Particularly languages favoured by industry are unlikely to offer CS students anything to be passionate about. Yes, it's true that lots more of them will get jobs maintaining code written in a then-current Java in 2005 than will be writing green field Haskell. But if we just wanted code monkeys a three (or four) year degree is massive overkill.

Re:New language features since Java 8 to 17 by weatherlight on Sunday October 24, 2021 @04:28PM (#28981576)
teach javascript, ruby, rust, go, kotlin....scheme.

literally anything else.

Re:New language features since Java 8 to 17 by ksec on Sunday October 24, 2021 @04:30PM (#28981593)
Apart from Javascript. Ruby, Rust, Go, Kotlin and Scheme combined wouldn't equal to half the market Java has to offer.
Re:New language features since Java 8 to 17 by weatherlight on Sunday October 24, 2021 @04:36PM (#28981653)
thats the status quo fallacy.

You can get work in those other languages, nor is an understanding of Java a prerequisite for understanding how to use those other langs, etc.

Re:New language features since Java 8 to 17 by hawk_ on Sunday October 24, 2021 @04:51PM (#28981786)
how's javascript better than java in its design or elegance?
Re:New language features since Java 8 to 17 by weatherlight on Sunday October 24, 2021 @09:55PM (#28983746)
Well for one, it has a repl. As per single core performance, javascript is faster and has had first-class-functions from the beginning.

and you don't need 10 lines of code to print hello something to the screen.

and JavaScript(ES6) is actually multiparadigm.

don't get me wrong, JS has its warts (and oh my god that is indeed the case.) but you can literally run it in any browser any where, which makes for an excellent teaching aid.

Elegance isn't the first word I'd reach for when describing Java

Re:New language features since Java 8 to 17 by kaba0 on Monday October 25, 2021 @04:22AM (#28985589)
> Well for one, it has a repl

Jshell

> As per single core performance, javascript is faster and has had first-class-functions from the beginning

Doubt. And no matter how I count, Java had first class functions for 8 years now, at the very least. Does it really matter when exactly did a language feature got implemented?

> and you don't need 10 lines of code to print hello something to the screen.

jshell: System.out.println(“hello world”)

> and JavaScript(ES6) is actually multiparadigm.

That hardly means anything. There are entirely FP libs available for Java.

Re:New language features since Java 8 to 17 by weatherlight on Monday October 25, 2021 @09:16AM (#28987398)
Javascript is faster than java... sorry... the JVM is slow.

and ugly and verbose and all the things you mentions are bolted on after that fact or not even apart of the core programming language. which hurts your agreement of its being "elegant" or "designed well"

Re:New language features since Java 8 to 17 by kaba0 on Monday October 25, 2021 @10:04AM (#28987937)
I would like to see some benchmarks on that. I like the V8 engine, it is also a marvelous engineering feet, but it is simply not made for the workloads that the JVM can routinely handle, like heap size up to terabytes. It’s not an accident that serious server applications usually run on top of the JVM.

Also, a JIT compiler written in Java running on top the JVM interpreting (though in a clever way) javascript can match the speed of V8, just saying. Look up TruffleJS!

Re:New language features since Java 8 to 17 by hawk_ on Monday October 25, 2021 @05:39PM (#28993474)
i think you're referring to startup time not actual runtime of long running tasks
Re:New language features since Java 8 to 17 by cyberbanjo on Sunday October 24, 2021 @04:57PM (#28981839)
I think a well rounded course would touch all the popular paradigms, and logic.
Re:New language features since Java 8 to 17 by vletal on Sunday October 24, 2021 @04:26PM (#28981549)
There is still a huge market demand for Java. Moreover the recent releases are doing a great job adding features following recent trends. If thought using JDK 16+ a student will be able to move to Kotlin, Swift, Scala, ... much more easily than few years ago. IMO it's more about updating the curricula than dropping Java.
Re:New language features since Java 8 to 17 by imheretolearn on Sunday October 24, 2021 @04:09PM (#28981418)
Could you please support your statement with reasons?
Re:New language features since Java 8 to 17 by ronri19 on Sunday October 24, 2021 @04:36PM (#28981651)
Not sure about the person above but the following are my opinion on why I don't like Java:

1. no unsigned integers

2. no freestanding functions

3. pom files are a huge pain

4. the com.blah.blah.blah ridiculously long package path precedent makes it awful to work with if you don't have an ide

5. you can't actually use javac to compile your code. everything is so big and complicated you have to use ant, gradle, maven, etc.

6. too much boilerplate. "public static void main" etc.

There's a few more, but they'd take more than a sentence to explain.

Re:New language features since Java 8 to 17 by xxs on Sunday October 24, 2021 @04:50PM (#28981767)
>no unsigned integers

technically, char is unsigned. For practical purposes use ByteBuffer.

>no freestanding functions

you can "import static" all the static functions you want; it's not any different than C, where you need to include the headers.

> pom files are a huge pain

That has nothing to do w/ java, itself, like at all.

>you can't actually use javac to compile your code. everything is so big and complicated you have to use ant, gradle, maven, etc.

If you use ant, how did you get to use pom? That's pretty much saying that using 'make' is terrible. For personal projects that involve no web, I don't quite need anything else but the JDK, itself. In that case, it's totally doable to call javac form the command line.

Re:New language features since Java 8 to 17 by karmakaze on Sunday October 24, 2021 @05:06PM (#28981922)
Great (unintended) straw-man comment. These are all minor reasons in the context of an introduction to developing software. Yes, there's some initial setup, but once that's done and you're learning how programs are constructed with classes, objects, methods and where static typing can help you, they're all the important things that will carry you well into a career.
Re:New language features since Java 8 to 17 by dunefox on Sunday October 24, 2021 @05:13PM (#28981986)
Just because you can have a career in Java despite the disadvantages does not mean that they're not disadvantages that most other languages don't have.
Re:New language features since Java 8 to 17 by karmakaze on Sunday October 24, 2021 @06:30PM (#28982527)
Wasn't suggesting that one make a career of Java, but rather apply the knowledge learned in using a statically-typed, compiled language with OO and functional bits. Hopefully advancing to using languages with type-inference as one progresses.
Re:New language features since Java 8 to 17 by kaba0 on Monday October 25, 2021 @04:26AM (#28985618)
For beginners, you can literally write Java the same way you would write python.

Write class Hello { public static void main(String[] args) { … }} into a Hello.java file and issue java Hello.java and it will compile and run your code. It hardly gets easier than that.

Also, it’s a bit unfair mixing in build tools for beginner courses - I doubt beginners start with python virtual envs either. And then don’t get me started on the multi giga node folder hell that you get from a simple Js project.

Re:New language features since Java 8 to 17 by dvdkon on Sunday October 24, 2021 @04:51PM (#28981779)
Lots of other good arguments have been posted, but I'd like to say something to the teaching aspect. In high school, we had four years of Java. I already knew most of the curriculum at the start, so others would sometimes ask me for help with assignments. Quite a few times, even after years of school, I'd run into people being confused by classes, instances, what curly braced blocks meant on a class vs on a control statement...

You could say the class should've been taught better, or that the students just weren't good enough, but I think a good tool (programming language) should help users, not be a barrier to overcome. Programming in Java doesn't require too many concepts, but you have to start with all of them at once, and I think some students just never got over that initial step.

It's of course debatable whether another language would have been better or whether Java really contributed to the problem, but I think we can agree there are languages that better lend themselves to teaching complete beginners.

Re:New language features since Java 8 to 17 by Longhanks on Sunday October 24, 2021 @04:24PM (#28981529)

  public class Main {
      public static void main(String[] args) {
          System.out.println("Hello, world!");
      }
  }
vs

  print("Hello, world!")


Please comment again if you still cannot see the bloat/unnecessary verbosity.
Re:New language features since Java 8 to 17 by grishka on Sunday October 24, 2021 @04:25PM (#28981547)
Global scope is a terrible invention. The less implicitness there is, the better.
Re:New language features since Java 8 to 17 by valenterry on Sunday October 24, 2021 @09:40PM (#28983666)
Global scope is not a terrible invention and if you look carefully then you will notice that the Java version uses it as well.

Or where is the import to get "System" into scope? It's imported globally everywhere (just like all everything from java.lang).

So the only question is: should "print" be burried under layers or not. I don't think the advantages of burrying are really worth it.

Re:New language features since Java 8 to 17 by kaba0 on Monday October 25, 2021 @04:28AM (#28985640)
OP meant the public static void main part (that is you define what happens encapsulated in a class) Of course implicit imports are needed, like what else would you have without?
Re:New language features since Java 8 to 17 by valenterry on Monday October 25, 2021 @04:44AM (#28985747)
> that is you define what happens encapsulated in a class

Apart from that it is really unintuitive to have something "static" within a class (which is commonly understand as a template), it is not encapsulated because it is static _and_ public. _And_ now you can search for this thing everywhere - and what happens if you find two of them?

Yeah no, the idea of "public static void main" wasn't a great one, no matter how I look at it.

It's much better to be explicit and ask the user to decide which file they want to use as the starting point.

> Of course implicit imports are needed, like what else would you have without

They are of course not needed. You could also just import everything manually. Okay, Java's import suck, but in a better language you could do "import prelude._" in the beginning of every file and otherwise you are left with keywords only. Not saying that's a great idea, but it certainly can work without implicit imports.

Re:New language features since Java 8 to 17 by weatherlight on Sunday October 24, 2021 @04:29PM (#28981587)
then write assembly.
Re:New language features since Java 8 to 17 by kjeetgill on Sunday October 24, 2021 @08:02PM (#28983117)
What? Barring the stack, everything's essentially global in assembly. Like you can touch your process whole address space from anywhere!
Re:New language features since Java 8 to 17 by weatherlight on Monday October 25, 2021 @09:18AM (#28987428)
also, everything is explicit. the op seems to correlate the two.
Re:New language features since Java 8 to 17 by grishka on Sunday October 24, 2021 @04:33PM (#28981623)
What I'm trying to say that at some point in piling up abstraction layers, abstractions stop being helpful and start getting in the way.
Re:New language features since Java 8 to 17 by kaba0 on Monday October 25, 2021 @04:27AM (#28985628)
But that verbosity doesn’t scale with code size, so it is largely meaningless.
Re:New language features since Java 8 to 17 by BMorearty on Sunday October 24, 2021 @04:26PM (#28981563)
“It’s extremely busy and verbose” were the reasons.

I agree with those reasons and I’ve always felt Java sucks because of them. When Java first came out I was a C/C++ programmer and was excited to learn it. Very quickly became disillusioned because it was incredibly verbose. I hoped the language would evolve quickly but it took FOREVER. Meanwhile Microsoft introduced C#, whose v1 looked like a copy of Java, and very quickly evolved the language to make it much better. They did what I hoped Sun Micro would do. But Sun just sat there and twiddled their thumbs.

Re:New language features since Java 8 to 17 by lordnacho on Sunday October 24, 2021 @04:37PM (#28981658)
Java sucking could be a good reason to teach it, no? It's instructive to know what bad choices have been made. Much like your first job, it can be unfortunate to work in a place where everything functions properly, because you won't know what makes it work.

Java is also a good base for looking at other JVM languages, and for looking at the JVM itself. That's gotta be part of a good curriculum too, doesn't it?

Re:New language features since Java 8 to 17 by dunefox on Sunday October 24, 2021 @05:15PM (#28982004)
That's a horrible reason to use a language for teaching.
Re:New language features since Java 8 to 17 by leetcrew on Sunday October 24, 2021 @04:27PM (#28981568)
strictly from a pedagogical perspective, sure, there are better choices. but java is at least decent for most of the core cs curriculum, and it's widely used in industry. when you're trying to get your first internship with no work experience, it's nice to be familiar with the language you'll be using at work.
Re:New language features since Java 8 to 17 by ptstomp on Sunday October 24, 2021 @04:22PM (#28981507)
Regardless of OO 'quality' of a language, if you consider that most university degrees are an avenue to successful employment then it's easily one of the best ones to learn due to the current market alone.