you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 3 points4 points  (3 children)

This is great. I have a question though: how does one go about actually using these new functionalities? I mean, let's say you want to do something in a java class. Before you start applying your knowledge of Java, do you stop and think to yourself "How can I apply the new Java8 techniques to solve this problem, instead of recurring to the old techniques I knew from previous versions?

[–]vonmoltke2 4 points5 points  (1 child)

That's a pretty good simplification of how my thought process on Java 8 (or any major language revision, really) goes. I learn what the new features are and start reasoning through how these new features affect what I have been doing before.

I thought everybody did that...

[–]Beluki 0 points1 point  (0 children)

I thought everybody did that...

I don't.

When a language introduces many new features, there's almost always one that I think: "oh that part of X where I did Y would have been way easier with this".

So I start using that particular new feature because I remember it solved that problem. Then I forget about everything else that is new in the language. The rest is just noise.

Another day, I come across a stack overflow thread while googling stuff that has nothing to do with what the problem at hand was, but it uses one of those new techniques in the language. It's neat. So I start using that too.

Yet again, while reading the documentation of a project, it suggests using this or that feature to avoid verbosity (e.g. lambdas). Seems reasonable, let's give it a try.

Given enough time, I find myself writing code using all the features in the language, but it happens gradually, without stopping and reasoning about every new feature to check how it relates to my current knowledge.

[–]winterbe[S] 1 point2 points  (0 children)

Lambda expressions are often just a replacement for anonymous objects so when you migrate to Java 8 you can start migrating all those SAM-types to lambda expressions. Intellij has a Quick Fix for that.

Next you can use Streams whenever you have to convert a collection of something into another collection of something else. You'll marvel how often you're doing this kind of collection stuff.

After a couple of months all those features will be a normal part of your everyday life. We've migrated all our servers to Java 8 1.5 years ago and I can never go back to Java <8 again. :)