Mastering PyCharm Transcripts
Lecture: Your turn: Refactoring
0:01 Refactoring is a place where PyCharm really shines.
0:05 You can see it actually working much better than most editors.
0:09 Here is a chance to take some existing bad code
0:12 and apply the refactoring tools to make it what I would consider better.
0:16 So, let's look at the steps we're going to go through on github.
0:21 Over here on github, your turn 4, there is a couple of things,
0:25 we have our read me with the instructions,
0:27 and we have the smelly podcast
0:29 as in it has many code smells within it.
0:31 So smelly podcast is what you are going to work on
0:34 to take and transform into a better version
0:36 if for some reason you want to see
0:39 what the expected result was supposed to be
0:41 here is the expected final version,
0:43 but obviously, don't start with that, there will be nothing to refactor.
0:46 So we'll come down here and we're going to open up that project
0:49 and use some of the code smells to guide us on how to fix it.
0:53 So we're going to use the large method smell here,
0:56 the large method, and some of the refactoring tools around that
1:00 and we're going to use what I am calling the large module
1:03 Kent Beck and Martin Fowler and those guys
1:06 were in object oriented world where they talked about large classes,
1:09 but I think PyCharm probably has a large module smell concept as well.
1:13 And then, this thing that I am naming variable absence
1:16 where we just have these really complicated expressions like this
1:19 we had some variables but names, we wouldn't know what that means.
1:23 So you're going to use the refactoring tools on that as well.
1:26 And once you're done with this,
1:28 I think you'll see you have a much nicer bit of code
1:30 and you can do this with really doing nothing
1:32 but deriving the tools that run the refactoring
1:35 you won't actually have to write really any code at all.