Live data from Hacker News

Java for Everything

teamten.com

101–110 of 344 posts

Re: Java for Everything

#101

It's not so much that Java is great at everything. It's more like it doesn't suck at anything. Every other language has, somewhere, a deal-breaker for some particular use. I've not found one for Java. And Java's biggest downside, frankly, is that it hasn't attracted fresh young talent in a while, so it doesn't have really hot frameworks and libraries.

IMO, being tethered to the JVM is both its greatest strength and its greatest weakness. The JVM really is a masterful piece of engineering, but it is optimized so heavily for the server that any use case that deviates requires huge hacks to get what you want. For example, running a JIT on Android was so sluggish that Android had to design an entirely new runtime(ART).

Re: Java for Everything

#102

You have to admit that for coders, the joy of writing helps a lot for job satisfaction. I write both Java and Python (for very different applications) and I just always feel like Java makes it hard to write anything elegant almost on purpose. The proliferation of huge frameworks and FactoryFactories clearly doesn't help. I think you can underestimate the value in actually enjoying writing - I'm just more motivated ev…

I'm of two minds on this. Certainly it's important people find enjoyment in the day-to-day reality of their job. Unhappy people don't write good code in any language. But I honestly do thing people can have too much fun writing code. We've all fallen in love with something we've written even though it might not have been the simplest or most understandable or idiomatically sound.

Writing Python is fun. But that joy can cloud your judgement, and if we are to consider ourselves professional, we have to look beyond just that and make decisions based on our employers best interest. Sometimes that might be Python, but in my experience, quite often that's boring old Java.

Re: Java for Everything

#103
post #81

A significant amount of the article is arguing that Java for everything is better because the author and his coworkers already knows it. I can make the same argument for Python _for me_. And for my company too; we have a ton of Python developers already, so it makes sense to write things in Python if possible in case someone needs to change or improve anything. The author also talks about how Java's verbosity is a tr…

Though the lack of noise could also translate to parsing things in my head trying to understand what is happening in this super short code....hence it takes longer to read the code!

Re: Java for Everything

#104
I think that the argument about verbosity is a subtle red herring. It's not that you just have to write slightly longer words to do the same thing. It's that you can't do the same thing at all because the underlying constructs of the language are lacking in key powers of abstraction that make it easy to simplify the problem you are trying to solve. You end up inventing whole class hierarchies and patterns to emulate things that are either just built into other languages or are easy to achieve because they offer more powerful language features (like reified generics, etc.). Java 8 helps a lot, but there are still fundamental weaknesses.

Having said that, I'm still a fan of Java. There's no other language that I can sit down and reliably navigate through someone else's code in as easily - and that comes partly because it's powers of abstraction are so limited.

Re: Java for Everything

#105

There's the language and there's the ecosystem. A lot of negative feelings that still linger are, IMHO, directed more at some of the painful historical aspects of the ecosystem: J2EE XML configuration hell, EJBs, bloated application servers, XML for everything, JAX-WS, SOAP, ant, classloader problems, maven dependency hell, 10 different logging libraries, etc... A lot of this stuff truly sucked. But I feel things hav…

I suspect readability isn't a big priority for you. Here's how I'd write this, lambdas or not: public static List sortDescending(List ints) { ints.sort(new Comparator () { @Override public int compare(Integer o1, Integer o2) { if (o1.equals(o2)) { return 0; } else if (o1 My personal perspective is that your use is a typical abuse which turns simple code into something unreadable and overly complex. This makes code ha…

shrug. This seems like a pretty standard use of the ternary operator to me. I mean, just google examples of Comparator, and you'll find tons of examples like this:

   @Override
   public int compareTo(Object arg0) {
       Country country=(Country) arg0;
       return (this.countryId  country.countryId ) ? 1:0 ;

   }
