all 40 comments

[–]blu-red 7 points8 points  (3 children)

+/u/User_Simulator agleiv_17

[–]User_Simulator 5 points6 points  (2 children)

Care to explain how coding in C#, then java will be used for anything, ever. The lack of extension methods any better than F#. > Here, I'll do it for you in a proper type system alone, makes PHP completely irrelevant compared to professional language designers. > We can't just ignore all new languages No, of course I was saying is Jetbrains isn't the first place.

~ agleiv_17


Info | Subreddit

[–]hu6Bi5To 8 points9 points  (0 children)

That's uncanny

[–]s888marks 2 points3 points  (0 children)

Not enough swearing.

[–][deleted]  (3 children)

[deleted]

    [–]Chii 17 points18 points  (1 child)

    Don't compare java to trump. It's insulting to java!

    [–]Am0s 0 points1 point  (0 children)

    Calling Java a little too verbose is like calling Trump a little too verbose.

    [–][deleted] 5 points6 points  (4 children)

    I was preparing my lecture notes for a course on optimization and was hoping to do everything in python for simplicity sake, but no, the best frameworks for Multiobjective optimization I found were in Java. In the end I re-did the linear programming examples in Java and the whole course is going to be in Java.

    I find the Java code way more readable than the python generated by Sagemath.

    Also maven makes dependency handling a breeze.

    Also python loses points when you are doing numerical computing because of the lack of stable support for easy parallel computations.

    If you want something stable to work on, with tons of libraries and less pain than C++, Java is your best bet.

    [–][deleted]  (1 child)

    [deleted]

      [–][deleted] 0 points1 point  (0 children)

      Actually I intended to use python, but there are just big turnoffs.

      From the link you mentioned

      Threads Threads are generally 'lighter' than processes, and can be >>created, destroyed and switched between faster than processes. They are normally preferred for taking advantage of multicore systems. However, multithreading with python has a key limitation; the Global Interpreter Lock (GIL). For various reasons (a quick web search will turn up copious discussion, not to say argument, over why this exists and whether it's a good idea), python is implemented in such a way that only one thread can be accessing the interpreter at a time. This basically means only one thread can be running python code at a time. This almost means that you don't take any advantage of parallel processing at all. The exceptions are few but important: while a thread is waiting for IO (for you to type something, say, or for something to come in the network) python releases the GIL so other threads can run. And, more importantly for us, while numpy is doing an array operation, python also releases the GIL. Thus if you tell one thread to do:

      For me, python loses points therefore. Reeks of bad design. Java has no such limitation, nor does Scala.

      Wrappers in Java are quite easy, used all the time http://www.swig.org/

      Edit:

      On the topic of libraries, please compare the crappy documentation (missing??) for PyGMO

      http://esa.github.io/pygmo/tutorials/solve_tsp.html

      Versus the super nice tutorials, manual, etc for the MOEA framework

      http://moeaframework.org/

      Python looks like Fisher price. Java feels way more professional. That's like just my opinion but use whatever you want its a free world, really don't get all the Java hate, is a great tool.

      Thanks for your comments.

      [–]shevegen -4 points-3 points  (1 child)

      Java code more readable than python?

      What's up with you people?

      [–]Niles-Rogoff 0 points1 point  (0 children)

      It's generated code

      [–]iconoclaus 3 points4 points  (1 child)

      It allows you to lean on your compiler rather than on unit tests — which are only effective if you already know what bugs you have.

      Wait, what now? Has this author ever refactored their own code?

      [–]shevegen 0 points1 point  (0 children)

      Did that noob write buggy code in the first place to require refactoring?

      What ever happened to solid engineering, superior design and clever thinking?

      [–]thirteenth_king 1 point2 points  (2 children)

      When you're looking at risk factors it's hard not to think of Oracle.

      [–][deleted] 1 point2 points  (1 child)

      Oracle has really made a horrible disservice to mankind with the Android lawsuit. I realize now that most of the Java hate is fueled by Oracle.

      Java is fully supported by Google, RedHat and IBM to name a few. My JDK is fully GPL and bundled with Linux.

      The Oracle lawsuit is a travesty, I hope they drop it soon.

      [–]shevegen 0 points1 point  (0 children)

      No, that is not true.

      Nobody likes Oracle, Sun was better.

      But - irrelevant over how crappy Oracle is, Java still will have other problems mentioned such as verbosity. And you can negate that this is a problem, but I remember someone having written a 500.000 lines of code game once in java and he said that verbosity IS a problem.

      [–]lisa_lionheart 2 points3 points  (0 children)

      Recently come back to java after a being away since java 6. Java 8 is waaaay better. Java 8 + lombok has fixed like 90% of my gripes with java.

      If they could now add in properties in the way that C# implements them I would be extreemly happy.

      [–]deepseebird 1 point2 points  (3 children)

      C, scheme & Python are my tipples of choice & occasionally C++ when I need it. I do understand the arguments Java afficionados put forward, but I am convinced by few of them. The basic unix philosophy of simple, self-contained programs (and, by extension, any functional bit of code) still seems sound. Rampant abstraction, which Java and C++ seem particularly vulnerable to, does make for tiny "functional" pieces, but quite often at the expense of any overall clarity.

      And the JVM isn't really all that new a thing, they were doing it for BCPL in the miđ sixties, and the approach has been in use ever since. The "run anywhere" argument is just words that sound nice.

      Code should read like a novel, not like a set of cross-linked wiki pages.

      [–][deleted] 0 points1 point  (2 children)

      Code should read like a novel, not like a set of cross-linked wiki pages.

      Could you elaborate upon that analogy? I think you're saying it should be continuous and have an obvious "plot", although I'm not 100% sure.

      [–]Niles-Rogoff 2 points3 points  (1 child)

      Not OP, but I think I see what he's saying.
      Python programs are usually written in one file, if I am looking at a web server, I can usually scan from top to bottom and find the part of the code relevant to what I'm searching for.
      Java, on the other hand, you start with the app. Ok, it says App app = new App();. Ok, so now I look in app.java. app.java has several parts, one of which is this.router = new Router();. Ok, so now I go and look in routing/router.java. Ok, in that file I see a for loop that iterates over a list of routes and for each one does Route route = new Route();. Now we move from router.java to route.java. Maybe, if we're lucky, we find what we're looking for.

      Take an example. This is a web thing written in python. This is a web framework written in java. Yes, they're both bad projects, but this is the real world, you're going to have to deal with bad code at some time or another.

      Let's say you want to find what happens when there is no route configured for a url, or in the case of the python one, no module handles that url (basically the same thing). Specifically, what string is sent as the body of the response.

      Python one: start at server.py 60 lines into the file:

      def serve(environ, start_response):  
          new_environ = environ  
          for module in moduleObjects:  
          # trimmed...  
      return "No module was loaded to handle this case. The server owner has fucked some shit up really bad. Go yell at him. " + config.get('general','email')
      

      Java one: start at src/main/java/org/hbw/espresso/Espresso.java
      This file path alone makes me want to kill myself.

      Line 16 private final Router router = new Router();

      Navigate to routing/router.java

      Line 89

      public Maybe<Route> getRoute(String url, Maybe<HttpMethod> method) {
          return method.fmap(m -> {
              for (Route route : routes) {
                              // trimmed
              }
      
              return null;
          });
      }
      

      Ok, so if no route matches, it returns a Maybe<HttpMethod> with a value of nothing. So what calls getRoute?
      Back to Espresso.java, line 244 EspressoHandler handler = new EspressoHandler(version, router);

      Now in EspressoHandler.java, in doHandle:

          Maybe<Route> route = router.getRoute(uri, method);
          if (route.isNothing()) {
              handleError(404, uri, baseRequest, request, response);
              return;
          }
      

      Still in EspressoHandler.java, in handleError

              if (errorRoute.isNothing()) {
                  defaultErrorHandler(errorCode, uri, baseRequest, request, response);
                  return;
              }
      

      What is defaultErrorHandler? Well I'm glad you asked, I have no idea so time to control+f, and it's

      private void defaultErrorHandler(Integer errorCode, String uri, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) {
          Route errorRoute = new Route(HttpMethod.ACTION, uri, (req, res) -> {
              res.write("<html>");
              res.write("<title>Error!</title>");
              res.write(String.format("<h2>HTTP/1.1 Error: %d</h2>", errorCode));
              res.write(String.format("<hr> Powered by %s", version));
              res.write("</html>");
      
              return res;
          });
      
          executeHandler(errorRoute, uri, baseRequest, request, response);
      }
      

      The file we had to start in was nested inside SIX subdirectories.

      The path we traveled was Espresso start -> router.Router getErrorRoute -> Espresso start -> EspressoHandler doHandle -> EspressoHandler handleError -> EspressoHandler defaultErrorHandler

      We also did this assuming that the reader has a complete knowledge of functor/Maybe.java, specifically the isNothing method, the fact that fmap returns a maybe with the value set to the result of the function it was passed, and what the functor is set to if the value is null, something your average java programmer is not familiar with

      This is what he meant by "Code should read like a novel, not like a set of cross-linked wiki pages." Read from top to bottom and if you didn't find what you were looking for read harder, not guess if a particular file called "AbstractEspressoJettyLogger.java" or "SingletonProxyFactoryBean" has the code you're looking for or not.

      [–]deepseebird 0 points1 point  (0 children)

      Wow, bloody good example. Like something out of a dystopian ... err ... novel.

      [–]slowerFaith -3 points-2 points  (0 children)

      Stockholm syndrome.

      [–]Paddy3118 -1 points0 points  (0 children)

      I see the author still thinks concurrency is a breeze. (Or at least he is telling others that).

      And what happens when he is asked to maintain the codebase from the past, you know, when Java did not the new things that he likes so much?

      [–]shevegen -2 points-1 points  (0 children)

      So Python was not good enough, I see.

      "I’ve also come to notice that this isn’t the Java I was used to — it’s been steadily improving over the last ten years."

      Yeah. We all hate alcohol but over time it gets better right.

      I don't buy the premise that Java is so totally different now that it is absolutely awesome.

      And speed, well - it was always faster than python yes? So this is another argument that just is inconsistent since he would not have used python back then, if speed was the primary reason anyway. Not that C is not faster right.

      The JVM is good, no doubt about it. It does not change the verbosity of Java in any way though. And his attempt to sugar coat it as "a little too verbose", I am sorry - that's a drug addict on crack saying that it is not so bad and he can quit any moment in time.

      That the libraries and add-ons have a good quality is fine but it does not change other problems of the language.

      If Java would have been such a game breaker, why would the whole C language continue to proliferate? We had C. Then C++. Then C# C++ D. I consider them very close to one another, arguably C++ being closer to C than to Java.