Skip to main content

Instructor-led training

Java Best Practices and Design Patterns Training in Mountain Home, Arkansas

Java programmers with experience with databases and with object-oriented programming techniques, will learn to create more complex and advanced programs using Java SE 7.

What you'll learn

Java programmers with experience with databases and with object-oriented programming techniques, will learn to create more complex and advanced programs using Java SE 7.

Private Training for Teams

This course is offered as private, instructor-led training for organizations, onsite in Mountain Home, Arkansas or live online. Dates, delivery format, and course content are arranged around your team's requirements.

This course is not currently scheduled as a public class for individual enrollment.

Request Group Training

Prerequisites

Students should be skilled and experienced in using Java. They should have knowledge of database structures and terminology. Also, they should be familiar with object-oriented programming

Course Outline

Upon successful completion of this course, students will be able to:
 
Create and manage custom classes.
Control program flow by writing code to respond to specific criteria.
Implement object-oriented programming techniques to create reusable and reliable programs.
Work with Java utility class libraries.
Use the capabilities of the Java I/O package to read and write data to external files or media.
Use collection APIs in Java to manage data.
Use generics to enforce compile-time type checking.
Use multi-threaded programs to help handle multiple tasks concurrently.
Manage Java applications for memory efficiency and create distributable versions of a Java application.
 
 
 
Effective Programming in Java
• Clarifying the goals of best practices
• Identifying the key characteristics of high-quality software
• Organizing classes, packages and subsystems into layers
• Designing to the principles of SOLID
 
Applying Test-Driven Development
 
Exploiting a testing framework
• Composing and maintaining JUnit tests
• Taking advantage of advanced JUnit features
• Testing in the presence of exceptions
 
Monitoring software health using logging libraries
• Configuring logging with log4j and SLF4J
• Minimizing the impact of logging on performance
 
Creating matchers and mock objects
• Writing custom Hamcrest matchers
• Testing with fake objects and mocks
 
Leveraging Design Patterns
 
Employing common design patterns
• Observer
• Iterator
• Template method
• Strategy
• State
• Singleton
• Data Accessor Object
• Data Transfer Object
• Composite
• ServiceLocator
• Proxy
• Factory
 
Refactoring legacy code
• Identifying reasons to change software
• Clarifying the mechanics of change
• Writing tests for legacy classes and methods
 
Extending Applications with Java Meta Programming
 
Improving type safety with generics and enum types
• Creating generic classes and methods
• Navigating generic class hierarchies
• Implementing enum types for fixed sets of constants
 
Adding metadata by writing annotations
• Leveraging the built-in and custom annotations
• Annotating with meta-annotations
 
Modifying runtime behavior with reflection
• Retrieving class and method data dynamically
• Flagging methods with naming conventions
• Adding information to code with annotations
• Assessing disadvantages of reflection
 
Tuning for Maximum Performance
 
Measuring and improving performance
• Assessing response time
• Conducting load and stress tests
• Specifying strategies for improving performance
 
Exploiting garbage collectors
• Exploring garbage collection metrics
• Choosing appropriate algorithms for garbage collection
• Avoiding the hazards of finalizers
• Preventing memory leaks with reference types
 
Taking full advantage of threads
• Writing reliable thread-safe code
• Avoiding race hazards and deadlocks
• Employing the Executors framework
 
Bulletproofing a threaded application
• Synchronizing and sharing data between threads
• Managing the performance implications of synchronization
 
Exploring alternatives to synchronization
• Taking advantage of the volatile modifier
• Eliminating data sharing with ThreadLocal variables
 
Architecting for Separation of Concerns
 
Allocating responsibilities to components
• Translating method calls with the adaptor pattern
• Adding behavior with a proxy
 
Centralizing the creation of objects
• Employing factories to achieve loose coupling
• Implementing Inversion of Control (IoC)
 
 

What makes this material hard to master

The syllabus is less a language tour than a set of design decisions, each with trade-offs. Four areas cause most of the difficulty.

  • Patterns are easy to name and hard to apply. The course covers Observer, Iterator, Template method, Strategy, State, Singleton, Data Accessor Object, Data Transfer Object, Composite, ServiceLocator, Proxy and Factory. A common misconception is that using more patterns means better design. Choosing between look-alikes, such as Strategy and State or Proxy and the adaptor pattern, is the real skill. So is recognizing when a pattern adds only indirection. The SOLID principles in the first module are the yardstick for those choices.
  • Testing code that resists testing. JUnit, custom Hamcrest matchers, fake objects and mocks come first. Legacy refactoring follows, where you write tests for existing classes and methods before changing them. The order matters: the refactoring work depends on the testing skills.
  • Metaprogramming trades compile-time safety for flexibility. Generics and enum types improve type safety. Annotations and reflection then move behavior to runtime. The syllabus also asks you to assess the disadvantages of reflection, which is a useful counterweight.
  • Concurrency and memory. Race hazards, deadlocks, synchronization costs, volatile, ThreadLocal and the Executors framework are covered together with garbage collection metrics, collector choice, finalizer hazards and leaks. Code that passes tests can still fail under load, which is why the course pairs these topics with load and stress testing.

