← Home ← Back to /g/

Thread 106365900

164 posts 18 images /g/
Anonymous No.106365900 >>106366039 >>106366199 >>106366689 >>106367092 >>106367120 >>106367816 >>106367825 >>106368131 >>106368230 >>106369167 >>106370371 >>106371376 >>106371417 >>106371472 >>106371742 >>106372141 >>106373285 >>106375564 >>106384970
>i NEED a controller, service, repository, dto, interface, abstract factory, concrete factory and factory producer for a hello world program
Anonymous No.106366039 >>106386851
>>106365900 (OP)
What about a build system?
Anonymous No.106366164
having at least some default drawers to sort functionality into allows an application to grow larger while not becoming unmaintainable than without, so it's not all bad. if you actually think about the problem, you can cut out most of the code and make a much more focused solution, but that requires some agreement in the team
Anonymous No.106366178 >>106371193 >>106378455
>controller, service, repository
all you need
the rest is java jeets being jeets
Anonymous No.106366199 >>106370630
>>106365900 (OP)
https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
Anonymous No.106366689 >>106366710 >>106372891
>>106365900 (OP)
Just the first three really
I have been coding Java professionally for almost 2 years and I never had to use anything more complex than simple inheritance
Anonymous No.106366710
>>106366689
>Inheritance
You fucked up.
Anonymous No.106367092 >>106367767 >>106388329
>>106365900 (OP)
public class Main {
public static void main(String[] args) {
System.out.println("Hello World"):
}
}

No you don't.
Anonymous No.106367119
ITT interns discovering layered architecture
Anonymous No.106367120 >>106367532
>>106365900 (OP)
neet coders get intimidated by enterprise project programming concepts
Anonymous No.106367532 >>106367776
>>106367120
I love the subtle appeal to authority in your post but anything that has come out of corporation for the past 20-30 years has been complete slop written at the lowest possible cost (so by jeets fresh outta bootcamp) with 0 concern for quality. Enterprise is the lowest possible grade of software in 2025.
Anonymous No.106367726 >>106367782 >>106377911
>repository
Lol. Imagine using inferior framework
Anonymous No.106367747
The svc, repo, handler pattern is goated for golang backends tbqh
Anonymous No.106367767 >>106370452 >>106371224 >>106371435 >>106371894 >>106372202 >>106372388 >>106372437 >>106381743
>>106367092
since Java 25, it's just
void main() {
IO.println("Hello World");
}
Anonymous No.106367776
>>106367532
>foss isn’t the lowest cost software
Anonymous No.106367782
>>106367726
Entity framework implements the uow/repository pattern
Anonymous No.106367816 >>106368067
>>106365900 (OP)
yes, you need all that stuff as a matter of fact it filters out low iq, low emotional inhibition ni/g/g/ers out of the industry
Anonymous No.106367825
>>106365900 (OP)
Programming languages shouldn't be judged based on the verbosity of 'hello world' programs.
Anonymous No.106368067
>>106367816
only pajeets need all that
Anonymous No.106368131 >>106368243 >>106370511
>>106365900 (OP)
This reminds me of this one interview i had to write lru cache in java in 25 minutes. I knocked it out and the indian interviewer starts bitching about how im accessing public fields and not using java getters and setters for a leetcode question. Thats when i knew she was determined to fail me because im not indian.
Anonymous No.106368166
>I have a job so I don't judge the quality of a language based on its efficiency at writing hello world
Anonymous No.106368230 >>106377920
>>106365900 (OP)
kotlin fixes all these issues
Anonymous No.106368243 >>106369038 >>106369204 >>106369416 >>106370663 >>106371957
>>106368131
lol fucking jeets, embarassing
this kind of transparent field encapsulation is by far the biggest cargo cult in java, everyone does it without being able to even explain why, just that public fields are icky
Anonymous No.106369038
>>106368243
>without being able to even explain why
to change object state without obliterating its invariants?
Anonymous No.106369167
>>106365900 (OP)
but anon all those things make scalable maintanable software, maybe try to make something bigger than a hello world program for once and you might see the use case
Anonymous No.106369204 >>106369280 >>106371911
>>106368243
You use it so you can override it in subclasses if they need different behavior for those accesses. If the class is final then it doesn't really matter unless you expect you need to tack on behavior to those accesses later and don't want to have to change the accesses to method calls at that time.
Anonymous No.106369280
>>106369204
uhmm... jeets still bad tho.
right?
Anonymous No.106369304
skill issue
Anonymous No.106369416 >>106370892 >>106380059
>>106368243
>everyone does it without being able to even explain why, just that public fields are icky
if you use public fields, you can never do a flyweight pattern later anon
Anonymous No.106370371 >>106378536
>>106365900 (OP)
java has that very high-t chad heterosexual aura around it
just open any *.class file in hex editor and behold: every compiled java class begins with CAFEBABE in hexspeak. did you know that anon-fag? i bet you did not
Anonymous No.106370452
>>106367767
> Java 25
One day, they might stabilize or finish the language, and it might be worthwhile to take a look at then.
Anonymous No.106370511 >>106370552
>>106368131
> getters and setters
Ha, when I get to maintain that shit it’s the first thing I get rid of… just when reading the code
1. Immediately get rid if the usually hundreds of *unused* and never called getters and setters
2. Make all the untransformative getters and setters public, and replace them with direct variable access.
Anonymous No.106370552 >>106371948
>>106370511
>I intentionally make code worse
Anonymous No.106370630
>>106366199
I love the vitriol in this project, makes me laugh every time I look at it.
Anonymous No.106370663
>>106368243
you can't use method references to access fields in a stream pipeline for example
Anonymous No.106370892
>>106369416
> you can never do something that I will never do, so make every program 3 times slower

