Java Reference
In-Depth Information
Chapter 8. Design and Architectural
Principles
The critical design tool for software development is a mind well educated in design principles. It
is not…technology.
— Craig Larman
I've already established that lambda expressions are a fairly simple change to the Java lan-
guage and that there are a bunch of ways that we can use them within the standard JDK lib-
raries. Most Java code isn't written by the core JDK developers—it's written by people like
you. In order to use lambda expressions in the most beneficial way possible, you need to start
introducing them into your existing code base. They are just another tool in the belt of a pro-
fessional Java developer, no different from an interface or a class.
In this chapter, we're going to explore how to use to use lambda expressions to implement
the SOLID principles that provide guidelines toward good object-oriented programming.
There are also many existing design patterns that can be improved by the use of lambda ex-
pressions, and we'll take a look at a smattering of those.
When coding with teammates at work, I'm sure you've come across a situation where you've
implemented some feature or fixed a bug, and you were pretty happy with the way that you
had done it, but soon after someone else took a look at the same code—perhaps during a
code review—and they weren't so happy with it! It's pretty common to have this kind of dis-
agreement over what really constitutes good code or bad code.
Most of the time when people are disagreeing, they are pushing a matter of opinion. The re-
viewer would have done it another way. It's not necessarily that he is right or wrong, or that
you are right or wrong. When you welcome lambdas into your life, there's another topic to
think about. It's not that they are a difficult feature or a big point of contention as much as
they are just another design issue that people can discuss or disagree on.
This chapter is here to help! I'll try to put forth some well-grounded principles and patterns
upon which you can compose maintainable and reliable software—not just to use the shiny
new JDK libraries, but to use lambda expressions in your own domain architecture and ap-
plications.
Search WWH ::




Custom Search