The final module ties the pieces together: factories for loose coupling and Inversion of Control, with proxies and adaptors allocating responsibilities between components.

Who it suits and where it fits

This course is for working Java developers who are comfortable with object-oriented programming and database terminology. The prerequisites call for skilled, experienced Java users, so it is not a first Java course. It is aimed at teams that want shared design and testing practices, and at developers who maintain existing code and need ways to change it safely.

The course uses Java SE 7, which is out of support according to the Oracle lifecycle information HSG tracks. It therefore suits organizations that build, maintain or migrate systems on that version or earlier. Teams on a newer release can ask about private training tailored to the versions they use through a training proposal request.

The wider Java Programming courses and learning guide shows other paths.

Illustrative scenarios

The scenarios below are illustrations of how the course material can be applied. They are not descriptions of specific organizations or of the course's lab exercises.

  • Taking over an untested module. A team inherits a legacy Java 7 service with no tests. Following the refactoring topics, they identify reasons to change it, write tests around existing classes and methods, and then restructure. They can use Strategy or Template method to remove duplicated branching, with JUnit and mocks guarding behavior.
  • Intermittent slowdowns under load. A team might see response times degrade only at peak traffic. The performance topics apply here: measure response time, run load and stress tests, read garbage collection metrics, and check for finalizer or reference-related leaks. They would then look for contention, using Executors, volatile or ThreadLocal in place of heavy synchronization where it is safe.
  • Decoupling data access. A team separating persistence from business logic might use the Data Accessor Object and Data Transfer Object patterns. Factories and Inversion of Control would let components be swapped for fakes in tests, and logging through SLF4J would be configured so it does not cost performance.

AI coding assistants for these topics

Where they help. AI coding assistants can draft JUnit tests, suggest Hamcrest matchers, sketch mock setups and propose refactorings. They are also useful for explaining an unfamiliar pattern implementation or generating boilerplate such as a Factory or a DTO.

Where they fail.

  • Concurrency. Suggested code may look correct but contain race conditions, misuse volatile as a substitute for atomicity, or hold locks too long. Singleton implementations are a frequent trouble spot.
  • Version mismatch. Output often uses language features and APIs newer than Java SE 7, and logging configuration can differ between library versions. Check everything against the Java version and libraries the project actually uses.
  • Generics and reflection. Generated code can compile with unchecked warnings or rely on reflection where a type-safe design would be better.
  • Tests that prove little. A generated test may assert whatever the code currently does, including its bugs, and over-mock so that nothing real is exercised.

How to verify. Review every suggestion against the design principles and pattern intent covered in the course. Run the tests before and after any refactoring. Confirm performance claims with load tests and garbage collection metrics, not assumption. Have a person review all threaded code. Also check generated code for security issues such as injection and insecure deserialization.

Frequently asked questions

What level is this course?

It is a general-level, four-day course for experienced Java developers. It assumes solid Java skills, familiarity with object-oriented programming and knowledge of database structures and terminology.

Which Java version does it use?

The course is built on Java SE 7. Java SE 7 and earlier are out of support, so the course suits organizations maintaining or migrating systems on those versions. Private training can be tailored to the versions an organization uses.

What does the course cover?

The syllabus covers SOLID design, test-driven development with JUnit, logging, Hamcrest matchers and mocks, common design patterns, and refactoring legacy code. It also covers generics, enums, annotations and reflection, then performance tuning, garbage collection and threading. It ends with separation of concerns using factories and Inversion of Control.

Can it be delivered privately for our team, onsite or online?

Yes. HSG delivers private training for organizations at the client's location or live online. You can start with a training proposal request.

Can the content be customized?

Private courses can be customized, including tailoring to the technology versions your team uses. Describe your codebase and goals in a training proposal request.

Training locations

Java Best Practices and Design Patterns training across the U.S. and beyond.

We provide private Java Best Practices and Design Patterns training for organizations, onsite at your location or live online, throughout the United States and internationally.

View all Java Best Practices and Design Patterns training locations

Train your team with HSG

Private, instructor-led training customized for your organization.

  • Onsite or live online delivery
  • Customized curriculum
  • For a single employee or an entire team
  • Flexible scheduling
  • Experienced instructors
Request Group Training

Questions? Call us at 303.377.6176
or email info@hartmannsoftware.com

Ready to train your team?

Let's customize this training for your organization.

Tell us about your employees, your goals, and your preferred schedule. We'll prepare a training proposal covering scope, delivery format, and pricing.