E-Book, Englisch, 465 Seiten
Sciore Java Program Design
1. ed
ISBN: 978-1-4842-4143-1
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark
Principles, Polymorphism, and Patterns
E-Book, Englisch, 465 Seiten
ISBN: 978-1-4842-4143-1
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark
Get a grounding in polymorphism and other fundamental aspects of object-oriented program design and implementation, and learn a subset of design patterns that any practicing Java professional simply must know in today's job climate.
Java Program Design presents program design principles to help practicing programmers up their game and remain relevant in the face of changing trends and an evolving language. The book enhances the traditional design patterns with Java's new functional programming features, such as functional interfaces and lambda expressions. The result is a fresh treatment of design patterns that expands their power and applicability, and reflects current best practice.
The book examines some well-designed classes from the Java class library, using them to illustrate the various object-oriented principles and patterns under discussion. Not only does this approach provide good, practical examples, but you will learn useful library classes you might not otherwise know about.
The design of a simplified banking program is introduced in chapter 1 in a non-object-oriented incarnation and the example is carried through all chapters. You can see the object orientation develop as various design principles are progressively applied throughout the book to produce a refined, fully object-oriented version of the program in the final chapter.
What You'll Learn
Create well-designed programs, and identify and improve poorly-designed ones
Build a professional-level understanding of polymorphism and its use in Java interfaces and class hierarchies
Apply classic design patterns to Java programming problems while respecting the modern features of the Java language
Take advantage of classes from the Java library to facilitate the implementation of design patterns in your programs
Who This Book Is For
Java programmers who are comfortable writing non-object-oriented code and want a guided immersion into the world of object-oriented Java, and intermediate programmers interested in strengthening their foundational knowledge and taking their object-oriented skills to the next level. Even advanced programmers will discover interesting examples and insights in each chapter.
?Edward Sciore is Associate Professor in the computer science department at Boston College. He has been teaching college students for over 30 years. His research specialty is database systems, and he thoroughly enjoys teaching the wonders of database technology to captive students. Edward is author of Understanding Oracle APEX 5 Application Development (Apress).
Autoren/Hrsg.
Weitere Infos & Material
1;Table of Contents;4
2;About the Author;10
3;About the Technical Reviewer;11
4;Acknowledgments;12
5;Introduction;13
6;Chapter 1: Modular Software Design;16
6.1;Designing for Change;16
6.2;Object-Oriented Basics;19
6.2.1;APIs and Dependencies;19
6.2.2;Modularity;20
6.2.3;Class Diagrams;21
6.2.4;Static vs. Nonstatic;23
6.3;A Banking Demo;24
6.4;The Single Responsibility Rule;28
6.5;Refactoring;34
6.6;Unit Testing;35
6.7;Class Design;38
6.8;Encapsulation;44
6.9;Redistributing Responsibility;46
6.10;Dependency Injection;51
6.11;Mediation;55
6.12;Design Tradeoffs;56
6.13;The Design of Java Maps;58
6.14;Summary;60
7;Chapter 2: Polymorphism;62
7.1;The Need for Polymorphism;62
7.2;Interfaces;65
7.3;Reference Types;69
7.4;Type Safety;73
7.5;Type Casting;74
7.6;Transparency;76
7.7;The Open-Closed Rule;78
7.8;The Comparable Interface;79
7.9;Subtypes;82
7.10;The Java Collection Library;85
7.10.1;ArrayList;88
7.10.2;LinkedList;88
7.10.3;HashSet;88
7.10.4;TreeSet;88
7.11;The Liskov Substitution Principle;88
7.11.1;Should SortedSet Extend List?;90
7.11.2;Why Isn’t There an Interface SortedList?;90
7.11.3;Should Queue Extend List? Should List Extend Queue?;91
7.11.4;Why Have the Interface Set if It Doesn’t Provide any Added Functionality?;91
7.12;The Rule of Abstraction;92
7.13;Adding Code to an Interface;95
7.14;Summary;99
8;Chapter 3: Class Hierarchies;101
8.1;Subclasses;101
8.2;Abstract Classes;107
8.3;Writing Java Collection Classes;117
8.4;Byte Streams;119
8.5;The Template Pattern;132
8.6;Summary;140
9;Chapter 4: Strategies;141
9.1;The Strategy Pattern;141
9.2;Comparators;150
9.3;Anonymous Inner Classes;154
9.3.1;Explicit Anonymous Classes;154
9.3.2;Lambda Expressions;155
9.4;The Strategy Pattern as a Design Tool;158
9.5;The Command Pattern;164
9.6;Eliminating the Class Hierarchy;170
9.7;Templates vs. Strategies;174
9.8;Summary;176
10;Chapter 5: Encapsulating Object Creation;177
10.1;Object Caching;177
10.2;Singleton Classes;183
10.3;Singleton Strategy Classes;186
10.4;Static Factory Methods;194
10.5;Factory Objects;199
10.6;Cached Factory Objects;202
10.7;The Factory Pattern;206
10.8;Factories for Customized Objects;209
10.9;Summary;212
11;Chapter 6: Iterables and Iteration;214
11.1;Iterators;214
11.2;Writing an Iterator Class;218
11.3;The Iterator Pattern;223
11.4;Designing Iterable Classes;225
11.5;External Iteration;227
11.6;Internal Iteration;230
11.7;The Visitor Pattern;232
11.8;Predicates;236
11.9;Collection Streams;240
11.10;Summary;246
12;Chapter 7: Adapters;249
12.1;Inheritance for Reuse;249
12.2;Wrappers;251
12.3;The Adapter Pattern;252
12.4;Text Streams;256
12.4.1;The Adapter OutputStreamWriter;258
12.4.2;The Adapter InputStreamReader;262
12.4.3;The Adapter StringReader;266
12.5;Object Streams;267
12.6;Saving State in the Banking Demo;272
12.7;Adapters for the Banking Demo;275
12.8;Summary;281
13;Chapter 8: Decorators;283
13.1;Decorator Classes;283
13.2;The Decorator Pattern;289
13.3;The Chain of Command Pattern;295
13.4;Decorated Iterators;300
13.5;Implementing Collection Streams;306
13.6;Decorated Input Streams;310
13.6.1;Buffered Input Streams;311
13.6.2;Progress Monitoring;314
13.6.3;Cipher Input Streams;316
13.7;Decorator Transparency;318
13.8;Summary;324
14;Chapter 9: Composites;326
14.1;Predicates as Composites;326
14.2;Composite Objects in JavaFX;334
14.3;The Composite Pattern;344
14.4;A Cookbook Example;347
14.5;Traversing a Composite Object;352
14.6;Summary;361
15;Chapter 10: Observers;363
15.1;Observers and Observables;363
15.2;The Observer Pattern;368
15.2.1;Push vs. pull;369
15.2.2;Managing the Observer List;371
15.3;The Generic Observer Pattern in Java;375
15.4;Events;379
15.5;Observers in JavaFX;384
15.6;JavaFX Properties;389
15.6.1;Properties as Wrappers;389
15.6.2;Properties as Observables;391
15.7;JavaFX Bindings;394
15.8;Summary;398
16;Chapter 11: Model, View, and Controller;399
16.1;The MVC Design Rule;400
16.2;Multiple Views for a Model;407
16.3;MVC in Excel;413
16.4;JavaFX Views and Controllers;415
16.5;Extending the MVC Architecture;421
16.6;The MVC Pattern;427
16.7;MVC and the Banking Demo;432
16.7.1;The Class FxBankProgram;434
16.7.2;The Create Account View;436
16.7.3;The Account Information View;438
16.7.4;The All Accounts View;442
16.8;Observable List Views;445
16.9;Observable Table Views;448
16.10;Summary;451
17;Index;454