This is why java is basically on it’s way out.
The language itself was half decent, but thst attracted too many retards like flies to shit.
Anonymous No.106370911
>I NEED this hello world program!
Anonymous No.106371193
>>106366178
without a dto you don't have validation
Anonymous No.106371224 >>106371292
>>106367767
>another IO class
Perfecto.
Anonymous No.106371292 >>106371317
>>106371224
yeah, i would have just accepted the historical baggage and slapped int onto System, but io in Java is not so bad. java.nio.files.Files has static methods for basically anything to do with files, the rest is InputStream and OutputStream you get from somewhere and give to the library at hand /csv, pdf, excel etc.) to stream reads from / writes to
Anonymous No.106371317 >>106371555
>>106371292
I would have froze the JCL development just like .net framework and backport on popular demand what can be, then build new public APIs that expose the same functionality as the old for greenfield projects.
Anonymous No.106371376
>>106365900 (OP)
You do? My condolences, it sounds you're really bad at programming.
Anonymous No.106371396
You may not like it, but that's what peak performance looks like. My current workplace chose to not do services, and now rather than maintaining ONE service per legacy and modern endpoints, we have to maintain like 3+ per route to maintain backwards compatibility.
Anonymous No.106371417
>>106365900 (OP)
>DTO
Good luck mixing your API with the database models
Anonymous No.106371435 >>106371674 >>106371713 >>106371905
>>106367767
ok, so I can make public exported free functions now?
Anonymous No.106371472
>>106365900 (OP)
>i NEED to make another thread to seethe about a language that filtered me
Anonymous No.106371555
>>106371317
the existing apis are not that bad imo and they keep improving them. I've not written manual byte[] buffering code for ages, there is in.transferTo(out) and in.readAllBytes() which takes care of that. the rest is file handling, which the static utility methods on Files do pretty well. you can even use jimfs to replace the entire file system with an in memory one for unit tests
Anonymous No.106371674 >>106371760
>>106371435
every file still corresponds to a class, but you can statically import static methods, e.g.

static import Math.max;

class Calc {
static int multimax(int... values) {
int result = values[0];
for (int i = 1; i < values.length; i++) {
result = max(result, values[i]);
}
return result;
}
}


if you think of the wrapping class as a namespace, it's not so bad imo
Anonymous No.106371713
>>106371435
you can make public exported WEED
Anonymous No.106371742
>>106365900 (OP)
The language itself is fine and its standard library covers everything under the sun.
On the other hand, the teams coding it have a habit of turning 5-line scripts into shakespearian plays with 20 different characters performing dialogue.
And then there's Spring framework. I have a gut desire to punch the face of whoever thought config files should be imperative java factory code. Their documentation sucks hairy unwashed balls.
Anonymous No.106371760 >>106371825
>>106371674
ok... so how do I reference my not-a-class class that also apparently doesn't have a package name?
Anonymous No.106371825 >>106372530
>>106371760
i wrote this code in the 4chan textarea, i forgot to add the package, also forgot the package of Math in the static import statement, but you got the idea. if it had a package name, you would do the same, i.e. (imagine Calc and multimax were public, but they could also be in the same package of course)

package org.example.client;

