JEP 445: Unnamed Classes and Instance Main Methods - don not move forward!
Nathan Reynolds
numeralnathan at gmail.com
Sat Sep 16 14:28:51 UTC 2023
I haven't decided if I am for or against this JEP. I would like to add a
few thoughts. They lean away from the JEP, but don't interpret that as my
rejection of the JEP.
I don't write main(). I use a framework and it has a main class to start
the application server. Out of the many users of the framework, only the
framework maintainer wrote a main(). So, any discussion about main() is
really for the maintainer and those not using a framework that has a main
class. I put all my server startup initialization in several
javax.enterprise.context. at Initialized. I need a class around the
@Initialized method to execute a bunch of logic.
On the other hand, I wrote a Swing application and a few other utility
programs. These have a main() method. I only wrote the main() method one
time. I made a few changes over the years to the main(). main() has
largely been forgotten as I spend most of my time in other parts of these
programs. The main() method is the least of my concerns.
Having a special way to write main() means a new syntax. It means learning
more and not less. Sure, it might mean the learning curve is less steep
(learn less upfront) but now the curve is higher (learn more overall). One
has to learn the traditional way to write main(). However, the height of
the curve is probably not much higher. Once someone has learned about
classes, access restrictions (i.e., public), return types including the
weird void, method parameters, static, then the traditional main() is just
another method with special use. I can see how having a simple main()
would allow people to learn about these other things gradually and build up
to the traditional main().
On Sat, Sep 16, 2023 at 6:08 AM Red IO <redio.development at gmail.com> wrote:
> I really disagree that this feature is a feature for beginners without
> value and "cannot be used once you learn oop properly".
> I don't see why you wouldn't be able to use the feature once you learn
> oop. As far as i understood one can have unnamed classes and other normal
> classes in the same project. Meaning you can have a file like Programm.java
> with the "void main() {}" in it in the root source folder and the packages,
> modules and classes besides it.
> It also makes scripts much easier to write in Java as one can just create
> a file MyScript.java with the main in it and launch it with "java
> MyScript.java".
> Both use cases have nothing to do with students. Fact is the entry point
> doesn't benefit from the class it's declared in. I would say this jep
> removes unnecessary restrictions from Java instead of adding unnecessary
> features. Java is the only language I know that has such a complicated
> entry point. Some languages let you start in the file directly or require
> to declare a main, start.. function. But no language but java requires all
> this class nonsense for the entry point.
>
> Great regards
> RedIODev
>
> On Fri, Sep 15, 2023, 19:40 Arne Styve <arne.styve at ntnu.no> wrote:
>
>> 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.
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20230916/0ddf8648/attachment.htm>
More information about the amber-dev
mailing list