July 2023
Intermediate to advanced
276 pages
6h 55m
English
Imperative style—that’s what Java has provided us with since its inception. In this style, we tell Java every step of what we want it to do and then we watch it faithfully exercise those steps. That’s worked fine, but it’s a bit low-level. The code tends to get verbose, and we often wish the language were a tad more intelligent; we could then tell it—declaratively—what we want rather than delve into how to do it. Thankfully, Java can help us do that. Let’s look at a few examples to see the benefits and the differences in style.
Let’s start on familiar ground to see the two paradigms in action. Here’s an imperative way to find if Chicago is in a collection of given cities—remember, the listings in this ...
Read now
Unlock full access