static import org.example.util.Calc.multimax;
static import java.lang.IO.println;

class Client {
static void doWork() {
int result = multimax(1, -1, 0);
println(result);
}
}
Anonymous No.106371894 >>106371958
>>106367767
>Java 25
Sadly Chatgpt will become AGI before any team agrees to adopt this
Anonymous No.106371905
>>106371435
It will wrap it in a class automatically. It's just more retarded bloat that leads to confusing error messages.
Anonymous No.106371911
>>106369204
This case is so uncommon that you only see getter/setter boilerplate in java land
It's not even considered good style in modern java
Anonymous No.106371948
>>106370552
Cargo cultist
Anonymous No.106371957 >>106372012 >>106372549
>>106368243
The best part is that Java tards constantly brag about their tooling and the ability to do huge automated refactors yet they don't trust their tools to change public field access to a getter in the few cases where that would actually be necessary. That's pretty much the simplest refactor an IDE could do.
Anonymous No.106371958
>>106371894
to be fair, this is only good for learning the language and single file scripts. it only works in the default package, as soon as you have real packages (like, in any project ever) you have to declare the wrapping class again (but you probably want that anyway). Java 25 has other neat things though, like being an lts where virtual threads don't pin on synchronized or scoped values
Anonymous No.106372012 >>106372071
>>106371957
The JVM doesn't even optimize getters into direct access unless they're on a repeatedly called hot path. The Java world is so unbelievably fucked.
Anonymous No.106372071 >>106372112
>>106372012
why optimize something that's not on a hot path?
Anonymous No.106372112 >>106372164 >>106372199
>>106372071
Because if you don't you end up with death by a thousand cuts which is why 99% of Java programs are slow as shit. This applies even more so to the average JavaScript garbage.

The JVM also has to do runtime profiling just to make sure the idiotic getter is actually safe to optimize.
Anonymous No.106372141
>>106365900 (OP)
Yeah and that's why it's the best as a first language to learn, it shouldn't be more than an educational language though
Anonymous No.106372164
>>106372112
Show me this slow as shit performance besides start up time. Long lived java programs actually run pretty good.
Anonymous No.106372199 >>106372290
>>106372112
>death by a thousand cuts
if those thousand cuts were on the hot path, they would get optimized
Anonymous No.106372202 >>106372250 >>106378577
>>106367767
as a long time java programmer, this is the most useless pile of shit I've ever seen added to the language. It's a fuckin Linus Tech Tips addtion where some retard thought String[] args was too fucking hard...
Whoever added this deserves to be shot
Anonymous No.106372250 >>106372366
>>106372202
it's there so newcomers don't get bombarded with syntax they don't need to learn yet. you can add the String[] args if you want though, String... should work as well
Anonymous No.106372290 >>106372340
>>106372199
Lots of programs don't have a single hot path that dominates enough to be optimized by the JVM. Also it's very common for Java programs to have alternating hot paths that get swapped out and then have to be continuously reoptimized later.

