podcast-rr-238-refactoring

https://devchat.tv/ruby-rogues/238-rr-refactoring

at 4:40 chuck talks about characterization tests

podcast-rr-238-refactoring#characterization-tests1 Chuck: "something was really hard to test or really hard to put your head around. And so, by just writing some test to characterize, "I pass this in, I get this back out, I see these side effects," it at least is somewhere to start. Because then I know if I change something along the lines of those assumptions anyway, then I know about it." podcast-rr-238-refactoring#characterization-tests1

testing-concept-attribute-testing

podcast-rr-238-refactoring#attribute-testing1 CORALINE: that's almost like attribute testing where you're not worried so much about the internals or what the code is doing but what is the output of it. Does the object that results from a call have certain qualities or not have certain qualities? podcast-rr-238-refactoring#attribute-testing1

podcast-rr-238-refactoring#not-strong-enough-test-suite "I think one of the places where people fail in refactoring is not having a strong enough test suite to support the refactoring effort. I think it was Michael Feathers who, well Corey Haines attributed this quote to Michael Feathers, "If you're refactoring without testing you're just changing shit." podcast-rr-238-refactoring#not-strong-enough-test-suite

podcast-rr-238-refactoring#meta-programming-to-create-it-blocks1 Coraline talks about making throwaway tests that generate it blocks. Avdi says that's a practical use, and that it's great because you get rid of them later. podcast-rr-238-refactoring#meta-programming-to-create-it-blocks1

At 8:35 of the talks about switching hats

the-right-editor-for-the-job

podcast-rr-238-refactoring#avdi-uses-two-editors1 At 17:30 Advi says sometimes in Emacs sometimes in Rubymine (uses Rubymine for refactoring) podcast-rr-238-refactoring#avdi-uses-two-editors1

At 31:40 refactoring-pattern-introduce-explaining-variable

At 38:45 artifacts-are-linked-to-the-thinking-process

At 43:15 compare to old results

podcast-rr-238-refactoring#why-throwaway-tests1 CORALINE: "Another thing that's important about tests as they pertain to refactoring is that through the refactoring process you're going to probably be rewriting the kinds of tests that you don't want to be long-lived in your codebase. And that's fine. You can write tests that you're eventually going to throw away. As developers we like deleting code, but we're terrified of deleting tests. And I think that's something you really have to overcome through a refactoring effort because you're going to need tests to guide you along the way. But those are not things that are necessarily going to be useful in the long term." podcast-rr-238-refactoring#why-throwaway-tests1

podcast-rr-238-refactoring#compare-to-old-results1 CORALINE: One of the things I've done as well, and this is a weird testing technique, from changing the implementation of an algorithm, I'll actually capture the old algorithm inside of a lambda in my test suite. I will throw values at the old algorithm by invoking the lambda and capturing the result, and then call the new function and compare the results to make sure that I haven't inadvertently changed something about the implementation that's changing the output characteristics of a method. And again, that's not something I would want to leave in place for very long but it's just a way of double-checking that you haven't changed something unexpectedly.

AVDI: That's cool. That's like the thing at a much coarser scale, larger scale, where you have two separate systems and you apply the same requests to both of them and log the responses and make sure that they match. podcast-rr-238-refactoring#compare-to-old-results1

Talks a lot about testing-concept-throwaway-tests

They reference this talk as being good: talk-fluent-refactoring

They talk about book-refactoring-ruby-edition

Referring Pages

testing-concept-characterization-tests testing-concept-throwaway-tests running-new-implementations-in-parallel-with-old-ones testing-concept-attribute-testing the-right-editor-for-the-job

People

person-coraline-ada-ehmke