JEP 445: Unnamed Classes and Instance Main Methods - don not move forward!
Remi Forax
forax at univ-mlv.fr
Sun Sep 17 20:07:11 UTC 2023
> From: "Arne Styve" <arne.styve at ntnu.no>
> To: "amber-dev" <amber-dev at openjdk.org>
> Sent: Friday, September 15, 2023 5:08:04 PM
> Subject: JEP 445: Unnamed Classes and Instance Main Methods - don not move
> forward!
> I recently came across this JEP, and was very surprised. Why on earth should you
> add features to a professional programming language just to apparently make it
> a bit easier for students and beginners to learn to code? And especially when
> the suggested feature has no real use (and cannot be used) once you learn to
> program OOP properly?
> I’ve been a SW-developer and manager for more than 20 years, and a teacher of
> OOP at University for 15 years, and have never, ever experienced that the
> public static void main(String[] args) have been remotely problematic for
> students in learning to program.
> Please have this JEP terminated.
This JEP is really about Java enboarding, i.e. how it is easy to use Java in the small.
In Java, there are 3 level of encapsulation, you have the class, the package and the module. These levels helps developers to focus on what is important and avoid to have to specify what is not, depending on the kind of program you want to write. Currently, there is an unamed package, there is an unnamed module, but there is no unnamed class. This JEP aims to fix that.
Having an unnamed class is not only important for teaching, it's also important for scripting. Scripting in Java is great and not so great at the same time. It's great because the script will work the same way on all major platforms even Windows and not so great because there is the unecessary ceremony of creating a class when what you really want is write a small script.
I think that people should be albe to write their scripts in Java. That why we have added the support of shebang in JEP 330. That's why there is a JEP in draft to allow to split a script into several files [1]. And that's why there is this JEP, that simplify the creation of scripts.
And as a teacher myself, there are several reasons why creating a class and writing "static void main(String[] args)" without understanding what it means is a bad idea.
- We are showing how to create something before showing how to use it, it should be the other way around,
- Understanding what 'static' means is not obvious, it has several meanings and it's hard to understand what it is without understanding what an instance is first,
- Understanding what a class is is not obvious, it's easier to start by using the JDK classes before creating your own classes,
- Some students believe a computer is magic, starting by an incantation is not the right way to demystify it.
regards,
Rémi
[1] https://openjdk.org/jeps/8304400
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20230917/2b663316/attachment-0001.htm>
More information about the amber-dev
mailing list