There's also a huge cost to runtime profiling and runtime optimizations that Java advocates always seem to ignore. For example, V8, the CLR and SBCL have been moving away from many JIT optimizations because the cost isn't worth it. Almost all worthwhile optimizations can and should be done at compile time.
Anonymous No.106372340
>>106372290
>Lots of programs don't have a single hot path that dominates enough to be optimized by the JVM
most backend services offer multiple entry points. those that are used get optimized over time. as soon as a threshold is reached, i believe 10k calls to a method, C2 kicks in and optimizes it. a "hot path" is just a series of methods called one after the other, so they get optimized roughly at the same time. but it doesn't matter how a method got reached, as long as it gets called enough times
Anonymous No.106372366 >>106372382 >>106372435 >>106388555
>>106372250
>it's there so newcomers don't get bombarded with syntax
Every Java programmer handled it just fine. Are you telling me Gen Z are such special little snowflakes they can't figure out the standard main(Stinrg[] args)?
Anonymous No.106372382 >>106372446
>>106372366
Like, you don't even have to type it all out. In Eclipse it's just
>mai ctrl-space enter
there, you have a main method.
What fucking retard cannot do this?
Anonymous No.106372388
>>106367767
OOPsisters ... not like this ...
Anonymous No.106372435 >>106372470
>>106372366
shit I couldn't even remember off-the-cuff the one time in the last 10 years I bothered writing Java extensively. I still don't remember what static final whatever qualifiers even do.
Anonymous No.106372437 >>106372443 >>106372483
>>106367767
That's such a retarded change and you're quickly going to have to explain that Java ends up wrapping it in a class anyways.
Anonymous No.106372443
>>106372437
why can't java just, evolve? I don't get it.
Anonymous No.106372446 >>106372472 >>106372477
>>106372382
it's not that they can't, but the way you teach Java is: ignore like 90% of the words and symbols, just look at what's in between the curly braces of the main method, but also make sure you nest new methods inside that class thing you don't understand, oh and also make them static, just do it ok, you don't need to understand that one yet either. one approach that works well for learning is that you build understanding incrementally, knowing the entirety of your program at all times, adding new concepts over time. with Java you had to constantly ignore things that people tell you to ignore for now. class? ignore. public? ignore. static? ignore. String[]? ignore. etc. it just wasn't a great first language to learn
Anonymous No.106372470 >>106372501
>>106372435
you're not a java programmer anon, you're just trying to patch some code in a lang you never use
Anonymous No.106372472 >>106372502
>>106372446
Nice of them to alter the language to make it easier for the first 5 minutes at the cost of making it inconsistent for everything after that.
Anonymous No.106372477 >>106372567
>>106372446
>but the way you teach Java is
I taught myself. I read Bruce Eckel's Thinking in Java 1st edition back in the 00s
The hardest part of the book was java.io
Figuring out the main method was cake.
If you can't do main, just walk away. You are functionally retarded.
Anonymous No.106372483
>>106372437
>quickly
you can write a ton of useful programs in a single file without having to write your own classes. when the time comes, that detail can be revealed, "you've been writing instance methods all this time actually". you are then free to teach about static, like how IO.println works etc., it's just not all in your face at the beginning
Anonymous No.106372501
>>106372470
I was awhile ago, I just literally don't remember any of it other than useless stuff like using and writing ant build configs.
Anonymous No.106372502
>>106372472
5 minutes for you, perhaps you forgot what it was like to learn programming for the first time. there is a lot you can learn before you move on to concepts made for larger programs. you can get good at control structures, arrays, writing console applications like simple games etc.
Anonymous No.106372530 >>106372595 >>106372662
>>106371825
just to add, this also works for static fields, eg.
import static java.lang.System.out;

// ...

out.println("Hello world");

you can also do a wildcard import everything static in a class, ie.
import static java.lang.Math.*;

especially convenient for classes full of constants
Anonymous No.106372549
>>106371957
>they don't trust their tools to change public field access to a getter in the few cases where that would actually be necessary.
where did you come up with such a point?
Anonymous No.106372567 >>106372646 >>106372679 >>106372763 >>106372789
>>106372477
that was in the java hype days, right? i think they want to keep Java as an attractive first language to learn. if you look at tutorials for other popular languages today, python, js/ts, c#, go, kotlin, they all have very simple hello world programs. would you decide to learn Java out of your own volition if you saw the previous hello world as the minimal Java program, compared to the other languages? I wouldn't. you might say it's false advertising because you'll move on to writing classes anyway, but by then it makes sense why these things exist and the fear of being overwhelmed is gone
Anonymous No.106372595 >>106372635
>>106372530
ok. so how do I, in another compilation unit, use a free function / global variable defined in these types of java source files?

