Professional Java EE Design Patterns
eBook - ePub

Professional Java EE Design Patterns

Murat Yener, Alex Theedom

Buch teilen
  1. English
  2. ePUB (handyfreundlich)
  3. Über iOS und Android verfügbar
eBook - ePub

Professional Java EE Design Patterns

Murat Yener, Alex Theedom

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Über dieses Buch

Master Java EE design pattern implementation to improve your design skills and your application's architecture

Professional Java EE Design Patterns is the perfect companion for anyone who wants to work more effectively with Java EE, and the only resource that covers both the theory and application of design patterns in solving real-world problems. The authors guide readers through both the fundamental and advanced features of Java EE 7, presenting patterns throughout, and demonstrating how they are used in day-to-day problem solving.

As the most popular programming language in community-driven enterprise software, Java EE provides an API and runtime environment that is a superset of Java SE. Written for the junior and experienced Java EE developer seeking to improve design quality and effectiveness, the book covers areas including:

  • Implementation and problem-solving with design patterns
  • Connection between existing Java SE design patterns and new Java EE concepts
  • Harnessing the power of Java EE in design patterns
  • Individually-based focus that fully explores each pattern
  • Colorful war-stories showing how patterns were used in the field to solve real-life problems

Unlike most Java EE books that simply offer descriptions or recipes, this book drives home the implementation of the pattern to real problems to ensure that the reader learns how the patterns should be used and to be aware oftheir pitfalls.

For the programmer looking for a comprehensive guide that is actually useful in the everyday workflow, Professional Java EE Design Patterns is the definitive resource on the market.

Häufig gestellte Fragen

Wie kann ich mein Abo kündigen?
Gehe einfach zum Kontobereich in den Einstellungen und klicke auf „Abo kündigen“ – ganz einfach. Nachdem du gekündigt hast, bleibt deine Mitgliedschaft für den verbleibenden Abozeitraum, den du bereits bezahlt hast, aktiv. Mehr Informationen hier.
(Wie) Kann ich Bücher herunterladen?
Derzeit stehen all unsere auf Mobilgeräte reagierenden ePub-Bücher zum Download über die App zur Verfügung. Die meisten unserer PDFs stehen ebenfalls zum Download bereit; wir arbeiten daran, auch die übrigen PDFs zum Download anzubieten, bei denen dies aktuell noch nicht möglich ist. Weitere Informationen hier.
Welcher Unterschied besteht bei den Preisen zwischen den Aboplänen?
Mit beiden Aboplänen erhältst du vollen Zugang zur Bibliothek und allen Funktionen von Perlego. Die einzigen Unterschiede bestehen im Preis und dem Abozeitraum: Mit dem Jahresabo sparst du auf 12 Monate gerechnet im Vergleich zum Monatsabo rund 30 %.
Was ist Perlego?
Wir sind ein Online-Abodienst für Lehrbücher, bei dem du für weniger als den Preis eines einzelnen Buches pro Monat Zugang zu einer ganzen Online-Bibliothek erhältst. Mit über 1 Million Büchern zu über 1.000 verschiedenen Themen haben wir bestimmt alles, was du brauchst! Weitere Informationen hier.
Unterstützt Perlego Text-zu-Sprache?
Achte auf das Symbol zum Vorlesen in deinem nächsten Buch, um zu sehen, ob du es dir auch anhören kannst. Bei diesem Tool wird dir Text laut vorgelesen, wobei der Text beim Vorlesen auch grafisch hervorgehoben wird. Du kannst das Vorlesen jederzeit anhalten, beschleunigen und verlangsamen. Weitere Informationen hier.
Ist Professional Java EE Design Patterns als Online-PDF/ePub verfügbar?
Ja, du hast Zugang zu Professional Java EE Design Patterns von Murat Yener, Alex Theedom im PDF- und/oder ePub-Format sowie zu anderen beliebten Büchern aus Informatica & Programmazione orientata agli oggetti. Aus unserem Katalog stehen dir über 1 Million Bücher zur Verfügung.

Information

Verlag
Wrox
Jahr
2014
ISBN
9781118843451

PART I
Introduction to Java EE Design Patterns

  • CHAPTER 1 : A Brief Overview of Design Patterns
  • CHAPTER 2 : The Basics of Java EE

1
A Brief Overview of Design Patterns

WHAT’S IN THIS CHAPTER?
  • An overview of design patterns
  • A short history about design patterns and why they are important
  • The use of design patterns in the real world
  • The history and evolution of Java Enterprise Edition
  • The emergence of enterprise patterns
  • How these design patterns have evolved in the enterprise environment
  • Why and how patterns become anti-patterns
