iteration

Refactoring - In Practice

Episode Summary

In this episode we dive deep into some specific refactors from Refactoring 's Chapter 1. We talk about renaming things, extracting functions, functions, replacing a temp with query and some other hot tips and tricks you can put into your code today.

Episode Notes

In this episode we dive deep into some specific refactors from Refactoring 's Chapter 1. We talk about renaming things, extracting functions, functions, replacing a temp with query and some other hot tips and tricks you can put into your code today.

This episode walks through specific code examples from Chapter 1 of Martin Fowler's Refactoring...

Some of the refactors

Change Function Declaration

Extract Function

Replace temp w/ query

Instead of:

accounts = get_accounts(user)
transactions = get_transactions(accounts)

we can just do:

transactions = get_transactions(get_accounts(user))

Replace conditional with polymorphism

Notification.deliver! example

Picks