this is starting to sound as useless as C# Top-level statements. (it probably is)
Anonymous No.106372635 >>106372643 >>106372702
>>106372595
There are no free functions. The functions become static methods on a class with the same name as the file. It's just more stupidity.
Anonymous No.106372643 >>106372692 >>106372702
>>106372635
so it's useless noise then.... why add this JEP in? because Cshart did?
Anonymous No.106372646 >>106372723
>>106372567
You miss the point. The giant moat for novices before you can run a Java file, like dependencies and syntax, is a feature, not a bug. It keeps the supply of (Java) programmers lower than it otherwise would be.
Anonymous No.106372662
>>106372530
oh yeah, and i got the static import syntax wrong, of course. thanks
Anonymous No.106372679 >>106372782 >>106372801
>>106372567
and all those programs are also superior because "OOP" as done by these shit enterprise languages like Java and C# are just wrong. Making some fake tutorial mode version of the language isn't going to magically fix "learning it" if anything, it will probably make it more confusing. If you can't get up and start writing actual, multi-file, software that you can share, reuse, etc then it's a fucking meme. end of. I don't know why these tards make half assed features like this instead of accepting the reality that "everything is a class" is fucking stupid.
both Java and .NET languages have a concept of a package (namespace), why do you need some bullshit faux namespace (class full of statics) for basic shit like global constants, singletons and "utility/helper" functions? it's just pure stupidity at this point. I legitimately don't understand it.
Anonymous No.106372692
>>106372643
it's for single file scripts and for beginners so they don't have to understand all that class business up front when they just want to write a hello world. i misunderstood what you were after, no free functions in Java, you have to make them static and wrap them in a class serving as a namespace. that's been there since 1.0 i think, static imports was around Java 5, so, ancient stuff
Anonymous No.106372702 >>106372772
>>106372643
and the "free" methods in that simplified file are instance methods, the main method as well, >>106372635 is wrong here
Anonymous No.106372723
>>106372646
pre ai, i would have agreed actually. but now, it's just pointless ceremony
Anonymous No.106372763 >>106372842
>>106372567
>i think they want to keep Java as an attractive first language to learn
Then having more interesting things in main is better than less. The new main is not typical Java, it will be MORE confusing to beginners, despite being more terse.
Anonymous No.106372772 >>106372926
>>106372702
> they're instance methods
That's even dumber. Holy shit, is everyone involved in Java just completely braindead? Torvalds was right about Java and the JVM.
Anonymous No.106372782
>>106372679
>"OOP" as done by these shit enterprise languages like Java and C# are just wrong.
the languages only implement some functionality to make applying the paradigm easier
it's entirely on you (the person who writes the code) on how well the paradigm is adhered to
Anonymous No.106372789 >>106372877
>>106372567
Literally not a single person was ever gatekept by public static void main(String[] args).
Nobody.
Java is boilerplate and the boomers in charge want to do a "hello fellow kids", that's it.
Anonymous No.106372801
>>106372679
you can have multiple files in the same package, Java's approach has the benefit that you know without an IDE in which one a constant / method is declared
Anonymous No.106372842
>>106372763
>new main is not typical Java
i'd argue the old main was the primary source of "typical Java". the remaining sources of verbosity do have at least some benefit (reverse domain package names -> no clashes, class in every file -> consistency and finding types is equal to finding file names etc.). what's funny to me is that Zig is making every file have a top level struct with the same name as the file. i don't know if someone told them yet that they are not the first to discover this pattern
Anonymous No.106372877 >>106372914 >>106372918
>>106372789
>Java is boilerplate and the boomers in charge want to do a "hello fellow kids", that's it.
or the boomers recognize that Java has a lot of boiler plate and are working to reduce it? you can use the simplified main method yourself you know, you can leave out the parts you don't care about, which is probably most of it. i mean, why did it ever have to be public, so dumb
Anonymous No.106372891
>>106366689
>Just the first three really
Not even that. You need very little.
The only thing in OP's ranty list that is of significant linguistic value is the interface, and even that you should only use when you need (and only pajeets would use them for hello world). The rest? BLOAT, unless you're doing something a lot more complicated.
But a lot of people love to make things overcomplicated. It's the one thing in their lives that gives them a sexual thrill. Sad bastards.
Anonymous No.106372914 >>106372969
>>106372877
> the boomers recognize that Java has a lot of boiler plate and are working to reduce it?