This book is aimed at bridging the gap between the traditional implementation of design patterns in the Java SE environment and their implementation in Java EE.
If you are new to design patterns, this book will help you get up to speed quickly as each chapter introduces the design pattern in a simple-to-understand way with plenty of working code examples.
If you are already familiar with design patterns and their implementation but are not familiar with their implementation in the Java EE environment, this book is perfect for you. Each chapter bridges the gap between the traditional implementation and the new, often easier, implementation in Java EE.
If you are an expert in Java, this book will act as a solid reference to Java EE and Java SE implementations of the most common design patterns.
This book focuses on the most common Java EE design patterns and demonstrates how they are implemented in the Java EE universe. Each chapter introduces a different pattern by explaining its purpose and discussing its use. Then it demonstrates how the pattern is implemented in Java SE and gives a detailed description of how it works. From there, the book demonstrates how the pattern is now implemented in Java EE and discusses its most common usage, its benefits, and its pitfalls. All explanations are accompanied by detailed code examples, all of which can be downloaded from the website accompanying this book. At the end of each chapter, you’ll find a final discussion and summary that rounds up all you have read in the chapter. There are even some interesting and sometimes challenging exercises for you to do that will test your understanding of the patterns covered in the chapter.

WHAT IS A DESIGN PATTERN?

Design patterns are “descriptions of communicating objects and classes that are customized to solve a general design problem in a particular context.”
—GANG OF FOUR
Design patterns offer solutions to common application design problems. In object-oriented programming, design patterns are normally targeted at solving the problems associated with object creation and interaction, rather than the large-scale problems faced by the overall software architecture. They provide generalized solutions in the form of boilerplates that can be applied to real-life problems.
Usually design patterns are visualized using a class diagram, showing the behaviors and relations between classes. A typical class diagram looks like Figure 1.1.
images
Figure 1.1 A class diagram showing inheritance
Figure 1.1 shows the inheritance relationship between three classes. The subclasses CheckingAccount and SavingsAccount inherit from their abstract parent class BankAccount.
Such a diagram is followed by an implementation in Java showing the simplest implementation. An example of the singleton pattern, which will be described in later chapters, is shown in Figure 1.2.
images
Figure 1.2 The singleton pattern class diagram
And here is an example of its simplest implementation.
public enum MySingletonEnum { INSTANCE; public void doSomethingInteresting(){} }

How Patterns Were Discovered and Why We Need Them

Design patterns have been a hot topic since the famous Gang of Four (GoF, made up of Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides) wrote the book Design Patterns: Elements of Reusable Object-Oriented Software,1 finally giving developers around the world tried and tested solutions to the commonest software engineering problems. This important book describes various development techniques and their pitfalls and provides 23 object-oriented programming design patterns. These patterns are divided into three categories: creational, structural, and behavioral.
But why? Why did we suddenly realize we needed design patterns so much?
The decision was not that sudden. Object-oriented programming emerged in the 1980s, and several languages that built on this new idea shortly followed. Smalltalk, C++, and Objective C are some of the few languages that are still prevalent today. They have brought their own problems, though, and unlike the development of procedural programming, this time the shift was too fast to see what was working and what was not.
Although design patterns have solved many issues (such as spaghetti code) that software engineers have with procedural programming languages like C and COBOL, object-oriented languages have introduced their own set of issues. C++ has advanced quickly, and because of its complexity, it has driven many developers into fields of bugs such as memory leaks, poor object design, unsafe use of memory, and unmaintainable legacy code.
However, most of the problems developers have experienced have followed the same patterns, and it’s not beyond reason to suggest that someone somewhere has already solved the issues. Back when object-oriented programming emerged, it was still a pre-Internet world, and it was hard to share experiences with the masses. That’s why it took a while until the GoF formed a collection of patterns to well-known recurring problems.

Patterns in the Real World

Design patterns are infinitely useful and proven solutions to problems you will inevitably face. Not only do they impart years of collective knowledge and experience, design patterns offer a good vocabulary between developers and shine a light on many problems.
However, design patterns are not a magic wand; they do not offer an out-of-the-box implementation like a framework or a tool set. Unnecessary use of design patterns, just because they sound cool or you want to impress your boss, can result in a sophisticated and overly engineered system that doesn’t solve any problems but instead introduces bugs, inefficient design, low performance, and maintenance issues. Most patterns can solve problems in design, provide reliable solutions to known problems, and allow developers to communicate in a common idiom across languages. Patterns really should only be used when problems are likely to occur.
Design patterns were originally classified into three groups:
  • Creational patterns—Patterns that control object creation, initialization, and class selection. Singleton (Chapter 4, “Singleton Pattern”) and factory (Chapter 6, “Factory Pattern”) are examples from this group.
  • Behavioral patterns—Patterns that control communication, messaging, and interaction between objects. The observer (Chapter 11, “Observer Pattern”) is an exampl...

Inhaltsverzeichnis