(http://www.javacodegeeks.com/2013/03/difference-between-comp...)

But that's orthogonal to my point, which is that lambdas offer significant improvements to readability because they remove the irrelevant cruft and simplify the code.

Re: Java for Everything

#106

Earlier quoted context omitted.

Java's start up time makes it pretty crappy for command line utilities.

When did you last try it? Startup time was optimised heavily some time ago and nowadays I don't notice any real difference unless I wrote some toy app and used "time". The JVM starts fast enough that you can write command line utilities just fine.

It is certainly substantially better than it used to be, but it is still pretty far away from an AOT compiled native executable. And forget it entirely if you are running Clojure or Groovy code.

Re: Java for Everything

#107
post #53

Does anyone know a good starting point for learning not just Java, but how to install everything I need? I consider myself the Neo of OOP and a master devops, but every time I tried to use Java I hit a wall of unreadable manuals/guides , software impossible to install/maintain, and mixed opinions among Java devs. Like it can't be used without a dedicated sysadmin.

Well. What do you need?

For me I've found I only need a few things to get started. One is the JDK, obviously. Another is Maven. It downloads dependencies for you and is pretty standard (there's also Gradle which some projects use). Finally there is IntelliJ for development. That's about it. Pretty much everything else can be downloaded and installed automatically be Maven or your IDE.

For web development, I've found Ninja Framework to be quite nice. The documentation is very good. The biggest problem is that it tends to delegate to lots of other libraries for functionality, and often those libraries have been around a long time and in some semi-standardised state that can be horrifically confusing (e.g. Hibernate). The Java world REALLY likes to take good open source libraries and then copy their interfaces into standards that other products can then implement. This sounds great in theory, and I'm sure some people do benefit from that, but it makes learning this stuff a giant PITA because the documentation for everything always has five versions, four implementations and every annotation or API has two identical versions in different namespaces, only one of which will actually work. Argghhhhh.

However if you do make it past this swamp, then the tools themselves are actually rather powerful and performant.

Re: Java for Everything

#108
post #87
post #67

Earlier quoted context omitted.

It will give you faster compilation speed, though.

Think about it, does it really? To parse Foo x = new Foo(); , javac has to perform type inference on the right hand side to figure out its type, and then check whether that type is a subtype of the left hand side. Telling the compiler: "hey, trust me, variable x is of type Foo" doesn't make the compiler's job any easier at all.

In that case specifically, no, but in general doing type inference means running a constraint solver over the entire program, which will definitely add some overhead to the compilation time.

Re: Java for Everything

#109
post #10

I cannot keep my sanity when I use dynamic languages in fairly big projects. I just cannot organize my code and all the functionality good. So, I looked at the options at Java and most of them looked either very complicated(Spring) or insufficient. I am developing a very simple framework, insipred from Sparkjava and Play Framework: https://github.com/mustafaakin/WebOM It basically maps either HTTP requests or Websock…

I'm not sure what you're trying to do. If you're talking about dependency injection: 1) be aware that you're ditching some safety by relying on it 2) look at Guava

I just map a request like /users/:groupId?orderBy=name to A java object like "int groupId", and "String name" and it puts them automatically by converting, and if you wish you add some checks, notnull, range etc. and It replies bad request to client. Therefore, I do not do this conversion and checking each time.

Re: Java for Everything

#110

There's the language and there's the ecosystem. A lot of negative feelings that still linger are, IMHO, directed more at some of the painful historical aspects of the ecosystem: J2EE XML configuration hell, EJBs, bloated application servers, XML for everything, JAX-WS, SOAP, ant, classloader problems, maven dependency hell, 10 different logging libraries, etc... A lot of this stuff truly sucked. But I feel things hav…

Keep in mind that JAX-WS with JAX-B beats other rival libraries in other languages. If your requirement is to be a client that consumes SOAP web service given wsdl, I'd take Java any given day. The wsimport and wsdl tool that JDK provides beat any libraries.

Also, JAX-B annotation can serialize and deserialize to JSON given the right provider. That's JSON, XML with POJO with the price of one. Good example of Java ecosystem: build on top of existing one / backward compatible / play nice with others.

Post reply on HN