Subremes Codes

Java Magazine: Design Pattern

By Andrew Binstock, Editor in Chief, Java Magazine

When design patterns first appeared in programming via the famous “Gang
of Four” book, they represented a breakthrough on two levels. The first was that they provided a prescription for implementing solutions to basic programming problems. In this sense, they defined best practices. They also provided terminology for describing certain solutions: decorators, factories, and singletons, among others.

In time, the term “patterns” expanded to cover more than the original 23 instances in that seminal book. It came to refer to best practices for solving a common problem. As a result, the use of patterns proliferated, and they now touch every aspect of computing.

In this issue, we launch a series of articles that dig deeply into the most important Gang of Four patterns. Here we start with the Command pattern (page 15) and look at multiple ways to implement it, including across disparate systems. We then look at patterns for using Hibernate and JPA (page 27) and explore the producer-consumer pattern (page 38) as a way to handle large sets of data points in JavaFX. Finally, we examine (page 50) how to map domain-driven design (DDD) entities to Java EE.

Separate from patterns, we look at the use of the var keyword (page 63) introduced in Java 10. And we continue our deep dive into the inner workings of the JVM (page 74) by examining how the Java compiler and the JVM remove unneeded locks from threads—and how this explains why performance between StringBuffer and StringBuilder varies so much.

Статья полностью:Java Magazine: Design Pattern