6 ms·
Can someone explain why I should use Java? Over literally any other language? Why is the lobster still alive? EDIT: on my phone and meant to write monster.
by robertk 10y ago
Can someone explain why I should use Java? Over literally any other language? Why is the lobster still alive?
EDIT: on my phone and meant to write monster.
- alphabetam 10y agoBecause it's the most used language in enterprise software. It's reliable, rather easy to learn, and quite productive. It's not particularly fun, but it works and the tooling is pretty great.
- pythonaut_16 10y agoIf you already have a big Java code base and/or your employer forces you, or there's some killer bit of code that is absolutely crucial to you and it's more effective/efficient to choose Java to be able to use it than to find an alternative or rewrite it in another language.
- meddlepal 10y ago1. Massive ecosystem? 2. Easy to find programmers? 3. Great networking and concurrency libraries? 4. Simple language with an amazing virtual machine? 5. Ecosystem has several good other languages that interop from good to amazing with Java including Scala, Clojure, JRuby, Groovy, and Kotlin.
- hrjet 10y ago6. Tooling
- vorg 10y ago> from good to amazing with Java including Scala, Clojure, JRuby, Groovy, and Kotlin After writing "good to amazing", you put an ordered list which many readers will subliminally rank in the order you provided, with the "amazing" languages on the right. I've tried 4 of those 6 languages, and would rank them in a different order. > Ecosystem has several good other languages that interop from good to amazing The ecosystem also has several other languages that interop from bad to amazing, just like other ecosystems.
- shaftway 10y agoHow is this different from any other language? Let's face it, every language is just a Taco Bell menu item (1), choosing from them same dozen or so ingredients. [1]: http://whatis.techtarget.com/definition/Taco-Bell-programming http://whatis.techtarget.com/definition/Taco-Bell-programmin...
- joncampbelldev 10y agoJava dev here, excluding legacy code, very little reason. I find clojure a significantly better language, and theres always kotlin / scala if static typing is your thang. People tend to conflate the not-so-nice java language with the good parts (libraries and JVM). The performance of the JVM and the same massive ecosystem of existing libraries are available in clojure, scala and kotlin.
- pjmlp 10y agoUsing JVM without Java, is like being on UNIX and not using C. Sure there are lots of goodies on user space, but there isn't any way around it, when you want to extract all juice from the platform.
- joncampbelldev 10y agoPerformance wise I've never encountered a problem: - protocols have the same performance as interfaces but with significantly more power (solving the expression problem by default prevents so many headaches when you have to add more functionality later) - loops and other binding constructs can have type hints to allow java-speed numerical operations - immutability by default does have a cost in memory and cpu, but the ease and safety of concurrency it has enabled in my codebases more than makes up for it, e.g. "oh i've got a large (>100000 elements) of data being processed here in various ways (map, filter etc), lets parallelise that and give it a thread pool" I feel that if I were truly performance constrained in clojure its likely I would have performance troubles in java, the difference is just not big enough. BUT if such a situation came up, theres nothing to stop me coding up my super duper ultra performance needed code in java and just calling it from my clojure codebase. Interop is very nice. YMMV but its never been an issue in my day to day work (mainly involves analytics, visualisation, web services)
- roboguy12 10y agoMy experience with kotlin so far has been great. I've used it in personal projects, and am in the process of converting some microservices at work to it from java (the interop is seamless, so I'm able to do it incrementally as opposed to a full rewrite). People ask me what the difference is between kotlin and java, and I typically reply with "it's java, minus all the bad stuff". Variable types are inferred, map/reduce/filter are builtins and don't require going through a Stream, there's no need for Guava anymore since listOf() and mapOf() are builtin, boilerplate-reducers like data classes continue to speak to the whole "it's pretty much java, but how you _want_ to write it" mantra. It nails all of the little things that java has just missed, like in an if-block after checking a variables instanceof, you don't need to explicitly cast it to that type. There are tons of simple things like this that just come for free, and when you go back to java it's amazing how much extra, pointless boilerplate you need to write. I personally don't see any reason for me to ever write java again.
- jhomedall 10y agoThere are a staggering number of high-quality, open-source libraries available for it.
- alanfranzoni 10y agoMixed reasons Java/JVM environment (applies to Clojure, Scala, Groovy, etc): 1. Dependency management done right. Maven and Grade simply blast away most other dependency management systems. So yes, the code may be longer to write than other languages, but it's very easy to reuse code that's already written (by you and others) 2. Plenty of high quality third party libraries. Thank the enterprise, thank Android, thank whover you like: they just exist. 3. Stable APIs, libraries, and language. There have been very few occasions where backwards compatibility was broken in Java, and those were mostly very complex edge cases that occurred quite rarely. Nothing like py2->py3 btw. Sometimes slow is not so bad; it means you don't need to fix your code every 3 months because something changed upstream. 4. API/Interface first. Java encourages modularity and composition; J2EE may be a monster since it's comprised of dozens of interfaces, but it actually makes it very, very easy to "swap out" a single component with your own implementation without needing to rewrite/fork a whole library or framework. The way most things in Java work and interact are perfectly documented and standardized; combining even tens of different libraries is easy, you don't risk that each author has a different opinion on 'the right way to do it' that makes it not compatibile with the others. 5. Excellent tooling. Java IDEs are really advanced and can perform error-free refactoring and other operations on large projects. 6. Works on many platforms, in quite an expected and homogeneous way.