Course 440:
Refactoring and Maintaining Legacy Code

(4 days)


Course Description

This is an intermediate course for programmers who know the basics of Java. The course covers advanced techniques useful in enterprise development including the maintenance and improvement of already developed code. The course uses a Test-Driven Development (TDD) approach for exercises. Exercises show techniques and approaches needed in production ready code. The course is approximately 50% lecture and 50% hands-on work.

Learning Objectives

  • Learn strategies to maintain, change, and improve legacy code
  • Perform unit testing in various contexts
  • Manage changes to legacy code
  • Make changes without breaking existing code
  • Recognize inflection and pinch points
  • Break dependencies using design patterns
  • Recognize how to handle common scenarios

Who Should Attend

This is an intermediate level Java programming course, designed for developers who wish to learn what’s new in Java. The student should be an experienced Java programmer, with practical development experience in Java.


Practical development experience in Java.

Course Outline

Unit Testing Concepts and Patterns

  • Unit Testing with JUnit
  • Assertions
  • setUp and tearDown
  • Testing Exception Throwing
  • Measuring Test Coverage
  • Refactoring
  • Test Doubles
  • Testing Patterns
  • Functionality Testing
  • Testing Container-Managed Components
  • Mock Objects
  • Strategies for Testing Data-Driven Applications
  • Transactional Test Cases
  • DBUnit

Maintaining Legacy Code

  • Legacy Code
  • Test Coverings
  • Legacy Code Change Algorithm
  • Seams

Changing Legacy Code

  • Making Safe Changes
  • Reasoning about Effects
  • Finding Interception Points
  • Characterization Tests


  • Identifying Code Smells
  • Not Breaking Anything
  • Simplifying Code Structure
  • Organizing Data and Methods
  • Simplifying and Encapsulating Logic
  • Extracting Subclasses and Interfaces

Breaking Dependencies with Design Patterns

  • Adapter
  • Strategy
  • Command Design Pattern
  • Parameterize Constructors and Methods
  • Extract and over-ride
  • Non-OO Techniques to Break Dependencies

Strategies to Deal with Legacy Code

  • Hidden and Global Dependencies
  • Inaccessible Methods
  • Library Dependencies
  • Large Classes and Methods
  • Working Effectively with Legacy Code

Please Contact Your ROI Representative to Discuss Course Tailoring!