Effective PyCharm Transcripts
Lecture: Refactoring introduction
0:03 Hello again. I am so very excited about this chapter. Refactoring is one of my absolute favorite topics.
0:11 Why? Because I see so many people start to write software and then they get frozen in place thinking oh well what if I'm doing it wrong And what if in
0:20 the future we need this other feature or there's other ways to write this part of
0:24 the program and they just get stuck when they spend so much time thinking and worrying about getting started. Instead of just getting started.
0:32 And with refactoring we can make some progress, we'll learn a bunch more about the problem we're trying to solve and then we can
0:39 apply refactories changes to our code that changed the structure or the architecture without actually
0:45 changing the behavior. We can apply these refactoring to make it better. So instead of getting stuck with analysis,
0:51 paralysis or worrying too much about how to get started. Just get started and apply what you learn in this chapter to keep you on track
0:59 That's the way real software is built. So we're gonna see as we write our code, there'll be problems like there'll be a method that's 500 lines long.
1:08 There'll be variables that have very poor names, methods that have poor names, methods that should be broken apart.
1:15 Class hierarchies that contain the abstractions at the wrong level. All kinds of things that we can do to move code around automatically with PyCharm.
1:23 Now I want to be super clear here. This is not some sort of advanced find and replace. Not at all that could find just duplicates of names.
1:33 they don't actually have any relationships across our files and wreck our program. Know what this is, is PyCharm,
1:39 loads up all the files in our project. It turns it into an abstract syntax tree where it understands the actual relationships between the
1:47 symbols and code. And when you apply those changes those re factories, it's not based on names, it's based on how the code actually works.
1:55 So it's really, really reliable and it truly understands what's going on. So fantastic tools in PyCharm for refactoring.
2:03 I think it's such an important skill to master and to know about and the tools are great. So we're going to dive into it and see how to apply them
2:10 to some examples in this chapter.