I will have to refactor ! And now ? Refactoring Techniques in Java
Is your Java code sending you signals? Learn to spot the 'code smells' that mean it's time to refactor.
#1about 2 minutes
What is refactoring and why is it important
Refactoring improves software design and makes code easier to understand without changing its external behavior.
#2about 6 minutes
Identifying the right moments to refactor code
Refactoring can be done preparatorily, for understanding, to remove dead code, as a long-term project, or ideally during code reviews.
#3about 2 minutes
Understanding the disadvantages of refactoring
While beneficial, refactoring can increase delivery time, cause merge conflicts, and require tests to be rewritten.
#4about 2 minutes
Recognizing common code smells in your codebase
Code smells like duplication, long methods, confusing names, and outdated comments indicate underlying problems that refactoring can fix.
#5about 3 minutes
Using extract function and extract variable techniques
Improve readability by grouping code into a new function or simplifying complex expressions by storing them in a descriptive variable.
#6about 3 minutes
Encapsulating variables and introducing parameter objects
Control data access by making variables private with getters/setters and simplify method signatures by grouping related parameters into a single object.
#7about 3 minutes
Breaking down complex methods with split phase
Decompose a method that performs multiple distinct tasks into separate, more focused methods to improve clarity and maintainability.
#8about 4 minutes
Simplifying class interactions and responsibilities
Refactor large classes by using extract class, remove unnecessary intermediaries with remove middle man, and move functions to more appropriate classes.
#9about 4 minutes
Cleaning up code with various refactoring techniques
Improve the codebase by removing unused code, changing value objects to references for shared identity, and decomposing complex conditional logic.
#10about 5 minutes
Improving object creation and class hierarchies
Replace simple constructors with flexible factory methods, move common methods to a superclass with pull up method, and simplify hierarchies by collapsing unnecessary layers.
#11about 2 minutes
Conclusion and key takeaways on refactoring
Refactoring techniques should be combined and used alongside principles like SOLID to solve specific problems and improve overall code quality.
#12about 6 minutes
Q&A: Prioritizing refactoring and specific techniques
The speaker answers questions on how to prioritize refactoring tasks, the benefits of the split phase technique, and when to use change value to reference.
Related jobs
Jobs that call for the skills explored in this talk.
Matching moments
02:06 MIN
Defining refactoring and refactorable code
Keep your code refactorable
02:14 MIN
Defining refactoring beyond the strict technical term
Product Managers' Eternal Battle with Refactoring
03:11 MIN
Why refactoring is the right frame for sustainability
The Environmental Impact of Software Development
01:40 MIN
Differentiating good and bad reasons for refactoring
Product Managers' Eternal Battle with Refactoring
06:50 MIN
Understanding the principles of safe automated refactoring
Let's build a VS Code extension for automated refactorings
01:57 MIN
Automating maintenance with dependency and refactoring tools
Open sourcing a library: how hard can that be?
03:22 MIN
Defining code smells and their importance in development
Identifying code smells
01:38 MIN
Exploring five common approaches to handling refactoring
WeAreDevelopers LIVE days are changing - get ready to take partStarting with this week's Web Dev Day edition of WeAreDevelopers LIVE Days, we changed the the way we run these online conferences. The main differences are:Shorter talks (half an hour tops)More interaction in Q&AA tips and tricks "Did you know" sect...
Daniel Cranney
The real reason we document our codeThe world of software development moves fast. Technology is constantly changing, as are the tools we use with it, and even the role of a programmer is itself constantly in flux. However, some aspects of software engineering are so foundational that w...