News for hackers. Stuff that matters.
Re:Modern Java – A Guide to Java 8 by escherize on Monday November 16, 2015 @05:27AM (#10573637)
I personally jumped right into Clojure on the jvm without much Java experience. I've found it to be awesome. Is there a non-political reason that someone should choose Java over Clojure (or possibly Scala)? Where does Java shine?
Re:Modern Java – A Guide to Java 8 by bad_user on Monday November 16, 2015 @05:46AM (#10573698)
There's a gravitational pull towards popular languages because popular languages have more books, more (idiomatic) libraries and tools, copy-pasteble examples all over the web and a big pool of developers that can be productive from day 1 on simple problems.

In order to adopt a language that isn't in the top 6 or so, you've got to have good reasons for it. And depending on the problems you're trying to solve, sometimes it's worth it, sometimes it isn't. For a startup, with a small but capable team that's trying to outrun its competition to market, then using the most productive tools possible is a good choice. In other contexts though, like in a big company where long-term maintainability might be more important than speed to market, well, Java might be the better choice, and not because of the language per se (I think Java code is often unreadable), but more because the cost of maintainability is low due to its popularity and its slow pace of change.

Re:Modern Java – A Guide to Java 8 by manyxcxi on Monday November 16, 2015 @08:29AM (#10574271)
I don't know how you can find even average Java code unreadable. If anything it's incredibly verbose. Only now with the most recent features is it really likely that you'll run into some one-liners and magic functions. Now, if you were talking about frameworks/app servers and not being able to figure out which levers and knobs to push to get them to behave, I would agree wholeheartedly.

I'm not saying Java is good looking by any means, but I've never found it to be heard to read in the "I can't completely grasp exactly what everything is supposed to do" kind of way. I often find Python and JS to have enough shortcuts, callbacks, and anonymous functions to find other people's code much harder to grok than other people's Java.

Re:Modern Java – A Guide to Java 8 by lomnakkus on Monday November 16, 2015 @08:48AM (#10574358)
> I don't know how you can find even average Java code unreadable. If anything it's incredibly verbose.

Not bad_user, obviously, but excessive verbosity can be antithetical to readability. (As can excessive conciseness.)

It can make the overall structure and meaning of the code hard to discern, even though can clearly tell where what gets assigned to what variables, etc.

Re:Modern Java – A Guide to Java 8 by rcurry on Monday November 16, 2015 @12:34PM (#10575732)
The thing that always kills me on new Java projects is wading through these enormous hierarchies of folders full of interface classes just to find one actual line of implementation code. Of course, right after that one line of implementation code there's an invocation of some other interface class that then leads me on the next goose chase to find line 2. I think it's not so much a problem of verbosity as it is this sort of "Enterprise FizzBuzz" mentality that crept into Java over the years. Some of this IOC stuff gets so far out of hand that I feel like I'm in the House of Mirrors at the local carnival when I first start trying to walk through a new code base.
Re:Modern Java – A Guide to Java 8 by pjmlp on Monday November 16, 2015 @12:55PM (#10575852)
Hence why IDEs with their code navigation tools rule.
Re:Modern Java – A Guide to Java 8 by mercurial on Monday November 16, 2015 @02:42PM (#10576636)
Yeah, I don't know. Java developers need IDEs like Rob Ford needs crack cocaine, but it's more a comment on the deficiencies of the language than the purported benefits of an IDE.
Re:Modern Java – A Guide to Java 8 by pjmlp on Monday November 16, 2015 @02:52PM (#10576713)
IDEs were created for Interlisp-D, Smalltalk and Mesa/Cedar.

Were popularized in the PC, Amiga and NeXT eco-systems, thanks to Turbo Pascal, Delphi, VB, AMOS, GFA, Objective-C, Eiffel, Oberon, ...

Java wasn't even a thing in those days.

Re:Modern Java – A Guide to Java 8 by mercurial on Monday November 16, 2015 @04:39PM (#10577401)
That's not the point. Due to its verbosity, it's impractical to use Java without an IDE. That's not necessarily the case for more compact languages.
Re:Modern Java – A Guide to Java 8 by pjmlp on Monday November 16, 2015 @05:25PM (#10577715)
Programs are written once, read multiple times.
Re:Modern Java – A Guide to Java 8 by bad_user on Monday November 16, 2015 @07:24PM (#10578347)
Would be curious to find out what that means, since I see it repeated many times in favor of mainstream and verbose languages, such as Java. I get it to mean somehow that Java is more readable, however in my experience that doesn't make sense, as the IDE can deal with generating the boilerplate, but the IDE cannot help with readability. Not even if you include quick navigation by click, since that has been the purpose of ctags in plain editors.
Re:Modern Java – A Guide to Java 8 by pjmlp on Tuesday November 17, 2015 @01:59AM (#10579579)
It means that anyone strange to the code is able to pick a pile of printouts and have a ruff understanding of the code.

Which is very hard in languages that are a pile of hieroglyphics.

This is very important in teams of 50+ developers, scattered around countries with high attrition rate, having various skill levels.

Also generating boilerplate is just 1% of what an IDE is capable of.

Re:Modern Java – A Guide to Java 8 by bad_user on Tuesday November 17, 2015 @05:58AM (#10580307)
The mathematical language is a "pile of hieroglyphics", yet mathematicians can speak it just fine. And in fact without their domain specific language mathematics would be much, much harder to deal with. We know this because the mathematical language in use today is newer than the discipline of mathematics and we can make a before and after comparison.

Personally I don't understand why some programmers insist on communicating only in english words. First of all because english words suffer from the problems of natural language, which is that natural language is imprecise, with the words having multiple meanings depending on surrounding context. For example when adding two numbers, should you use "add" or should you use "plus"? As it may be, "add" is actually incorrect according to its precise English definition, because the operation doesn't necessarily lead to increasing the size or amount. Yet this does not stop people from using it. Fortunately classes like BigDecimal are using "plus", yet I don't get why in the world would anybody think that "x.plus(y.multiply(z))" is more readable than "x + y * z".

You might thing picking on BigDecimal is a cheap shot. Well, how about the well known "ListUtils.union(a, b)" and why would that be better than "a ++ b". Speaking of "ListUtils.union", joining 2 lists is not a union, as union is in the context of sets or maps. Joining 2 lists is a concatenation and that matters, because concatenation is not commutative, whereas a union (of 2 sets or maps) is commutative. Basically the Apache Commons folks have got the naming wrong and if such mistakes happen in libraries that are so public, guess what happens inside corporate projects.

But much more problematic in languages like Java is not the wording as much as the way the logic is often expressed. In a functional programming language you usually get pure expressions that operate on immutable data-structures, pure as in true mathematical functions (for the same input you always get the same output). Such functions are much easier to reason about and much easier to test, because the output does not depend on some object's history (or in other words, an object's identity).

The worst and most unreadable code I've ever seen was written in Java, a language in which people often pass around mutable data-structures, like arrays, modifying them on the spot, for no good reason other than not knowing any better, in a dance of mutation that can only be considered an abomination of nature, with code so obtuse that it would make grown men cry. It's not uncommon for pieces of code to be commented with "here be dragons" with people no longer understanding what it does. Couple that with "enterprise design patterns" based primarily on IoC containers and best practices spawned from hell, with deep layers of inheritance that don't make sense and with chronic multi-threading issues and you've got a recipe for disaster. And you don't even have to search for proof for too long. Take any reasonably sized open-source project and you'll see this fact in all its glory. The last Java open-source project I interacted with is SpyMemcached and is a fine example of a Java project that works, that does its job well, that is reasonably well maintained, but that has internals that expose all the problems that I just mentioned. And sometimes I wonder why anything written in Java works at all, my guess being simply that people hit that code with the hammer until it quacks, in a process that resembles more natural evolution and mutation rather than engineering.

Therefore I'm personally dumbfounded by claims of readability. And in regards to the capabilities of an IDE, I do use IntelliJ IDEA, but I am wondering what the other 99% of its capabilities are, preferably that help with readability. Syntax highlighting?

Re:Modern Java – A Guide to Java 8 by mercurial on Tuesday November 17, 2015 @12:26AM (#10579324)
Eclipse folds the import section, and you can get the type of a value by hovering over it, but apart from that, I'm not sure.
Re:Modern Java – A Guide to Java 8 by Too on Monday November 16, 2015 @02:42PM (#10576642)
The verbosity not just directly affects readability by simply being longer and more to read. It also affects writeability which in combination with lazy developers (as we all are) leads to bad, unreadable, code. This is true for any language and can most often be seen on sloppy error handling, if you have to write 2x the amount of code to handle errors will you do it? 10x?
Re:Modern Java – A Guide to Java 8 by stickfigure on Monday November 16, 2015 @06:43PM (#10578184)
Odd that this is showing up as a jab against Java and not, say, Go.
Re:Modern Java – A Guide to Java 8 by bad_user on Monday November 16, 2015 @07:31PM (#10578377)
Oh, it is very much relevant for Go, except that those of us interested in expressivity simply gave up on Go a long time ago.

You see, Go is not popular enough to have users that don't like it. The people that end up trying out Go simply move to something else if they don't like it. Go's community is also strongly opinionated and has rejected any dialog for meaningful improvements. In other words the Go community is filtering out people that want something different. Whether this is good or bad, you be the judge, but if there's one thing that's definitely bad is the echo chamber. Case in point you're under the impression that Go is tolerable, even though many of us consider it to be worse than Java.

Re:Modern Java – A Guide to Java 8 by stickfigure on Tuesday November 17, 2015 @03:33AM (#10579853)
You misunderstand me. I find Go painfully verbose, mostly because of the elaborate if/else constructs around every single method call to handle errors. Even Java's ill-conceived checked exceptions (which can be suppressed with lombok's @SneakyThrows) are a massive improvement.
Re:Modern Java – A Guide to Java 8 by jdmichal on Monday November 16, 2015 @10:44AM (#10575029)
Completely agree. This is really the best time for comments in Java. Have 5 lines of stuff that's essentially working towards a single goal? Comment it! You should end up with the comments reading out the narrative properly, even if the code is way too wordy.
Re:Modern Java – A Guide to Java 8 by the_af on Monday November 16, 2015 @09:13AM (#10574482)
Java's verbosity (and misuse of OOP, but to be fair, that's not the fault of the language) can get in the way of understanding. Why use multiple words to say something when a single word will do? "Unreadable" is obviously hyperbole; "harder to read" is probably more accurate.

On the contrary, I think the recent additions from Java 8 are a step in the right direction.

Re:Modern Java – A Guide to Java 8 by kazagistar on Monday November 16, 2015 @02:04PM (#10576346)
> more (idiomatic) libraries and tools

Except almost all the tools work with the pre-java-8 way of doing things (and often even pre-java-7). Thus, you end up with layers of different idioms, all of which are not quite compatible with each other.

Re:Modern Java – A Guide to Java 8 by struppi on Monday November 16, 2015 @05:39AM (#10573679)
Disclaimer: I personally prefer clojure, but earn most of my money as a consultant / coach helping clients develop Java code.

For Java code, it's often easier to predict the performance characteristics of a part of the code. But you shouldn't trust your judgements anyway - instead use a profiler - so this is not really a reason.

Speaking of performance: I once talked to someone working for Elasticsearch, and they told me that they cannot use clojure for most of their code because of their performance requirements. Clojure collections are almost as fast as Java collections in many scenarios, but that is apparently not fast enough for them. This is probably not a valid reason for most projects, though.

There is a huge number of Java developers out there, and Java is easier to learn for someone coming from C++ or C# or JavaScript than clojure (at least I am pretty sure about that). So hiring cheap developers might be easier if you use Java. You might count that one as a political statement.

There are some great tools for Java out there: IntelliJ Idea, Yourkit Profiler, JRebel, ... Cursive Clojure is great, but IntelliJ for Java has even more integrated workflows.

There are very mature open source libraries / frameworks / tools for Java: JUnit, Spring, Guice, Dropwizard, Gradle, Elasticsearch, ... You can have commercial support for many of them. Most of the libraries I use with clojure are version 0.3 or something like that with no possibility for commercial support (but they work fine anyway).

Static typing: A lot of people complain about it, but it can really help you to create maintainable code. See for example http://talks.samirtalwar.com/use-your-type-system.html

Re:Modern Java – A Guide to Java 8 by mullr on Monday November 16, 2015 @01:05PM (#10575929)
Really high performance Java code tries to avoid any allocations on the hot paths, since that requires GC. This means a lot of in-place mutation on pre-allocated objects. (Lucene does this, for example) While this isn't impossible in Clojure, you do have to give up a lot of the immutable goodness that makes it such a pleasant development environment.
Re:Modern Java – A Guide to Java 8 by lmm on Monday November 16, 2015 @06:30AM (#10573839)
All IME, and as a Scala fan:

Clojure has a weakly integrated type system (an inherent disadvantage of optional type systems). At the simplest level this makes silly errors much easier and means you have to write more tests to maintain the same defect rate.

The lack of types mean you require extensive use of macros for advanced functionality. IME macros have major maintainability issues in a multi-person codebase.

Both these things are major disadvantages for automatic comprehensibility of code. Autocompletion can be more-or-less usable but will never be as good as in Java or Scala. Automated refactoring is inherently unsafe in the presence of macros (Scala's fancier typed constructs (typeclasses, for/yield with custom types) mean you need macros much less often; Java tends to force you to expand these things out by hand (or else use annotations which act as de facto macros), which has its own maintainability issues but does at least mean automated refactoring will work correctly).

Some of the language culture pushes people towards less principled abstractions. From this side of the fence that looks like anti-intellectualism; no doubt from their side it's pretension on typed programmers' part. But either way I think they're setting themselves up for long-term maintainability issues (e.g. the semantics of clojure transducers in the presence of errors are infuriatingly not-quite-right, which will either remain a painful gotcha forever, or necessitate a painful migration in the future).

As a minority language Clojure may not be as well supported in the surrounding ecosystem - partly things like IDEs but also code coverage tools, profilers, monitoring.... Remember the JVM ecosystem is wider than just the languages themselves.

There are good things about Clojure, but it's by no means clear-cut.

Re:Modern Java – A Guide to Java 8 by cageface on Monday November 16, 2015 @07:49AM (#10574088)
A while ago I decided to teach myself how the common machine learning algorithms worked and, to make things interesting, decided to implement them in parallel in both Clojure and Scala. I expected Clojure to be a better fit for this since Lisp has historically been strong in AI. But I found as my codebase grew that the Scala code was much easier to maintain, refactor and understand. So these days I am a big fan of static typing provided it's in the form of a sufficiently expressive type system (Scala, Ocaml, Haskell, Swift etc).

Lisp got a lot of things right but I'm not sure dynamic typing and s-expression syntax were among them.

Re:Modern Java – A Guide to Java 8 by ubertaco on Monday November 16, 2015 @07:27AM (#10574000)
> IME macros have major maintainability issues in a multi-person codebase.

I have heard this a bunch, and I believe it, but I've never personally had an opportunity to use a language that supports macros for a multi-person codebase. I'd be interested to learn what are some of the pitfalls you've seen, if you don't mind sharing.

Re:Modern Java – A Guide to Java 8 by lmm on Monday November 16, 2015 @07:48AM (#10574084)
It's not like I have a lot of experience (macros are much rarer in my primary language, Scala). But it's usually just someone doing a refactor that "makes sense" according to the logic of the regular language but not within the macro. A lot of it is simple, "silly" things like trying to extract a repeated piece of logic into a method call, only it doesn't work because the logic uses something the macro hooks into, or just is transformed in a surprising way by the macro that makes the reasoning incorrect. To take a completely trivial real-world example, renaming a field is usually a safe operation that you can do automatically (with an IDE) without even testing, but if that field's used in a macro then maybe it represents a key in a JSON object and you've just broken your web API. You notice it pretty quickly, and it's a two-minute fix - but these kind of "thousand cuts" scenarios really slow development. Outright production failures are less common but I've seen those when test coverage was poor or other failures interacted.
Re:Modern Java – A Guide to Java 8 by raspasov on Monday November 16, 2015 @07:19AM (#10573974)
What do you think is not quite right about errors in tranducers? When you use them with core.async channels you can supply an optional exception handler, which is quite nice.

In terms IDEs, Cursive for IntelliJ is great, and it gives almost Java-like capabilities (with limitations inherent to more dynamic languages, of course).

Re:Modern Java – A Guide to Java 8 by lmm on Monday November 16, 2015 @07:52AM (#10574098)
I forget the exact behaviour, and maybe it's been improved. But I remember that it didn't map cleanly onto values - sometimes you want to continue after a single error, sometimes you want to bail out immediately, and the ways of doing this felt very ad-hoc.
Re:Modern Java – A Guide to Java 8 by raspasov on Monday November 16, 2015 @11:37AM (#10575383)
I think you can do what you are describing with a channel https://clojure.github.io/core.async/#clojure.core.async/cha...
Re:Modern Java – A Guide to Java 8 by jvz on Monday November 16, 2015 @07:21PM (#10578330)
> The lack of types mean you require extensive use of macros for advanced functionality.

Could you elaborate?

Re:Modern Java – A Guide to Java 8 by lmm on Tuesday November 17, 2015 @03:04AM (#10579771)
A lot of things that can be implemented natively in scala using its fancy type system would likely be done with macros in clojure. E.g. scala-arm, treelog, dependency injection (not that I use it), database transaction management. Or even just async.
Re:Modern Java – A Guide to Java 8 by jbooth on Monday November 16, 2015 @08:46AM (#10574350)
Java works great on large teams. The stuff that people complain about as "too much boilerplate" and "super boring" when you're writing code is actually really awesome when you have to read a bunch of code and half the people who wrote it are gone. Boring is better than clever when it comes to maintenance.

They're conservative about adding features, so they've managed to keep the language pretty small, and the core concepts of "what is good Java code" have been mostly the same for like 15 years, even through major releases like 1.5.

Re:Modern Java – A Guide to Java 8 by jinst8gmi on Monday November 16, 2015 @09:16AM (#10574508)
I don't really find it "actually really awesome" when I have to read through 6 screens worth of getters and setters in legacy Java code vs what it would have looked like in C# or Scala. In Scala or C# you're looking at the actual logic, not playing hide and seek with it amongst irrelevant boilerplate in Java.

Java developers usually consider features which the language doesn't have to be bad or make code unreadable, that is until those same features are added to Java, when suddenly they are a source of pride and a sign of Java being "modern". In reality Java's feature freeze until Java 8 was largely driven by Sun's financial woes.

Re:Modern Java – A Guide to Java 8 by RyanZAG on Monday November 16, 2015 @11:24AM (#10575280)
I think jbooth is talking more about forced verbosity such as

  Map<String, Customer> customerMap = createCustomerMap();
where in other less verbose languages you find

  val customerMap = createCustomerMap();
Always seeing the definition of a value in the current function context is actually very nice for maintainability, but does give Java the reputation of being overly verbose.

Stuff like getters/setters on all values in a class are awful though and are both a code smell and unnecessary. They break the OO principles and should not be there in the first place. It's good that Java makes those 6 screens worth of getters and setters awful - they are awful. For objects which are used solely for transfering state, check out Google's AutoValue ( https://github.com/google/auto/tree/master/value )

However if you do see a class that is 6 screens of just getters and setters then you know exactly which class you need to fix.

Re:Modern Java – A Guide to Java 8 by jinst8gmi on Monday November 16, 2015 @11:52AM (#10575468)
I agree with you, up to a point. I find Ruby code pretty awful to make sense of with very little type information. Type inference with explicit return types for methods strikes a nice balance between verbosity and readability. I think Scala, Kotlin and to some extent C# do a better job of this than Java.

There are also many less favourable cases where you see things like:

   Customer customer = new Customer();
   String str = "I'm a String"
   SomethingOrOtherFactory factory = new SomethingOrOtherFactory();
which isn't any clearer than:

   val customer = new Customer();
   val str = "I'm a String"
   val factory = new SomethingOrOtherFactory()

Having a dozen getter/setters is generally a code smell, but having a dozen getters isn't.
Re:Modern Java – A Guide to Java 8 by RyanZAG on Monday November 16, 2015 @12:24PM (#10575680)
Agreed, but:

  Animal customer = new Cat();
It makes it clear how the new object will be used. It does come up quite frequently, especially with Collection and List. Nobody was saying it is not verbose and can lead to boilerplate. The assertion is that when viewing a large code base, you are always sure of the type of value you are dealing with on a local level. If all of your objects are well defined, you don't even need to look at how the class is created (a billion getters and setters? irrelevant to the local function) as you only need to deal with the local function.
Re:Modern Java – A Guide to Java 8 by lmm on Tuesday November 17, 2015 @11:45AM (#10582248)
That's there if you want it though.

    val customer = new Cat(): Animal
I can see arguments against inter-method type inference, but I think there's no real argument against type inference within a single method (requiring explicit types on method boundaries). If you have a billion-line method you have bigger problems.
Re:Modern Java – A Guide to Java 8 by pjmlp on Monday November 16, 2015 @01:02PM (#10575909)
The first time I saw properties was in Eiffel, afterwards adopted by Delphi, which eventually found their way into C# and to many other languages.

Comparing to the original implementation of properties in C# (not how they look now), the Java way wasn't that different.

They just copied what was common C++ and Smalltalk practice back then, whereas Anders obviously had his Delphi experience.

Not that they shouldn't eventually improve it.

Re:Modern Java – A Guide to Java 8 by malcolmgreaves on Monday November 16, 2015 @03:46PM (#10577026)
IMO Java doesn't shine anywhere. It's statically typed, but lacks support to be flexible. Thus many Java programs rely on reflection at runtime or casting. This negates all of the benefits of static typing, turning the language into a dynamic one.

The main choice is then either Clojure or Scala. This comes down to dynamic versus static type checking. With a dynamic language, one is significantly less sure if a program is correct. In large programs that use dynamic languages, many tests must be created that are essentially doing the work that a type checker in a static language would do automatically.

In a static language, entire classes of bugs are eliminated. Scala provides the best support for strong, static typing on the JVM.

Re:Modern Java – A Guide to Java 8 by incepted on Tuesday November 17, 2015 @12:19AM (#10579301)
> Scala provides the best support for strong, static typing on the JVM

I'd argue that Ceylon and Kotlin offer most of Scala's advantages with none of its baggage and bloat. And drama.

Re:Modern Java – A Guide to Java 8 by lmm on Tuesday November 17, 2015 @11:47AM (#10582260)
All those things will come as those languages mature, and until then neither has much library or tool support.
Re:Modern Java – A Guide to Java 8 by incepted on Tuesday November 17, 2015 @11:33PM (#10585934)
No tool support?

Kotlin and Ceylon both have very good IDE plug-ins that already work much better than Scala, despite Typesafe pouring a lot of money into their own plug-in.

Re:Modern Java – A Guide to Java 8 by lmm on Wednesday November 18, 2015 @03:10AM (#10586574)
There are a lot more tools in the JVM ecosystem than just IDEs, and by now most of them have Scala support.
Re:Modern Java – A Guide to Java 8 by aardvark179 on Monday November 16, 2015 @06:16AM (#10573799)
I love clojure, but on a large code base I find good refactoring tools to be extremely helpful when trying to evolve how things are implemented. In that respect Java wins hands down just because of the tooling around it. It also may be easier sometimes to use Java for working with particular libraries.

There are however areas where I'd use clojure every time. Luckily the JVM is really good for doing mixed language work on, so you don't have to work entirely in one language.

Re:Modern Java – A Guide to Java 8 by eklavya on Monday November 16, 2015 @05:39AM (#10573677)
A type system (at least scala)? Although Clojure does have one, it's not as good to use as Scala's (personal opinion).
Re:Modern Java – A Guide to Java 8 by RyanZAG on Monday November 16, 2015 @05:42AM (#10573684)
In the same way some people pick C++ over Lisp, some would choose Java over Clojure for similar reasons.

It's not some kind of war or personal affront to you - some people simply prefer the Algol style to the Lisp one. This even includes people who are very fluent in the Lisp style.

Re:Modern Java – A Guide to Java 8 by dvanduzer on Monday November 16, 2015 @05:53AM (#10573728)
Re:Modern Java – A Guide to Java 8 by dvanduzer on Monday November 16, 2015 @05:43AM (#10573691)
There is no non-political reason to enumerate choices of languages limited to those that run on the JVM.

Clojure and Scala exist because of the JVM, not because of Java. Java 8 will or won't be an interesting language independently of the JVM, oddly enough.

Re:Modern Java – A Guide to Java 8 by pjmlp on Monday November 16, 2015 @07:20AM (#10573977)
It is the systems programming language of the Java platform, if you see the JVM as an OS.

So you need to be comfortable with it, as there will always be cases you need to jump out of the alternative language into Java.

Also, most companies will only hire to work with Java on the JVM, because they don't want to be hostage of the cool language some of the dev team guys/contractors decided to use instead.

It is very rare to see traditional Java shops to use alternative languages.

Usually the ones using them are either startups or companies like Facebook and Twitter, which aren't the typical business culture.

Re:Modern Java – A Guide to Java 8 by mark_l_watson on Monday November 16, 2015 @10:14AM (#10574836)
I have been using Java since the first beta, and have written a large pile of Java books (pun not intended), but I too prefer Clojure as a practical, simple to use and simple to read language. That said, Clojure / Java interop is really nice. I frequently find myself simply adding existing Java code to my lein project file.

I would suggest just keep using Clojure and when it makes sense, mix in Java when you want or need to.

Re:Modern Java – A Guide to Java 8 by chvid on Monday November 16, 2015 @10:20AM (#10574877)
This might sound like a snarky comment but it is actually not.

If you want a dynamic language on the Java platform; then why not use JavaScript?

There is an easy-to-use engine in Java 8 and JavaScript is widespread and somehow familiar to Java-developers.

Re:Modern Java – A Guide to Java 8 by lmm on Tuesday November 17, 2015 @11:54AM (#10582325)
JavaScript is just not a nice language to maintain - bizarre scoping, confusing inheritance model, extremely clunky syntax, confusing standard data types. Being "dynamic" isn't a feature so much as an acceptable cost, but JavaScript doesn't really give me any expressibility advantage over straight Java, yet alone compared to Scala.
Re:Modern Java – A Guide to Java 8 by mark_l_watson on Monday November 16, 2015 @10:51AM (#10575062)
I like JavaScript for Meteor.js and general front end development but I have never thought to use embedded JavaScript. Clojure is a practical little language and suits my taste.
Re:Modern Java – A Guide to Java 8 by winterbe on Monday November 16, 2015 @06:27AM (#10573825)
Most parts of software development probably is not about starting new projects from scratch but about maintaining existing code bases. That's where Java really shines due to its (often hated) backwards compatibility.
Re:Modern Java – A Guide to Java 8 by oweiler on Monday November 16, 2015 @05:49AM (#10573713)
Apart from the slightly better performance, memory consumption. Clojure's persistent collections require a fair amount of memory (which in most cases doesn't matter as memory is cheap).
Re:Modern Java – A Guide to Java 8 by lugus35 on Monday November 16, 2015 @06:02AM (#10573761)
Java shines by the number of java professionals available on the market.
Re:Modern Java – A Guide to Java 8 by fulafel on Monday November 16, 2015 @06:15AM (#10573795)
Many people have a gut-level aversion to dynamically typed languages.
Re:Modern Java – A Guide to Java 8 by jinst8gmi on Monday November 16, 2015 @05:58AM (#10573745)
> Is there a non-political reason that someone should choose Java over Clojure (or possibly Scala)? Where does Java shine?

If you are stuck with a group of developers who have no interest in learning anything new and wish to use Java until they retire then Java is the only choice. Other than no new learning required I can't think of many reasons to pick Java as a first choice. Java tends to be popular because it's the oldest, most familiar default for the JVM rather than any particular strength.

Re:Modern Java – A Guide to Java 8 by ubertaco on Monday November 16, 2015 @07:38AM (#10574050)
>If you are stuck with a group of developers who have no interest in learning anything new and wish to use Java until they retire then Java is the only choice.

Put another way: if you're on a dev team where nobody knows Clojure/Scala, and everyone knows Java, (and, optionally, the codebase is already in Java), and your team doesn't have time for everyone to learn an entirely new language (including cleaning up the beginner's mistakes that come with that process), then Java's the better choice.

Don't get me wrong, Java grinds my gears sometimes, and I frequently wish I could use Kotlin or F# or some kind of typed Ruby in my Java-shop workplace, and I enjoy picking up the cool ideas from languages like Idris (dependent types are really cool!) in my free time. But I'm sympathetic to my coworkers in the environment where I work: 4 devs in the whole company, startup pressure to get to a break-even point so we don't go under, and a backlog longer than all of us could finish this year even if we froze it now.

Sometimes circumstances require what looks like a short-term decision in order to ensure that there's a long term to worry about later.

Re:Modern Java – A Guide to Java 8 by lmm on Monday November 16, 2015 @08:56AM (#10574397)
You can write Java-without-semicolons in Scala and be productive from day 1, possibly even hour 1. Then you work up to fancier features as and when they provide a practical advantage. That's how I started.
Re:Modern Java – A Guide to Java 8 by jinst8gmi on Monday November 16, 2015 @08:20AM (#10574234)
With existing Java code and/or a tight timeline with existing skills I can see how that would be the best choice :) I'm thinking more in terms of the surprisingly high proportion of Java developers who have never learned another language since learning Java 10-15 years ago and dismiss any alternatives without ever exploring what else is out there (you clearly don't fall into that category :).
Re:Modern Java – A Guide to Java 8 by pjmlp on Monday November 16, 2015 @08:55AM (#10574390)
This is quite typical in most companies where devs don't have trainings nor wish to spend time with work in their free time.

I bet you will find thousands of C++ devs that don't even know that there are newer versions of C++98.

C devs that still use K&R as their guide with C89 code style.

And so on.

We are the few select ones that care to improve our skills.

EDIT: Typos.

Re:Modern Java – A Guide to Java 8 by vonmoltke on Monday November 16, 2015 @10:14AM (#10574841)
> I bet you will find thousands of C++ devs that don't even know that there are newer versions of C++98.

Actually had a guy tell me (in 2006!) that the main problem with C++ was that there was no standard. :|

Re:Modern Java – A Guide to Java 8 by justinhj on Monday November 16, 2015 @11:47AM (#10575438)
There's an irony that your comment is in a thread about learning new features of Java 8
Re:Modern Java – A Guide to Java 8 by meekins on Monday November 16, 2015 @06:48AM (#10573896)
Java EE is currently an excellent framework for complex distributed enterprise applications.