And like always the boomers fuck it up horribly. If they wanted to make it simpler they should have just added free functions. There's no good justification for wrapping it in a class and especially for making it an instance method. The class doesn't even have any state so the instance is totally useless and just additional boilerplate required so that you can use the function.
Anonymous No.106372918 >>106373017
>>106372877
Because the Java model is having one public class per file and the runtime demanding one public static method named main on the class you want to execute.
That's how it was, is, and will be, and hiding the boilerplate away doesn't change the model, you will have to learn and use the keywords anyways.
Anonymous No.106372926 >>106372946 >>106372958
>>106372772
it's just not the feature you hoped it would be. Java wants you to have a top level type in each file, that's the pill you have to swallow. but once you do, it does have benefits as well, especially for code review in external tools. Zig is also doing this and that's so bleeding edge it doesn't even have a 1.0 yet
Anonymous No.106372946
>>106372926
> this other retarded language is also retarded
Anonymous No.106372958 >>106373101
>>106372926
Name the benefits for external tools. There are none and functions attached to packages are just as discoverable via static analysis and reflection.
Anonymous No.106372969 >>106373007
>>106372914
>The class doesn't even have any state so the instance is totally useless and just additional boilerplate required so that you can use the function.
you can add fields to that compact source file. and you don't have to write the class at all, that's one of the features. the jvm creates an anonymous class and calls your instance main method. it's in the JEP: https://openjdk.org/jeps/512
Anonymous No.106373007 >>106373145
>>106372969
>the jvm creates an anonymous class and calls your instance main method
It just keeps getting worse lol
Anonymous No.106373017
>>106372918
>and will be
it changed with JEP 512 though, it's not like your instance method is rewritten to be static and public and have args, there is new code in the JVM that will synthesize a hidden class for your and call your instance main method (and pass it args, if you declared that you care for them). the execution model changed. you will have to learn those keywords, yes. but you won't have to learn them when you learn about if statements and for loops and making "printDereksDickSize" methods
Anonymous No.106373101 >>106373124
>>106372958
>Name the benefits for external tools
you are reviewing the pr of a colleague on gitlab. he uses the type "Foo", which you don't remember what it does. you press "t" and search for files named "Foo.java" and find it instantly, no IDE features needed
Anonymous No.106373124 >>106373180
>>106373101
Finding the file that a struct/record is in is completely trivial in basically every statically typed language ever made.
Anonymous No.106373145 >>106373158
>>106373007
it's perhaps different than you expected, but it makes sense: Java allowed you to omit the class in the compact source file, but it still exists at runtime. where else would fields and instance methods get attached to?
Anonymous No.106373158 >>106373211 >>106373291
>>106373145
>where else would fields and instance methods get attached to?
Why would I want functions with no external state to be instance methods?
Anonymous No.106373180 >>106373226
>>106373124
yes, if you are inside an IDE or a tool that understands the type system. gitlab is a web frontent for git repositories, where you review the work your colleagues did and do other dev lifecycle things. it did gain some static analysis smarts over time, but fundamentally it deals in text files, so you can't ctrl+click on Foo and expect that it jumps to the correct file
Anonymous No.106373211 >>106373234
>>106373158
because you can also attach external state in the form of fields and use those in the instance methods. this is legal:

String greeting = "sup";
void main() {
IO.println(count(greeting));
}
int count(String s) {
return s.length();
}
Anonymous No.106373226 >>106373304
>>106373180
If Java is all about discoverability without static analysis why does basically every popular library abuse the fuck out of runtime reflection?
Anonymous No.106373234 >>106373327
>>106373211
This has to be one of the most braindead features in existence. Java is basically Python and JavaScript tier of inconsistent garbage now.
Anonymous No.106373285
>>106365900 (OP)
I fucking love controllers, services, repositories, dtos (this is how I know you know your shit). I had a codebase like this for five or six years and it was the best time of my career. It was so readable, predictable, you could easily talk about the architecture with others. No bugs could hide. Any ticket was blasted down quickly. On boarding new devs was a breeze.

/g/ can pretend to be an internet tough guy and golf code down to incomprehensible slop all it wants. I'll take verbose Java architectures by oldheads who read Martin Fowler and Kent Beck all fucking day and night.
Anonymous No.106373291 >>106373315
>>106373158
they could have compiled everything into static methods and static fields instead of instance level, but then the rules between regular classes and these compact source files would have been different, they be a kind of Java dialect and copy-pasting between compact source files and regular source files would require you adding static everywhere / removing it. that would have been terrible. also, beginners should not learn to make everything static, they would have to unlearn this as soon as the work on real projects (think mocking, need multiple instances with independent state etc.)
Anonymous No.106373304 >>106373322
>>106373226
spring still does, quarkus doesn't, micronaut doesn't, helidon doesn't, javalin doesn't. times are changing in Java land, anon
Anonymous No.106373315 >>106373362
>>106373291
>the rules between regular classes and these compact source files would have been different
The rules are already different.
Anonymous No.106373322 >>106373437
>>106373304
>quarkus doesn't, micronaut doesn't, helidon doesn't, javalin doesn't
Nobody uses any of these. Spring is easily used 1000 times more than all them combined.
Anonymous No.106373327 >>106373362
>>106373234
how is this inconsistent? it's just a compact source file where the wrapping class declaration got omitted. the main method no longer needs to be static, if it isn't, the JVM will create an instance of the class it's in and call it. you can totally declare the class if you want to:

