Schweitzer Fachinformationen
Wenn es um professionelles Wissen geht, ist Schweitzer Fachinformationen wegweisend. Kunden aus Recht und Beratung sowie Unternehmen, öffentliche Verwaltungen und Bibliotheken erhalten komplette Lösungen zum Beschaffen, Verwalten und Nutzen von digitalen und gedruckten Medien.
A concise handbook for the most common tools used in modern Java development
Good Java developers learn Java syntax, how to create loops and switches, and can work out a lambda filter stream. But great Java developers need to understand the vast ecosystem of tools and frameworks for collaboration, testing, building, and more.
In Real-World Java®: Helping You Navigate the Java Ecosystem, a team of veteran Java developers delivers a concise and authoritative discussion of the most common frameworks, tools, and techniques used in enterprise Java development shops. The authors provide just enough background and examples to allow you to dive right into the expert guidance on annotations, logging frameworks, observability, performance tuning, testing tools, and collaboration, that real-life commercial Java development typically relies on.
You'll expand your Java development toolkit with frameworks and utilities like Spring, Git, Prometheus, and Project Lombok. You'll also discover links to tested, downloadable code examples that demonstrate the skills discussed in the book.
Real-World Java® is the perfect resource for everyone already somewhat comfortable with the language but who wants to familiarize themselves with the tools and frameworks used in contemporary Java software development.
VICTOR GRAZI is an Oracle Java Champion and a veteran Java engineer in the USA, and has built serious Java applications at some of the world's leading banks. He is a Pluralsight author, has served as infoQ Java lead editor, and serves on the Java community process executive committee. Victor is a frequent presenter at technical conferences and hosts the "Java Concurrent Animated" and "Bytecode Explorer" open-source projects.
JEANNE BOYARSKY is an Oracle Java Champion and has worked as a Java developer for a major bank for more than 20 years. She is a senior moderator at CodeRanch, and trains and mentors students of all levels, including the programming department of a FIRST robotics team.
You've learned Java, and you're ready to start using it at work. Or you are already using it in work, but you've discovered the daunting ecosystem that they never taught you in school. This book is for those who have already learned how to code in Java and are looking for the next step. Whether you are a student, career changer, or professional programmer switching languages, this is your opportunity to learn about the Java ecosystem.
This book is not intended to be a comprehensive guide to the Java ecosystem; that would require many thousand-page tomes. If you are just learning Java, we recommend Head First Java, 3rd Edition (O'Reilly Media, 2022) or Java For Dummies (For Dummies, 2025). Then come back to this book. The goal of this book is to expose the reader to some of the most common frameworks, tools, and techniques used in enterprise Java development shops, with enough background and examples to dive right in.
In this chapter, we will cover some information about Java in general before getting into specialized topics in the later chapters. While chapters can be read out of order, we recommend reading Chapters 1-4 before skipping around.
The source code for this chapter is available on the book page at www.wiley.com. Click the Downloads link. The code can also be found at https://github.com/realworldjava/Ch01-History. See the README.md file in that repository for details.
www.wiley.com
https://github.com/realworldjava/Ch01-History
README.md
Java was created by James Gosling at Sun Microsystems and released to the world in 1995.
As legend has it, Java started life as "Oak," a new language for building embedded software in smart devices. The idea was novel: instead of writing software for each embedded operating system, design a "write once, run anywhere," compiled, object-oriented language that produces bytecode, and design a bytecode interpreter for each platform that could execute it.
While they were at it, they would include built-in frameworks that were, in other languages, snap-on additions, such as concurrency or UI designers. Then cap it off with memory management in the form of garbage collection and optimize it using just-in-time (JIT) compiling, and voilà, they had everything needed for an embedded language platform.
But alas, it was soon discovered that there was already an "Oak" platform brewing. A long night in a coffee shop over some hot Java brew, and the rest is history.
Many years later, in 2009, Oracle acquired Sun, and ownership of Java transferred to Oracle. To this day, Oracle remains the steward, or caretaker, of Java.
The Java community's commitment to ensuring that Java is backward compatible and its robust series of thousands of Technology Compatibility Kit (TCK) tests that must pass for every feature provide the stability and dependability that have thrust Java into its place as one of the most successful programming languages in history.
Oracle recognizes its stewardship as a critical responsibility, given the sheer number of people and companies heavily using Java. The JCP (Java Community Process) has an Executive Committee (basically Java's board of directors) with many organizations as members to ensure the community is represented. Some past/future members are competitors with their own JDKs (Java Development Kits), for example, Amazon, Azul, and Microsoft. Others are complementary, notably Integrated Development Environment (IDE) providers like Eclipse and JetBrains. Others are simply strong proponents of Java like BellSoft and Fujitsu. Finally, there are community members like SouJava (Brazilian Java User Group) and Ken Fogel (individual member).
One of the changes introduced under Oracle's stewardship was a more frequent and predictable release schedule. Notice in Figure 1.1 that releases have varied in both frequency and month of release. In one case, Java users had to wait more than five years for a new version.
FIGURE 1.1: Java releases
With the new release cadence, a new version of Java comes out every six months. You may be thinking that many companies don't want to upgrade every six months, and you'd be right! There are also less frequent releases called Long-Term Support (LTS) releases. When the new release cycle started, LTS releases were every three years. They are now every two years.
Table 1.1 shows releases from the start of the new release cadence to the publishing of this book. As you can see, there are now regular, predictable releases. This book uses Java 21, which was the latest LTS at the time of printing.
Figure 1.2 shows the LTS release schedule. You can predict LTS dates into the future now that there is a pattern. This helps companies plan.
Many companies run their Java programs remotely, such as through a website. Until 2020, this was often done through Spring or Java EE (Enterprise Edition.) See Chapter 6, "Getting to Know the Spring Framework," and Chapter 14, "Getting to Know More of the Ecosystem," for more details. In 2020, Oracle handed over stewardship of Java EE to an open-source foundation. Since "Java" is a trademark, the Java EE framework was renamed to "Jakarta EE" at that point.
TABLE 1.1: Java Releases
FIGURE 1.2: LTS release schedule, with future predictions
The Java language has evolved quite a bit over time. By looking at key features added over time, you can get a feel for this evolution along with an expectation that the language will continue to improve. Additionally, you will know what to expect if your work project is not on the latest version.
Note that this section is not even close to a full list of features. We picked the most significant feature of each version covered.
You might be wondering why we aren't including type inference with the var keyword in this section. While both of this book's authors use var in some cases in our work code, we felt it would be clearer in this book to specify what the types are and ensure all imports are represented.
var
Before Java 5, the compiler had no way of knowing what you intended to put in a list. Java 5 introduced generics, which allow you to specify the type, in the case of the following example, a String:
String
1: import java.util.ArrayList;
2: import java.util.List;
3:
4: public class Java5Generics {
5:
6: private static List<String> createList() {
7: List<String> buildingNames = new ArrayList<String>();
8: buildingNames.add("Firehouse");
9: return buildingNames;
10: }
11:
12: public static void main(String[] args) {
13: List<String> buildingNames = createList();
14:
15: System.out.println(buildingNames); // [Firehouse]
16: }
17: }
Now that we've informed the compiler about our intent, it is our assistant. The compiler will produce an error if we attempt to add an Integer or LocalDate or anything else to buildingNames.
Integer
LocalDate
buildingNames
You might be wondering why the line 7 doesn't say new ArrayList<>() and instead uses a longer version. The diamond operator (<>) was added in Java 7, and this example is for Java 5. Even this shows the evolution of the language, though!
new ArrayList<>()
<>
Functional programming is a way of writing code more declaratively. You specify what you want to do rather than dealing with the state of objects. You focus more on expressions than loops.
Java 8 introduced lambdas and method references to facilitate writing code with deferred execution, also known as "code that runs later." Both let you easily pass executable code to a method. In the following code,...
Dateiformat: ePUBKopierschutz: Adobe-DRM (Digital Rights Management)
Systemvoraussetzungen:
Das Dateiformat ePUB ist sehr gut für Romane und Sachbücher geeignet – also für „fließenden” Text ohne komplexes Layout. Bei E-Readern oder Smartphones passt sich der Zeilen- und Seitenumbruch automatisch den kleinen Displays an. Mit Adobe-DRM wird hier ein „harter” Kopierschutz verwendet. Wenn die notwendigen Voraussetzungen nicht vorliegen, können Sie das E-Book leider nicht öffnen. Daher müssen Sie bereits vor dem Download Ihre Lese-Hardware vorbereiten.Bitte beachten Sie: Wir empfehlen Ihnen unbedingt nach Installation der Lese-Software diese mit Ihrer persönlichen Adobe-ID zu autorisieren!
Weitere Informationen finden Sie in unserer E-Book Hilfe.