Legacy Coderetreat: Episode 9 – Extract Pure Functions – Code Cast

The book Facilitating Technical Events is for technical trainers, coaches, events organizers who want to have a good event flow and happy attendees.
Support independent publishing: Buy this e-book on Lulu.

Extract Pure Functions – code cast

Blog post series

This blog post is part of a series about legacy coderetreat and legacy code techniques you can apply during your work. Please click to see more sessions about legacy code.

Code Cast

This is a code cast in Java.

In the first episode we wrote some characterization tests with the purpose to create a basic safety net. Now we continue to refactor the code, starting from there. We already have some tests running and we want to have methods that do only one thing; we want to apply the Single Responsibility Principle. A really good tool that can help is using pure functions. We extract functions, make them static and then make sure the function does not have any side effects. These functions help me clean the code and help me start structurig the code according to clear responsibilities. At a later time we will extract all these functions that have similar responsibilities to a new class.

Read here more about this concept in my blog post.

 

Subscribe

If you want to receive an email when I write a new article, subscribe here:

Subscribe for new articles

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe for new articles