class Main {
String greeting = "sup";
void main() {
IO.println(count(greeting));
}
int count(String s) {
return s.length();
}
}
Anonymous No.106373362 >>106373388
>>106373315
the only difference is that you are allowed to omit the wrapping class if the file is in the default package and you get an "import module java.base;" for free, so you can use List etc. without importing it first. if you are not in the default package, you can just declare the class and keep all the code the same, see >>106373327
Anonymous No.106373388 >>106373479 >>106373600
>>106373362
>the only difference is that you are allowed to omit the wrapping class
That's what makes it inconsistent. The inconsistency also serves no real purpose outside of the first 5 minutes of learning the language because noobs are quickly going to have to have this "compact source file" garbage and classes explained to them anyways. It will inevitably be even more confusing when Java finally gets a clue and adds free functions like every other language in existence.
Anonymous No.106373437
>>106373322
even if you only consider spring, the availability of ahead of time compilation via graalvm and project leyden made them reduce the reliance on reflection considerably: https://docs.spring.io/spring-framework/reference/core/aot.html

and it's not like this has anything to do with the mapping of type names to file names anyway, but it's nice to see the Java ecosystem embrace some common sense optimizations (why rediscover the structure of the application when it's known at build time?)
Anonymous No.106373479 >>106373539
>>106373388
every class has a package declaration, except those in the default package. that's inconsistent as well then? you can write the parameter types in lambdas down or omit them, is that inconsistent? methods in interfaces can have the abstract keyword, or you can omit it, is that inconsistent? that's just rules to allow omitting ceremony where it's not adding any value, imo. that's nothing new and not particular to Java
Anonymous No.106373539 >>106373618
>>106373479
Yes all of that is inconsistent and the only one that is remotely justifiable is the parameter types in lambdas.
Anonymous No.106373600
>>106373388
>the first 5 minutes
this keeps getting repeated, but there is a lot to learn for beginners before they need multiple files. First they have to learn about declaring their own methods. Let's say that runs out of gas after your file has grown to 1000 lines or so. In 1000 lines you can implement entire console based games and such, which wouldn't make sense to split up anyway. That's not 5 minutes, that's days to weeks. Inside a class, all methods behave as free functions anyway, at least to the extent Java supports them (functions / lambdas are not first class in Java and likely won't ever be, Java is nominally typed, not structurally)
Anonymous No.106373618 >>106373766
>>106373539
so you want everything to be verbose to the max and not allow omitting syntax even when the compiler can infer it easily? but then also complain why Java has so much boilerplate? which one is it?
Anonymous No.106373766 >>106375858
>>106373618
>so you want everything to be verbose to the max
No. The good way to solve this problem would just be to add free functions like every other decent language. The bad way is too add a retarded hack that wraps the file contents in a class and makes all the functions instance functions.
Anonymous No.106375564 >>106375944 >>106376267
>>106365900 (OP)
These cargo cult shitters turned a decent language into a hell to work with, these fucking patterns have gotten so out of hand that they developed new data containers just so u can FINALLY use the fields of a class.i guess I only like go cause the cargo cult hasn't taken over yet, and the stuff that exists is much more tolerable than the shit that goes down on java land, also stream API worst thing in history to debug
Anonymous No.106375858
>>106373766
free functions do not carry their weight. you would need new import syntax, new ways to discriminate between multiple free functions imported from different files (no class container), new overload resolution rules (does the free function win over the static functions in the file you imported them into?) and so on. you can already import static methods from other files, see the examples in this thread, so free functions would just add another way to do the same thing. not worth it. if you designed a new language, it would definitely be a consideration, but introducing multiple ways to do the same thing because the existing pattern hurts your feelings or something is nit good language design
Anonymous No.106375944
>>106375564
>stream API worst thing in history to debug
It gets worse when you have to work with reactive streams which (unlike the stream API) don't have any IDE support for debugging
Anonymous No.106376267
it's amusing when in the same breath, people criticize the language for cultism while at the same time religiously complaining about not having exactly the same feature set as their preferred language

>>106375564
pretty sure go was invented specifically to harvest the otherwise untapped weaponized autism of such complainers
bet no small thanks to all the goolag datamining on nerds' browser histories
Anonymous No.106376337 >>106376371 >>106376856
A good programmer builds a working vocabulary, basically a DSL that suits the problem at hand.
It so happens that basic layered architecture suits most of the CRUD shit-apps most people work on. If you don't recognize that you don't really understand coding yet.
Anonymous No.106376371 >>106376403 >>106376409
>>106376337
If you need layered architecture in order to comprehend a simple CRUD app, you're probably fresh out of college and about to become a senior burger flipper at McDonald's
Anonymous No.106376403 >>106376415
>>106376371
Who said you need it for every app? Obviously some things can be solved even with a one liner.
Every thread like this is pure projection.
Anonymous No.106376409 >>106376415
>>106376371
nice projection
good luck finding a job as a programmer if you shove everything into a spaghetti bowl
Anonymous No.106376415 >>106376621
>>106376403
>>106376409
>jeet brigade arrives INSTANTLY
Don't forget to add a few converters for your hello world app!
Anonymous No.106376621
>>106376415
>itz DA JEETS
no argument.
Anonymous No.106376856 >>106377836
>>106376337
I imagine you really love Racket.
Anonymous No.106377836
>>106376856
Yeah, Racket and the more conventional looking Rhombus are on a whole different level.

https://rhombus-lang.org/
Anonymous No.106377911 >>106378024
>>106367726
>xamarine
deprecated

>uwp
deprecated
Anonymous No.106377920 >>106378514
>>106368230
>kotlin
kot means shit in germany
Anonymous No.106378024
>>106377911
>.net 4.5+
Deprecated but still supported
Anonymous No.106378455
>>106366178
interfaces are based but it's a basic language feature so not sure why op put it into relation with the rest
Anonymous No.106378514
>>106377920
anglos love dabbing on germs by using the worst fucking names

>MongoDB
RetardDB
>Figma
Fuckma (kinda sounds like "let's fuck" with a heavy regional dialect)
Anonymous No.106378536
>>106370371
how did they get away with it?
Anonymous No.106378577 >>106380508
>>106372202
>complex things are better
i guess you're someone who creates functions with unused parameters in case someone might need the value
Anonymous No.106380059
>>106369416
>if you use public fields, you can never do a flyweight pattern later anon

fuck your flyweight pattern
Anonymous No.106380508
>>106378577
right? this is a great feature. don't want to make main public? then don't make it public. don't want it to be static? have a default constructor and make it not static. don't needs args? leave them out. don't need more than a single file? leave out the enclosing class as well. don't know why people hate on this, it's neat
Anonymous No.106381743 >>106382706
>>106367767
kek we pythonlet now
how the mighty have fallen
Anonymous No.106382706 >>106382955 >>106383786
>>106381743
They're going to add an "ultra compact file" mode in Java 27 where you don't even need to write the function definition. All the code in the "ultra compact file" will automatically be placed in a main method which will automatically be wrapped in a Main class.
Anonymous No.106382955
>>106382706
you are joking, but they considered it

>Allow top-level statements
>An alternative design would allow statements to appear directly in a compact source file, removing the need to declare a main method. This design would interpret the entire compact source file as the body of an implicitly declared main method of an implicitly declared class.
>Unfortunately, this design would be limiting because it would be impossible to declare methods in a compact source file. Such methods would be interpreted as appearing in the body of an invisible main method, but that would make them illegal since methods cannot be declared within methods. Compact source files could only represent linear programs that consist of one statement after another, without the power to abstract repeated computations into subroutines.
>Furthermore, in this design, all variable declarations would be interpreted as local variables of the invisible main method. This would be limiting because local variables can only be accessed from lambda expressions when they are effectively final, which is an advanced concept. Writing lambda expressions in compact source files would be error-prone and confusing.
>We believe that the desire to write statements directly in a compact source file, outside of a method body, is largely driven by the pain of writing public static void main(String[] args). Having made main methods easier to declare, we believe it best for compact source files to be composed of methods and fields rather than statements.

https://openjdk.org/jeps/512
Anonymous No.106383786 >>106384708
>>106382706
Why does a function signature and two curly braces bother you so much?
Anonymous No.106384708
>>106383786
anons want to keep filing java under "verbose enterprise language". changing these neural pathways is painful for them
Anonymous No.106384970
>>106365900 (OP)
I miss the Java.
Anonymous No.106386851
>>106366039
not before cpu emulation layer
Anonymous No.106388329
>>106367092
>I just NEED a public class Main and a public static void to send 11 bytes to std out
Anonymous No.106388555
>>106372366
in short - yes. that's why Java was being pushed out of colleges in favour of Phyton.
it's literally Phytonisation of the language
Anonymous No.106388792 >>106388930
Why do java users love patterns and all that shit so much? Why not just tell the computer to do what you want it to do and cut out all the rest of the shit?
Anonymous No.106388930 >>106388935
>>106388792
>Why not just tell the computer to do what you want it to do
As a Java user, I do precisely this. I just tell the computer, chatgpt, what I want the computer to do, and to tell me how to tell the computer what I want to do in java.
Anonymous No.106388935
>>106388930
God help us all.