What Have You Learned?

As you’ve seen in this chapter, the functional style really makes for a different way to program Java. You can be so much more concise if you just describe what you want to achieve instead of instructing the computer step-by-step.

If coding the imperative way still feels more natural, remember that you just might be more familiar with this style. After all, this was the way you learned first. Keep in mind that the unfamiliar is not necessarily the more complex—you just need to get used to it. But you already know the basics.

You’re able to iterate over data structures more efficiently by converting them into streams, and you know how to get back into the imperative style even in complex situations. You also learned how to interleave the functional and the imperative style neatly with the help of method references when that’s most appropriate—for example, to improve the testability of your methods. Anonymous classes will no longer clutter up your code with irrelevant syntax because you can just replace them with lambda expressions. You’ve learned how you can make your program less fragile by using Optional return types instead of null values, and how you can integrate Optionals with streams.

But it’s not just about applying functional programming. You’ve also seen what can go wrong and where you should be extra careful. You’re aware that side effects can damage the correctness of your code, and the functional style doesn’t make for more readable code if there’s a lot of exception handling involved. And although Optional values are helpful, you know that they’re no good if you overuse them.

Believe it or not, this is the end of the core part of this book. We’re really happy that you’ve stuck with us this far. By now, you’ve certainly increased your knowledge about clean and readable Java code.

Of course, when you go into professional software development, there are many more aspects to consider. So far, we’ve hardly touched on concurrency, and there are important things you should know about how you get from just code to a shippable product, like continuous integration and delivery. We could continue with comparisons about those topics. But if we did, the book would be 500 pages long and no one would want to read it. Instead, we’ll give you a short outlook on several important aspects that we couldn’t cover adequately here. In addition to a concise summary of those concepts, the last chapter will provide you with references and links to reading material that will take you into more depth for these topics. Then you’ll know exactly how to continue after you’ve finished this book. Never stop learning!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.128.200.71