Remix.run Logo
raverbashing a day ago

Except a static class method is just a hand-wavy way of denying reality: that a program has a single entry point that has nothing to do with classes

As much as C++ has a lot of problems, them and other languages (python/ruby/etc) never denied that the procedural world existed, while Java wants to blindfold you and push you through a corridor until you get out of it and into the "perfect (not) OOP world"

Yoric a day ago | parent | next [-]

If you're speaking of `main()`, that's not true in Java: you can have many entry points and decide upon launch which one you're using.

If you're speaking of `__main()`-style entry point, though, you're right, and Java makes it... complicated.

raverbashing a day ago | parent [-]

Yes I meant the latter

mayoff a day ago | parent | prev | next [-]

But in Java, a program doesn't have a single static entry point. You can have as many different classes as you want, each with its own static void main, and choose which to use as the entry point when you start up your JVM.

pansa2 a day ago | parent | prev [-]

> python/ruby/etc never denied that the procedural world existed

Interestingly, those two languages use very different mechanisms for top-level functions - although I’m not sure if there’s a significant difference in practice.

Python has true standalone functions, whereas in Ruby’s they’re really methods of a `main` object.

1718627440 a day ago | parent [-]

In python you are recommended to use

   if __name__ == '__main__':
      sys.exit (main (sys.argv))
and not put any code that is executed at the top-level. Otherwise its also executed when you import the file.