By Emmanuelle Delescolle

A tale of refactoring

Who am I?

What is refactoring?

Renaming a variable all over your code

Updating your code style

Rewriting a method/function/class to make it more maintainable

Rewriting a method/function/class to make make it easier to add a new feature

Rewrite almost everything

Why this talk?

for item in lst:
    if item.b:
        if item.a:
            if item.c and item.d:
                # do something
            elif not item.c:
                # do something else
            elif item.c and not item.d:
                # you're starting to get this
        else:
            # here too
    elif item.e:
        if item.a:
            if item.c and item.d:
                # do something
            elif not item.c:
                # do something else
            elif item.c and not item.d:
                # do something else
        else:
            # do something else
    elif item.f and not item.g:
        if item.a:
            if item.c and item.d:
                # do something
            elif not item.c:
                # do something else
            elif item.c and not item.d:
                # do something else
        else:
            # do something else
    elif item.g and not item.f:
        if item.a:
            if item.c and item.d:
                # do something
            elif not item.c:
                # do something else
            elif item.c and not item.d:
                # do something else
        else:
            # do something else
    elif item.g and item.f:
.
.
.

Gilded Rose

LIVE

Questions ?

A tale of refactoring - EuroPyhon 2018

By Emma

A tale of refactoring - EuroPyhon 2018

EuroPython 2018 talk

  • 1,742