Rapid Refactoring of Old Java Code with Dr. Heinz Kabutz – GOTO Academy NL
Rapid Refactoring of Old Java Code with Dr. Heinz Kabutz

GOTO Academy NL

Rapid Refactoring of Old Java Code with Dr. Heinz Kabutz


Contact Us for Pricing

Do you have any questions?



1. Welcome To The Age Of Monolithic Legacy

    1.1 Welcome
    1.2 Introduction to Refactoring and Unit Testing
    1.3 Setting Up IntelliJ 
    1.4 Building the OFBiz Project
    1.5 Analyzing Code for Refactoring in IDEA

2. Cleaning Up Some Pre-Java 5 Dinosaur Code

    2.1 Refactoring to Java 5
    2.2 Getting Rid of Unnecessary Boxing/Unboxing
    2.3 Changing StringBuffer to StringBuilder
    2.4 String.contains() instead of indexOf()
    2.5 Replace 'for' Loop With Java 5 for-in
    2.6 Replace 'while' Loop With Java 5 for-in

3. Moving to Java 7, Our Code is Entering the Age of Mammals

    3.1 More Java 5 Refactorings
    3.2 Java 7 Refactorings, Diamond Operator
    3.3 Java 7 Collapsing try-catch Blocks
    3.4 Java 7 Refactoring to try-with-resource

4. Fire is Discovered in Lambdas and Method References in Java 8

    4.1 Java 8 Static Methods in Interfaces
    4.2 Java 8 Default Methods in Interfaces
    4.3 How Functional Interfaces Work
    4.4 The Four Types of Method References
    4.5 Refactoring to Iterable.forEach()
    4.6 Refactoring to use Collection.removeIf()

5. Java 8 Streams, We Are Moving Towards the Stone Age

    5.1 Introduction to Java 8 Streams
    5.2 Stream map(), filter(), collect()
    5.3 Refactoring to Lambdas and Method References
    5.4 Comparators in Java 8
    5.5 Arrays.setAll()
    5.6 Single Map Methods getOrDefault(), merge(), putIfAbsent()

6. Refactoring Our Code to use map()/collect() in the Bronze Age

    6.1 Refactoring ContainerConfig.getContainerPropsFromXML()
    6.2 collect() in UtilCache.values()
    6.3 map()/collect() in UtilDateTime.getTimeZones()
    6.4 map()/collect() in EntityJoinOperator.freeze()
    6.5 Collection.forEach() in EntityJoinOperator.visit()
    6.6 map()/filter()/collect() in EntitytFinderUtil.createCondition()
    6.7 map()/filter()/collect() in EntityDataLoader.getUrlByComponentList()
    6.8 map()/collect() in DelegatorContainer.start()
    6.9 map()/sum() in OagisShipmentServices.oagisReceiveShowShipment()
    6.10 Arrays.setAll() in ShoppingListEvents.markCartItemsArray()

7. Matching and Finding in Streams, Our Code is Nearing the Iron Age

    7.1 Stream all/any/noneMatch()
    7.2 anyMatch() in MapContext.containsKey()
    7.3 allMatch() in FileUtil
    7.4 allMatch() in EntityJoinOperator.isEmpty()
    7.5 anyMatch() in ModelEntity.getHasFieldWithAuditLog()
    7.6 allMatch() in ModelEntity.areFields()
    7.7 collect() in ModelEntity.getFieldNamesFromFieldVector()
    7.8 anyMatch() in ProductPromoWOrker.hasOrderTotalCondition()
    7.9 Stream.findFirst/Any
    7.10 findFirst() in MapContext.get()
    7.11 Creating Stream from Spliterator in findFirst() in UtilObject.getObjectFromFactory()
    7.12 findFirst() in ModelRelation
    7.13 findFirst() in ShoppingCartItem
    7.14 findFirst() in LoadSale.selectedSale()
    7.15 Optional in OrderReadHelper.getShippableSizes()

8. We Enter the Information Age (But a Monolithic One)

    8.1 distinct() in PaymentGatewayServices.capturePaymentsByInvoice()
    8.2 filter()/collect() in ContainerConfig.getPropertiesWithValue()
    8.3 map()/sum() in UtilCache.getSizeInBytes()
    8.4 Deep Refactoring in UtilMisc.LocaleHolder.getAvailableLocaleList()
    8.5 filter()/map()/collect() in ModelGroupReader.getEntityNamesByGroup()
    8.6 map()/reduce() in InvoiceServices.updatePaymentApplicationDefBd()
    8.7 Collectors.groupingBy() in ModelReader.rebuildResourceHandlerEntities()
    8.8 groupingBy()/Checked Exception with ModelReader.getEntitiesByPackage()
    8.9 Creating Own Spliterator for NodeELResolver.getValue()

9. Java 9, 10, 11, ...

    9.1 Getting OfBiz to compile with Java 9
    9.2 Diamond operator <> now also with anonymous inner classes
    9.3 When can we use the new var for local variables?
    9.4 Additional refactorings for Java 11 till TBC

10. Conclusion 

Dr. Heinz M. Kabutz 


Heinz is the mastermind behind The Java Specialists' Newsletter. He has a PhD in Computer Science. Heinz has programmed significant portions of several large Java applications and has taught Java to thousands of professional programmers. He is a regular speaker at all the major Java conferences.

Heinz was chosen as a Java Champion by Sun Microsystems, the inventors of Java, for his work in advancing Java.