Live data from Hacker News

Ask HN: Why not Java?

news.ycombinator.com

41–50 of 112 posts

Re: Ask HN: Why not Java?

#41
post #30
post #22

Earlier quoted context omitted.

Rigth tool for the right job is key here. I personally like to add Groovy to the devops list.

I think groovy is sensless language. You lost all Java benefits like checked exceptions, robust code... what is about debugging? And you is not faster developing with groovy. You developing faster if you ensure quality and not inline filters or other crap. If you like groovy, look at Python.

You're wrong there. I use Java for most things but dive into Groovy when I want features like almost native XML handling (via XmlSlurper & MarkupBuilder). Having a joint Java + Groovy project is simple as it's all just bytecode to the IDE.

Re: Ask HN: Why not Java?

#42
post #20

I am curious about what, specifically, you find easier to do in Java syntax than Python syntax. Seriously, there is a fairly direct translation from any Java you might want to write to completely equivalent Python. Sure, Python offers more complex techniques such as list comprehensions and iterators. But you don't need to use them. You can just write Java-like Python.

Interfaces.

Abstract base classes. See http://www.doughellmann.com/PyMOTW/abc/

Re: Ask HN: Why not Java?

#43
post #23
post #16

Earlier quoted context omitted.

Well, for starters the whole idea of programming in XML. That and gems such as http://static.springsource.org/spring/docs/2.5.x/api/org/spr... or http://static.springsource.org/spring/docs/2.5.x/api/org/spr... Of course I can't a priori prove that Spring is garbage, much like I can't a priori prove that it's better to be healthy and rich than to be poor and sick. It is a judgement call, but a judgement call that I be…

You can ditch the xml almost entirely in spring 3, which I've been using for 2 years now. All you need is 50-100 boilerplate lines and the rest is annotations. I agree that 2.x was xml hell, but it is worlds better now.

> All you need is 50-100 boilerplate lines

That answers "Why not Java?" perfectly ;)

Re: Ask HN: Why not Java?

#44
post #23
post #16

Earlier quoted context omitted.

Well, for starters the whole idea of programming in XML. That and gems such as http://static.springsource.org/spring/docs/2.5.x/api/org/spr... or http://static.springsource.org/spring/docs/2.5.x/api/org/spr... Of course I can't a priori prove that Spring is garbage, much like I can't a priori prove that it's better to be healthy and rich than to be poor and sick. It is a judgement call, but a judgement call that I be…

You can ditch the xml almost entirely in spring 3, which I've been using for 2 years now. All you need is 50-100 boilerplate lines and the rest is annotations. I agree that 2.x was xml hell, but it is worlds better now.

I sense sarcasm, but 100 lines of xml in a 200,000 line web application is wonderful. And this xml is specifiying critical things like database connection and pool settings, transaction management, entity caching, and more. You are going to be configuring this stuff no matter what platform you use, and the simpler it is the better.

Re: Ask HN: Why not Java?

#47

I've written two crawlers in Java and found it quite well-suited. I think most people on HN who hate Java are talking about creating websites, and for good reason. Back in the bad ol' days, people would use Java frameworks like Struts for web apps, and it was quite painful. For my latest project I'm using Play Framework for front-end Java, and it's quite delightful.

Agreed. I am in the process of porting a site from PHP to Play and I am loving it.

I am a fan of lots of languages, but recently for anything I am supporting for a long period of time I want static typing to catch massive re-factoring issues. Id rather use C# then Java personally, but Play is an amazing Java framework to use.

Re: Ask HN: Why not Java?

#48
post #14

Earlier quoted context omitted.

Can you give us some evidence why Spring is "unequivocal and absolute garbage"?

Spring was innovative in 2008. Now, Spring is overbloat, buggy (look at request-mapper) and have old, sensless integration to others modules, see spring-data for NoSQL, or try integrate last version of Velocity with last version of Spring. And additionaly, all, what you can do with Spring, you can do with JEE.

I think collectively we should point out the specific Spring modules as opposed to say that "Spring is overbloat and buggy".

Some of Spring modules seem to be quite stable enough. Others, the newer modules, will take time to be more mature.

Spring's goal have always been to be the 'glue layer' of the Java standards. Of course, now they want to be the 'glue layer' of everything, including Spring-Data for NoSQL (Neo4J and co.).

Speaking of which, your last statement is partly correct if only Spring == Spring Core. There's no MVC (in the sense of ASP.NET MVC or Rails MVC) in JEE yet (yet because things might change in the future). JEE has 2-3 technology covering the "VC" options: JSP, Servlet, and JSF. None of these are similar to that of ASP.NET MVC or Rails MVC.

Re: Ask HN: Why not Java?

#49
post #14

Earlier quoted context omitted.

Spring was innovative in 2008. Now, Spring is overbloat, buggy (look at request-mapper) and have old, sensless integration to others modules, see spring-data for NoSQL, or try integrate last version of Velocity with last version of Spring. And additionaly, all, what you can do with Spring, you can do with JEE.

I think collectively we should point out the specific Spring modules as opposed to say that "Spring is overbloat and buggy". Some of Spring modules seem to be quite stable enough. Others, the newer modules, will take time to be more mature. Spring's goal have always been to be the 'glue layer' of the Java standards. Of course, now they want to be the 'glue layer' of everything, including Spring-Data for NoSQL (Neo4J…

I pointed one module out - Spring-Velocity integration.

"Of course, now they want to be the 'glue layer' of everything, including Spring-Data for NoSQL (Neo4J and co.)."

Why do you need this? It's just Java and you can... just use it. Without glue.

"Speaking of which, your last statement is partly correct if only Spring == Spring Core. There's no MVC (in the sense of ASP.NET MVC or Rails MVC) in JEE yet (yet because things might change in the future). JEE has 2-3 technology covering the "VC" options: JSP, Servlet, and JSF. None of these are similar to that of ASP.NET MVC or Rails MVC."

What do you mean with MVC exactly? This is just buzz word. MVC Model 2 Architecture (and now you have Servlet 3) is good replacement for Spring MVC. JSR303 and JPA (or other) is good replacement for 'M' (and of cource, in Spring it's same way). We talk about Spring or Rails/ASP? And of course, here solutions in Play/Play2.

Really, you don't need Spring. It's 'Bug layer'.

Re: Ask HN: Why not Java?

#50
post #32
post #2

You can always do the speed-critical parts in C and link that from your Python code. Or, if your analysis is something already done, use a library already written in C (such as NumPy). Another approach could be Jython (or any other JVM language closer to the desired level of abstraction) and Java. I don't have much love for Java the language. It's not much easier to program than with C, isn't faster and is very verbo…

I noticed a lot of criticism of Java's verbosity in the comments and I'm a bit curious what people are referring to? I work primarily in Java, but also do quite a bit of Javascript and Perl, and I don't notice Java being especially verbose. Maybe internally I'm giving it a break because it isn't a scripting language? I'm honestly curious to see what you guys think.

The two areas that most frequently annoy me are processing collections and (lack of) first-class functions.

Java:

  List firstNames = new ArrayList();
  for(Person p : people) {
    firstNames.add(p.getFirstName());
  }

  addCallback(new Runnable() {
    public void run() {
      doSomething();
    }
  });
Python:

  first_names = [p.first_name for p in people]

  add_callback(do_something)
Scala:

  val firstNames = people.map((p) => p.firstName);

  addCallback(() => doSomething());
  
The Python and Scala versions do exactly what they say, while the Java code has a bunch of boilerplate that you have to mentally filter out before you can understand what it's doing. And the Scala code is fully typesafe; the compiler infers types rather than making you continually repeat them.
Post reply on HN