WEBVTT

00:00:00.001 --> 00:00:02.400
When can you call yourself a professional developer?

00:00:02.400 --> 00:00:06.160
Sure, getting paid to write code is probably part of the formula,

00:00:06.160 --> 00:00:08.700
but when is your skill set up to that level?

00:00:08.700 --> 00:00:13.900
Many folks in the industry suffer from imposter syndrome or other types of uncertainty.

00:00:13.900 --> 00:00:18.480
Yet, there are real techniques and skills you should know before you meet this bar.

00:00:18.480 --> 00:00:23.120
Dane Hillard is here to share his take on the practices of the Python Pro.

00:00:23.120 --> 00:00:27.400
We'll discuss concrete steps as well as abstract design concepts

00:00:27.400 --> 00:00:29.520
to help your code make the jump to pro level.

00:00:30.120 --> 00:00:34.400
This is Talk Python To Me, episode 246, recorded December 5th, 2019.

00:00:34.400 --> 00:00:50.840
Welcome to Talk Python To Me, a weekly podcast on Python,

00:00:50.840 --> 00:00:53.900
the language, the libraries, the ecosystem, and the personalities.

00:00:53.900 --> 00:00:55.840
This is your host, Michael Kennedy.

00:00:55.840 --> 00:00:57.980
Follow me on Twitter where I'm @mkennedy.

00:00:58.400 --> 00:01:01.720
Keep up with the show and listen to past episodes at talkpython.fm

00:01:01.720 --> 00:01:04.140
and follow the show on Twitter via at Talk Python.

00:01:04.140 --> 00:01:07.300
This episode is brought to you by Tidelift and Linode.

00:01:07.300 --> 00:01:09.460
Please check out what they're offering during their segments.

00:01:09.460 --> 00:01:10.880
It really helps support the show.

00:01:10.880 --> 00:01:13.180
Dane, welcome to Talk Python To Me.

00:01:13.180 --> 00:01:14.000
Hey, thanks.

00:01:14.000 --> 00:01:15.060
It's great to have you here.

00:01:15.060 --> 00:01:16.620
I'm really excited about this topic, actually.

00:01:16.620 --> 00:01:18.500
I think you've got something good going on here.

00:01:18.500 --> 00:01:19.280
It'd be fun to talk about.

00:01:19.280 --> 00:01:19.920
Yeah, thanks a lot.

00:01:19.920 --> 00:01:20.640
Thanks for having me.

00:01:20.640 --> 00:01:22.840
Yeah, we're going to learn what a pro means.

00:01:23.000 --> 00:01:28.080
I mean, there's a lot of debate about titles and when are you no longer a beginner or you're

00:01:28.080 --> 00:01:30.460
actually a professional programmer and all these things.

00:01:30.460 --> 00:01:31.860
So that's going to be a lot of fun to dig into.

00:01:31.860 --> 00:01:33.920
But before we get to that, let's start with your story.

00:01:33.920 --> 00:01:35.480
How'd you get into programming in Python?

00:01:35.480 --> 00:01:39.020
For programming in general, I followed a fairly traditional path.

00:01:39.180 --> 00:01:45.960
I went to school for computer engineering, mostly learning C++ at the time, MATLAB, things

00:01:45.960 --> 00:01:46.560
like that.

00:01:46.560 --> 00:01:52.220
And then computer engineering is kind of this mix of hardware and software disciplines, which

00:01:52.220 --> 00:01:55.800
I've mostly not made use of since school.

00:01:55.800 --> 00:01:58.300
So I've stuck very much to the software side.

00:01:58.300 --> 00:02:06.760
But since I got out of school, I've been doing everything from Perl and PHP and C++ and C

00:02:06.760 --> 00:02:08.860
to Python and JavaScript as well.

00:02:09.360 --> 00:02:10.260
That sounds fun.

00:02:10.260 --> 00:02:15.080
You know, the whole hardware side of computers, it's kind of a black box to me.

00:02:15.080 --> 00:02:18.420
And it's just something that I've never really learned.

00:02:18.420 --> 00:02:22.740
I mean, obviously, I understand what RAM is and a disk is and buses and all that.

00:02:22.740 --> 00:02:27.300
But I couldn't build one or design one or even understand what the little parts mean when

00:02:27.300 --> 00:02:29.960
I take it apart other than this goes in the PCI slot.

00:02:29.960 --> 00:02:32.580
So that's probably fun to know that level, right?

00:02:33.420 --> 00:02:34.080
It is.

00:02:34.080 --> 00:02:37.000
And I've admittedly forgotten more than I would like.

00:02:37.000 --> 00:02:42.520
But, you know, I think I still try to keep with it for things like Raspberry Pi and Arduino

00:02:42.520 --> 00:02:44.080
and things like that from time to time.

00:02:44.080 --> 00:02:46.860
So it's sort of fun to keep as a hobby.

00:02:46.860 --> 00:02:47.280
Yeah.

00:02:47.280 --> 00:02:48.740
It's a bit of a renaissance for that, right?

00:02:48.740 --> 00:02:52.160
I mean, it used to be you had to be Dell or somebody like this to make these things.

00:02:52.160 --> 00:02:55.060
And now you can spend five bucks and get a little microchip.

00:02:55.060 --> 00:02:55.680
Yeah, absolutely.

00:02:55.680 --> 00:02:56.700
It's kind of cool.

00:02:56.700 --> 00:02:59.220
It's an empowering time in that regard.

00:02:59.540 --> 00:03:00.260
Yeah, absolutely.

00:03:00.260 --> 00:03:02.900
So you got out of school and you're working with all these different languages.

00:03:02.900 --> 00:03:04.060
How did you come to Python?

00:03:04.060 --> 00:03:10.620
I want to say that there was a short precursor to my time with Python that was learning Ruby.

00:03:10.620 --> 00:03:15.420
And that was kind of at the behest of a friend of mine who was doing a hackathon and wanted

00:03:15.420 --> 00:03:20.860
to build some, I think like a domain specific language of some kind on top of Ruby for something.

00:03:20.860 --> 00:03:26.440
And I had never used sort of a dynamically typed language or anything like that.

00:03:26.680 --> 00:03:30.780
And Ruby was kind of a refreshing experience from what I knew at the time.

00:03:30.780 --> 00:03:36.940
And I think around that time, I was also looking for a new language to write my personal website in.

00:03:36.940 --> 00:03:39.340
The current iteration was in PHP at the time.

00:03:39.340 --> 00:03:43.540
And I had tried Java Spring a bit and didn't like that too much.

00:03:43.540 --> 00:03:46.000
So I decided to try Django.

00:03:46.000 --> 00:03:54.000
And I think Django was sort of my first major foray into Python because I remember learning a lot of Python stuff at the same time I was learning Django.

00:03:54.000 --> 00:03:54.780
Right, right, right.

00:03:54.780 --> 00:03:55.160
That's cool.

00:03:55.540 --> 00:03:58.280
Well, I think a lot of people come into Python because of Django.

00:03:58.280 --> 00:03:59.600
Yeah, I would agree.

00:03:59.600 --> 00:04:00.820
I want to do something on the web.

00:04:00.820 --> 00:04:02.820
I heard Django is easy and cool.

00:04:02.820 --> 00:04:03.820
Let's try that.

00:04:03.820 --> 00:04:04.900
Oh, I guess I have to learn Python.

00:04:04.900 --> 00:04:06.400
Well, that wasn't too hard.

00:04:06.400 --> 00:04:08.320
It's kind of easy language to learn.

00:04:08.320 --> 00:04:12.160
But, you know, that also touches a little bit on the subject of what we're going to cover, right?

00:04:12.160 --> 00:04:14.920
Some people say, oh, you can learn Python in a weekend.

00:04:14.920 --> 00:04:15.540
It's so easy.

00:04:16.280 --> 00:04:20.300
And yet, just weekly, I'm learning new things on Python.

00:04:20.300 --> 00:04:24.360
And I spend all day diving into it and looking at all the edge cases.

00:04:24.360 --> 00:04:26.080
And you can't learn Python in a weekend.

00:04:26.080 --> 00:04:27.840
But you can sort of get it together.

00:04:27.840 --> 00:04:32.140
And I think there's a really interesting spectrum there from, hey, I made this website.

00:04:32.140 --> 00:04:33.460
And I kind of know the language, too.

00:04:33.460 --> 00:04:37.140
I'm really good at this language and the ecosystem and so on.

00:04:37.140 --> 00:04:39.740
It's broader than it first seems or harder than it first seems.

00:04:39.740 --> 00:04:40.460
Yeah, absolutely.

00:04:40.460 --> 00:04:48.060
And I mean, I think there's plenty of people out there, too, who don't want or need to get to that depth for a given language.

00:04:48.060 --> 00:04:54.100
Especially people who are kind of polyglot, if you will, and need to know a bevy of languages.

00:04:54.100 --> 00:05:01.800
Sometimes just knowing enough of that language to solve the problems in those various domains is totally, totally good.

00:05:01.800 --> 00:05:06.060
So, yeah, there's such a spectrum of situations and experiences there.

00:05:06.060 --> 00:05:06.720
Yeah, for sure.

00:05:06.720 --> 00:05:09.420
And then there's the folks who are doing something else.

00:05:09.420 --> 00:05:11.540
Economics, biology.

00:05:11.540 --> 00:05:16.640
And they just need enough to get through their biology problem or to run that economic simulation.

00:05:16.640 --> 00:05:20.340
And that they don't care about the nuances of generators.

00:05:20.340 --> 00:05:29.280
They just want to know whether, like, they can get pandas to spit out the answer they need or map plot to, like, show the graph that they need so they can carry on.

00:05:29.280 --> 00:05:29.860
Yeah, exactly.

00:05:29.860 --> 00:05:30.400
For sure.

00:05:30.400 --> 00:05:30.740
All right.

00:05:30.740 --> 00:05:35.440
So, before we get to the main topic, maybe just tell us what you do day to day so people know where you come from.

00:05:35.440 --> 00:05:35.760
Yeah.

00:05:35.760 --> 00:05:40.060
So, I'm still very much into the web side of things these days.

00:05:40.060 --> 00:05:42.200
I'm working on jstor.org.

00:05:42.200 --> 00:05:46.620
It's an academic research platform, kind of a journal database.

00:05:46.620 --> 00:05:49.580
And I've been there for about five years now.

00:05:49.580 --> 00:05:53.480
Before that, I was actually in biology to some degree.

00:05:53.480 --> 00:05:55.540
I was doing some bioinformatics work.

00:05:55.540 --> 00:06:01.220
And I did do a little bit of Python scripting there, but a lot of database administration and things like that also.

00:06:01.220 --> 00:06:04.960
And before that, I was doing some radar telemetry.

00:06:05.820 --> 00:06:07.640
So, it's quite the spectrum of stuff.

00:06:07.640 --> 00:06:07.900
Yeah.

00:06:07.900 --> 00:06:11.200
I feel like bioinformatics would actually be really interesting.

00:06:11.200 --> 00:06:12.480
Yeah, it really was.

00:06:12.480 --> 00:06:27.340
And I think, to me, that's often, like, the joy of programming is that you're both solving problems with code directly, but also kind of picking up these secondhand areas of knowledge about some different subject.

00:06:27.340 --> 00:06:27.660
Right?

00:06:27.660 --> 00:06:32.840
So, people have a chance to kind of explore beyond just knowing how to write code.

00:06:32.840 --> 00:06:33.080
Right.

00:06:33.080 --> 00:06:38.780
If you get bored of writing bank software, you can go write, you know, renewable energy software or take your bank.

00:06:38.780 --> 00:06:39.060
Yeah, exactly.

00:06:39.060 --> 00:06:40.600
Yeah, that's actually pretty awesome.

00:06:40.600 --> 00:06:47.300
Because unlike many jobs, developers are in demand across all the industries.

00:06:47.300 --> 00:06:52.320
Basically, there's this quote by Satya Nadella that every company is a software company these days.

00:06:52.320 --> 00:06:53.580
And I kind of feel like that's right.

00:06:53.580 --> 00:06:55.060
Yeah, that resonates with me, too.

00:06:55.060 --> 00:07:01.620
I think it's, you know, every company has some area, whether it's, I don't know, it ranges from mundane to interesting.

00:07:01.620 --> 00:07:16.140
But every company has this area where they can use software to augment whatever it is that they're doing, whether it's to do directly what they need for their business, or if it's just to make their business better in some way, faster, more efficient.

00:07:16.440 --> 00:07:22.140
If they're thinking, well, we need to hire 10 people to like manually do this thing, because it's really slow and tedious.

00:07:22.140 --> 00:07:25.000
Well, maybe people shouldn't be doing that thing.

00:07:25.000 --> 00:07:28.340
Maybe they should be overseeing the machines doing that thing or something to that effect.

00:07:28.340 --> 00:07:28.520
Yeah.

00:07:28.520 --> 00:07:28.800
Yeah.

00:07:28.800 --> 00:07:30.320
So, let's get into this topic.

00:07:30.320 --> 00:07:34.860
We're going to talk about your book, Practices of the Professional Python Pro.

00:07:35.120 --> 00:07:37.920
And let's just start with that last word there.

00:07:37.920 --> 00:07:39.900
Like, what makes a developer a pro?

00:07:39.900 --> 00:07:42.560
I mean, you've had a lot of experiences, a lot of different types of companies.

00:07:42.560 --> 00:07:43.600
What do you think?

00:07:43.600 --> 00:07:44.920
What's the indicator for you?

00:07:45.080 --> 00:07:45.240
Yeah.

00:07:45.240 --> 00:07:49.560
So, the title is almost kind of got this double entendre to it.

00:07:49.560 --> 00:07:56.340
It gets at this idea that there are practices that can make you a more effective developer.

00:07:56.340 --> 00:08:02.720
There are things you can think about as you're developing code to improve the outcomes that you get.

00:08:02.720 --> 00:08:12.620
And that is stuff that over time, sometimes decades, right, whole careers, you can build and learn and never run out of stuff to start learning.

00:08:12.620 --> 00:08:22.060
But at the same time, I think a lot of these things are things anybody writing code could start to pick up bits and pieces of right away.

00:08:22.060 --> 00:08:28.500
And so, in that regard, everyone who's paid to do something is a professional, right?

00:08:28.500 --> 00:08:29.200
Right.

00:08:29.200 --> 00:08:29.580
Right.

00:08:29.580 --> 00:08:32.360
Like, if that's you, congrats, you've made it.

00:08:32.360 --> 00:08:41.540
And so, I think some of what the book is about also is just like, hey, if you're new and you just want to know what people in the industry are kind of thinking about,

00:08:41.820 --> 00:08:51.380
maybe you haven't done software professionally before, maybe you've used it in your biology work or something like that, or you're switching fields altogether.

00:08:51.380 --> 00:08:57.280
It's kind of a way to get some insight into the kinds of things you might want to be thinking about.

00:08:57.280 --> 00:08:57.980
Yeah, absolutely.

00:08:57.980 --> 00:09:01.840
And what I like the title, I do like how it sort of puts that out there is,

00:09:01.980 --> 00:09:10.740
these are the things that you would expect somebody who really cares about their craft, either because they love it or because they're paid enough that they're supposed to pay attention to that.

00:09:10.740 --> 00:09:14.520
Whatever reason, these are the techniques and things that they do.

00:09:14.520 --> 00:09:16.760
You probably are not doing all of them.

00:09:16.760 --> 00:09:24.220
Probably you've come from some other industry or you're new to the industry, or maybe even you've been a professional C++ developer for 20 years.

00:09:24.220 --> 00:09:30.160
And all of a sudden, somebody told you compilers are out and you're going to go write this funny language with no semicolons.

00:09:30.160 --> 00:09:33.520
What do these people do in their pro side of things, right?

00:09:33.520 --> 00:09:33.780
Right.

00:09:33.780 --> 00:09:38.200
And as experts here, I think there's a lot to take away for a lot of folks.

00:09:38.200 --> 00:09:49.420
But yeah, this idea of just what is a pro or maybe, you know, more broadly, so we're not hung up on the money side of it, just like an expert in a language or, you know, in Python.

00:09:49.420 --> 00:09:57.560
It's an interesting question of when you can call yourself a developer, when you call yourself a professional developer or something like that.

00:09:57.560 --> 00:09:58.880
I don't really know where that is.

00:09:58.880 --> 00:10:00.160
We can think a little bit more about that.

00:10:00.160 --> 00:10:05.600
But I do know that beginners get frustrated really easily when they're trying to work.

00:10:05.600 --> 00:10:08.500
And I'm thinking more beginner programmers, not beginner just in Python.

00:10:08.500 --> 00:10:10.040
They've got to solve some problem.

00:10:10.040 --> 00:10:13.280
They're like, oh, my gosh, I just heard I have to use a database for this.

00:10:13.280 --> 00:10:15.140
I don't even know what a database is.

00:10:15.140 --> 00:10:15.960
Not really.

00:10:15.960 --> 00:10:17.280
So what do I do now?

00:10:17.280 --> 00:10:18.860
And it can be really frustrating.

00:10:18.860 --> 00:10:19.720
So I don't know.

00:10:19.720 --> 00:10:22.940
What are your thoughts for folks who are not at this level?

00:10:22.940 --> 00:10:25.600
But, you know, maybe things like this book would help them get there.

00:10:25.600 --> 00:10:26.440
What would you tell them?

00:10:26.440 --> 00:10:38.220
Yeah, I think that a lot of the source of frustration as a developer or as a beginning developer is that sometimes you aren't not only do you not know the answer, but sometimes you don't even know the question.

00:10:38.220 --> 00:10:38.940
Yeah.

00:10:38.940 --> 00:10:51.280
So you're often kind of trying to think about what it is you even are trying to know, whether it's because an error you saw is too obscure or you just can't quite ask the right question.

00:10:51.280 --> 00:11:01.420
And so, like my general advice outside the book or sort of tangential to the book is to start figuring out how to search better, like for your problems.

00:11:01.420 --> 00:11:01.820
Yes.

00:11:01.820 --> 00:11:05.680
So now let me just let me stop you for a second, because I agree with that.

00:11:05.680 --> 00:11:16.440
But I feel like a lot of people who are new probably perceive searching for a fix as giving up or I failed to like get this understanding correctly.

00:11:16.440 --> 00:11:17.120
Yeah.

00:11:17.120 --> 00:11:26.480
I think and I don't mean this in a negative way, but I think that there's this whole sort of hidden realm that a lot of people don't see where it's Googling like crazy.

00:11:26.480 --> 00:11:29.660
As a professional software developer, you're like, okay, I got to use this library.

00:11:29.660 --> 00:11:30.800
I don't know anything about it.

00:11:30.800 --> 00:11:31.660
Let me take a shot.

00:11:31.660 --> 00:11:32.460
Nope, that didn't work.

00:11:32.460 --> 00:11:33.120
Let's take that error.

00:11:33.120 --> 00:11:34.180
Let's search the heck out of that.

00:11:34.180 --> 00:11:35.380
Oh, no, I'm over here.

00:11:35.380 --> 00:11:37.320
Oh, wait, this is another thing that seems better.

00:11:37.320 --> 00:11:37.720
I'm going to search.

00:11:37.720 --> 00:11:40.060
It's just there's a lot of searching.

00:11:40.060 --> 00:11:48.840
And really soon, at least in my world, when I'm like, if this is not working and I don't have an answer in two minutes, I'm on the Internet trying to find it because often that works.

00:11:48.840 --> 00:12:05.000
Yeah, I think that's a really great thing to dispel because it doesn't go away and perhaps only increases as your sort of breadth of knowledge grows or at least breadth of awareness of what's out there and your search skills grow.

00:12:05.000 --> 00:12:12.940
You kind of have a bigger surface area to explore and you have to figure out which piece to hone in on to maybe find your problem.

00:12:12.940 --> 00:12:17.080
And so it's hard to say just go learn how to search better, I guess.

00:12:17.080 --> 00:12:20.680
Yeah, that's one of the elements, but I think it's part of it.

00:12:20.680 --> 00:12:20.860
Yeah.

00:12:20.860 --> 00:12:21.200
Yeah.

00:12:21.200 --> 00:12:31.580
And there is also that danger, right, that you land on either the incorrect answer or something as a beginner that you wouldn't necessarily know how to assess the validity of.

00:12:31.580 --> 00:12:33.080
Yes, that's true.

00:12:33.080 --> 00:12:36.720
From just plain wrong to malicious or something, right?

00:12:36.720 --> 00:12:41.580
Or even just it's a perfectly good answer, but it's not the same situation.

00:12:41.580 --> 00:12:42.020
Yeah.

00:12:42.020 --> 00:12:46.960
But you don't have the nuance to know that's not actually what I'm looking for.

00:12:46.960 --> 00:12:49.460
It's the next Stack Overflow one I got to go after.

00:12:49.460 --> 00:12:50.640
Yeah.

00:12:50.640 --> 00:12:55.760
So unfortunately, the answer there sometimes is that there's a lot of trial and error.

00:12:55.760 --> 00:12:59.380
But again, that sort of sticks with you throughout your career, I think.

00:12:59.380 --> 00:13:00.320
Yeah.

00:13:00.320 --> 00:13:00.620
Yeah.

00:13:00.680 --> 00:13:09.760
I did a show back on 203 with Ned Batchelder and some other folks about beginners and experts in this panel talking about a bunch of beginners.

00:13:09.760 --> 00:13:11.940
And I had Ned as the expert.

00:13:11.940 --> 00:13:13.480
And it was a really interesting conversation.

00:13:13.480 --> 00:13:25.540
And a few of the things that I sort of condensed out of that conversation was there's a lot of things that beginners perceive as a, this is me doing it wrong or this is me not good at it.

00:13:25.540 --> 00:13:27.060
But it's just that's how it feels.

00:13:27.220 --> 00:13:35.860
Like, for example, being stuck and trying to get a library to work when it's not or trying to get some, like the compiler to work if you're in a compiled language or whatever.

00:13:35.860 --> 00:13:39.440
Just being stuck or feeling kind of lost is just part of the journey.

00:13:39.440 --> 00:13:43.460
And just like, as a professional, as a pro, you're like, oh, we're in this part of the journey.

00:13:43.460 --> 00:13:45.860
We're in the next half hour is going to suck.

00:13:45.860 --> 00:13:46.960
And I'm going to be on Google a lot.

00:13:46.960 --> 00:13:47.760
But here we go.

00:13:47.840 --> 00:13:52.780
And then you just know if you just keep hitting that problem, eventually you'll be gone through it.

00:13:52.780 --> 00:13:58.040
Another one, I think knowing data structures is really, really good for people.

00:13:58.040 --> 00:14:05.600
And then, like you said, kind of having these battle scars of, yeah, it looks like they're talking about your problem, but that's not the problem.

00:14:05.600 --> 00:14:06.700
It's this other thing.

00:14:06.700 --> 00:14:09.740
Because I've tried four times that way, and that was really a bad week.

00:14:09.740 --> 00:14:10.420
And that didn't work.

00:14:10.420 --> 00:14:11.400
So now we're over here.

00:14:11.400 --> 00:14:16.240
And some of those you can learn, like just knowing that, well, if you're stuck, you just pound through it.

00:14:16.360 --> 00:14:17.900
And that's just part of the journey.

00:14:17.900 --> 00:14:18.580
It's fine.

00:14:18.580 --> 00:14:21.720
The building up the battle scars, like that just takes time, I think.

00:14:21.720 --> 00:14:22.320
Yeah, absolutely.

00:14:22.320 --> 00:14:31.760
And like you said, when you see a Stack Overflow answer and you think it might be the one to solve your problem, there's a similar thing as you're using like third-party libraries.

00:14:31.760 --> 00:14:32.500
Yes, true.

00:14:32.500 --> 00:14:34.040
You can't get it to work.

00:14:34.040 --> 00:14:42.080
You can't get it to work, but you don't yet know if it's because of something you did or if it's really because there's a bug.

00:14:42.960 --> 00:14:55.800
And getting to uncovering that bug can sometimes be an exciting moment, even though it's frustrating getting there because you're like, oh, I actually exercised a problem that other people might be experiencing.

00:14:55.800 --> 00:14:59.600
And then you can sort of contribute back to that discussion.

00:14:59.600 --> 00:15:03.500
And if that bug's already been filed or something, you can say, hey, I ran into this too.

00:15:03.500 --> 00:15:06.980
And it just kind of grows the community in that way.

00:15:06.980 --> 00:15:07.760
Yeah, it's interesting.

00:15:07.760 --> 00:15:09.680
I just got an email today from GitHub.

00:15:09.680 --> 00:15:12.720
I had filed an issue for PyInstaller.

00:15:12.720 --> 00:15:14.700
I was trying to combine it with something else.

00:15:14.700 --> 00:15:16.200
And it wasn't quite working right.

00:15:16.200 --> 00:15:17.280
I was doing something weird.

00:15:17.280 --> 00:15:18.800
Or no, it wasn't PyInstaller.

00:15:18.800 --> 00:15:19.400
It was GUI.

00:15:19.400 --> 00:15:20.820
I was using those two together.

00:15:20.960 --> 00:15:22.120
And I got a message today.

00:15:22.120 --> 00:15:24.420
Somebody else said, I'm having exactly the same problem.

00:15:24.420 --> 00:15:26.020
What can we do about it?

00:15:26.020 --> 00:15:28.100
I'm like, oh, I still can't solve it for you.

00:15:28.100 --> 00:15:31.400
But I started the conversation six months ago or whatever it was.

00:15:31.400 --> 00:15:32.280
Yeah.

00:15:32.280 --> 00:15:34.380
So let me ask.

00:15:34.380 --> 00:15:35.660
It's serendipitous sometimes.

00:15:35.660 --> 00:15:36.900
Yeah, it definitely is.

00:15:36.900 --> 00:15:38.240
It definitely is.

00:15:38.240 --> 00:15:38.840
It's aha moments.

00:15:38.840 --> 00:15:40.100
Yeah, it's funny.

00:15:42.100 --> 00:15:45.080
This portion of Talk Python To Me is brought to you by Tidelift.

00:15:45.080 --> 00:15:50.520
Tidelift is the first managed open source subscription, giving you commercial support and maintenance

00:15:50.520 --> 00:15:54.380
for the open source dependencies you use to build your applications.

00:15:54.380 --> 00:15:59.700
And with Tidelift, you not only get more dependable software, but you pay the maintainers of the exact

00:15:59.700 --> 00:16:03.140
packages you're using, which means your software will keep getting better.

00:16:03.140 --> 00:16:07.920
The Tidelift subscription covers millions of open source projects across Python, JavaScript,

00:16:07.920 --> 00:16:10.360
Java, PHP, Ruby, .NET, and more.

00:16:10.360 --> 00:16:15.480
And the subscription includes security updates, licensing, verification, and indemnification,

00:16:15.480 --> 00:16:20.560
maintenance and code improvements, package selection and version guidance, roadmap input,

00:16:20.560 --> 00:16:22.400
and tooling and cloud integration.

00:16:22.400 --> 00:16:27.660
The bottom line is you get the capabilities you'd expect and require from commercial software.

00:16:27.660 --> 00:16:33.820
But now for all the key open source software you depend upon, just visit talkpython.fm

00:16:33.820 --> 00:16:36.080
slash Tidelift to get started today.

00:16:38.000 --> 00:16:42.000
Another bad feeling is when you're searching for something that you don't quite understand how it works.

00:16:42.000 --> 00:16:44.800
And the best answer you can find is something you've written before.

00:16:44.800 --> 00:16:45.520
That's also bad.

00:16:45.520 --> 00:16:49.420
The cup lost.

00:16:49.420 --> 00:16:50.760
All hope is lost now.

00:16:50.760 --> 00:16:55.860
So let me ask you, thinking back, I'm not sure if you can remember clearly to this,

00:16:55.860 --> 00:16:57.720
but when was the first time you felt like,

00:16:57.780 --> 00:17:00.420
I'm actually a professional software developer.

00:17:00.420 --> 00:17:01.800
Like, I'm a pro now.

00:17:01.800 --> 00:17:06.740
I fit in with all these people who used to seem way smarter than me and I couldn't figure out what they were talking about.

00:17:06.740 --> 00:17:07.640
It's a great question.

00:17:07.640 --> 00:17:11.860
I don't know that I have sort of this decisive moment.

00:17:12.180 --> 00:17:19.380
So I guess one place that I had a kind of clear division line was from my first job,

00:17:19.380 --> 00:17:22.980
everyone was kind of a generation older than me at my office.

00:17:22.980 --> 00:17:27.380
And I mean, they were all great mentors and I learned a ton of stuff,

00:17:27.380 --> 00:17:30.840
but I definitely realized my own shortcomings often.

00:17:31.080 --> 00:17:37.320
And then sort of at my next position, people were more my peers in age and experience.

00:17:37.320 --> 00:17:45.040
And I think when mostly it was that kind of process of solving things together.

00:17:45.040 --> 00:17:49.500
And like collectively, we all knew about the same amount of stuff.

00:17:49.500 --> 00:17:56.040
And suddenly people are asking you to like, not only execute on a solution,

00:17:56.040 --> 00:17:59.120
but actually figure out what the solution is supposed to be.

00:17:59.120 --> 00:17:59.400
Right.

00:17:59.480 --> 00:18:04.300
I think that's really where it starts to make you grow as a developer.

00:18:04.300 --> 00:18:08.080
So I would say that's, to me, that's kind of the hinging moment.

00:18:08.080 --> 00:18:09.080
Yeah, that's interesting.

00:18:09.080 --> 00:18:13.960
Like, Dane, we've elected that you're going to write the e-commerce part of the website.

00:18:13.960 --> 00:18:15.160
You're like, I've never done that one.

00:18:15.160 --> 00:18:15.760
Neither have we.

00:18:15.760 --> 00:18:16.840
So someone's got to figure it out.

00:18:16.840 --> 00:18:17.640
So we've elected you.

00:18:17.640 --> 00:18:18.880
We got trusted you, right?

00:18:18.880 --> 00:18:22.380
I guess for me, there's probably, I guess there's probably two experiences.

00:18:22.380 --> 00:18:27.780
One, the first time I got paid a good salary to set and work on software

00:18:27.780 --> 00:18:31.500
and create applications for this company was so awesome.

00:18:31.500 --> 00:18:32.280
I was so excited.

00:18:32.280 --> 00:18:36.380
But I kept thinking, man, I better figure some of this stuff out before they realize,

00:18:36.380 --> 00:18:37.800
I don't know what I'm doing.

00:18:37.800 --> 00:18:38.800
They're going to kick me out of here.

00:18:38.800 --> 00:18:39.340
You know what I mean?

00:18:40.940 --> 00:18:43.280
So that was sort of the first step in the door.

00:18:43.280 --> 00:18:45.760
Like, wow, I'm really getting paid to write and create software.

00:18:45.760 --> 00:18:48.460
And it's fantastic, right?

00:18:48.460 --> 00:18:51.040
But I didn't really feel that totally solid.

00:18:51.040 --> 00:18:56.280
And I guess where I really felt like, okay, I guess I'm a pro, I guess,

00:18:56.280 --> 00:19:04.420
was when I was giving user group talks on subjects, design patterns or testing or whatever it was.

00:19:05.060 --> 00:19:07.740
And I went to, you know, all these people are enthusiastic.

00:19:07.740 --> 00:19:10.060
They go to meetups and stuff and gave a talk.

00:19:10.060 --> 00:19:11.100
And they're like, that was really great.

00:19:11.100 --> 00:19:11.980
I learned some stuff.

00:19:11.980 --> 00:19:13.180
And they didn't laugh at me.

00:19:13.180 --> 00:19:15.120
I'm like, that was great.

00:19:15.120 --> 00:19:18.160
Apparently, I, you know, present ideas to people.

00:19:18.160 --> 00:19:21.020
And just, you know, there's a couple of those milestones I can think of.

00:19:21.020 --> 00:19:24.100
But yeah, it's really hard to put a clear demarcation on it.

00:19:24.180 --> 00:19:28.880
Yeah, I mean, going back to your point about feeling like people are going to find you out, right?

00:19:28.880 --> 00:19:36.880
Like, that is the epitome of imposter syndrome, which I think is, especially in knowledge work and like that kind of area.

00:19:36.880 --> 00:19:39.620
I think people experience that to a large degree.

00:19:39.620 --> 00:19:42.840
So that's another thing to call out as like a beginning developer.

00:19:42.840 --> 00:19:50.160
If you have this constant feeling that somebody is going to call you out for being a fake, like that's real.

00:19:50.360 --> 00:19:54.280
That's a thing and that sometimes doesn't really go away either.

00:19:54.280 --> 00:19:57.480
I know I certainly feel it at least from time to time still, right?

00:19:57.480 --> 00:19:58.160
Yeah, for sure.

00:19:58.160 --> 00:19:59.400
It's hard for that to go away.

00:19:59.400 --> 00:20:04.100
But at the same time, you know, if you're making steady progress and learning a little bit more and learning a little bit more,

00:20:04.100 --> 00:20:09.760
if you're delivering what people want from you, just because you don't know how to factor that database into a third normal form,

00:20:09.760 --> 00:20:12.540
if that's not your job at the moment, you're probably fine.

00:20:12.540 --> 00:20:13.060
You know what I mean?

00:20:13.060 --> 00:20:13.640
Yeah, exactly.

00:20:13.640 --> 00:20:13.940
Cool.

00:20:13.940 --> 00:20:20.060
So speaking of topics and things like third normal form you should know or design patterns or software design and all that,

00:20:20.160 --> 00:20:24.960
let's dig into some of the ideas behind your book because I thought you did a good job laying out some of these things.

00:20:24.960 --> 00:20:28.140
And again, I don't think it's professional development,

00:20:28.140 --> 00:20:34.640
but more like what do you really need to be kind of an expert in software development in general and Python in particular, right?

00:20:34.640 --> 00:20:36.900
Probably the right focus, huh?

00:20:36.900 --> 00:20:37.760
Yep, I would say so.

00:20:37.760 --> 00:20:37.980
Yeah.

00:20:37.980 --> 00:20:38.940
So why do you write this?

00:20:38.940 --> 00:20:49.660
The impetus for this, I think, was seeing a few of my friends who were not in sort of the traditional path to software switching into a career in software.

00:20:49.960 --> 00:20:56.300
And seeing kind of how they thought about problems and the kinds of questions they were asking me at the time,

00:20:56.300 --> 00:21:06.700
that sort of insight into the kinds of things people were experiencing made me kind of interested in helping other people who were in that same situation.

00:21:06.700 --> 00:21:16.560
One of my friends was using Python to solve computational biology problems, computational chemistry problems, if I remember correctly.

00:21:17.180 --> 00:21:26.200
And it was sort of asking me to review his code from time to time and ask like what he was doing wrong or what he could do better.

00:21:26.200 --> 00:21:29.540
And it's sometimes hard to answer that question, right?

00:21:29.640 --> 00:21:43.460
If it's someone who isn't in software, you don't necessarily want to dump the entire world of, you know, you should format your code this way or you should optimize for readability or you should comment your code for these reasons.

00:21:43.460 --> 00:21:45.160
Like it can overload people.

00:21:45.160 --> 00:21:52.700
So I figured a book could be a more digestible thing that people can kind of jump in and out of as needed.

00:21:52.700 --> 00:22:01.240
And I tried to organize it in a way that they could sort of pick areas that they want to get better at and read about that topic without having to know everything.

00:22:01.480 --> 00:22:06.140
Right. It does seem like it's a little bit of this cookbook feel like you can drop in and I need to work on design.

00:22:06.140 --> 00:22:08.560
I need to work on testing or whatever it happens to be.

00:22:08.560 --> 00:22:09.600
Yeah. Nice.

00:22:09.600 --> 00:22:12.100
So let's start at the beginning, I guess.

00:22:12.100 --> 00:22:17.300
And you talk a lot about design and planning and software architecture to get started.

00:22:17.300 --> 00:22:25.700
And I guess one of the challenges, I guess it's probably two challenges that are really tricky for people right away is first, like what the heck is software design?

00:22:25.900 --> 00:22:33.560
You know, like if you know, when you see that it's not designed, if there's just a, there's no functions, there's no comments, there's bad variable.

00:22:33.560 --> 00:22:36.320
Like, you know, this is not designed and this is not professional.

00:22:36.320 --> 00:22:44.060
And probably this other thing, if I go to GitHub and, you know, pull down Flask and I look at its code, it probably is designed, but that's a little bit tricky.

00:22:44.060 --> 00:22:49.180
But knowing, you know, how much energy to put into it, what are the first steps that you take?

00:22:49.180 --> 00:22:50.400
What do you think about that?

00:22:50.400 --> 00:22:55.880
Yeah. I mean, I definitely emphasize in the book that to the point about energy, like things,

00:22:55.880 --> 00:22:59.040
are always trade-offs as you develop software, right?

00:22:59.040 --> 00:23:01.160
You only have so much time in your day.

00:23:01.160 --> 00:23:04.980
And realistically, you do need to ship software sometime.

00:23:04.980 --> 00:23:14.100
There's always a trade-off between how much time you spend upfront designing things versus how much time you spend actually implementing things and getting them out the door.

00:23:14.100 --> 00:23:17.860
So that is worth stating, I think, explicitly here.

00:23:17.860 --> 00:23:26.640
And then sort of generally, I think about design often the way you sort of think about solving problems in general, right?

00:23:26.640 --> 00:23:30.260
Like the problem is often too big to solve in one go.

00:23:30.520 --> 00:23:34.820
And so we typically break problems down into smaller chunks that we can solve.

00:23:34.820 --> 00:23:38.800
And that is a lot of what software design is too, right?

00:23:38.800 --> 00:23:42.860
Like this idea of separation of concerns and things like that, encapsulation, abstraction.

00:23:42.860 --> 00:23:48.300
They're all about not doing the whole world at one time.

00:23:48.560 --> 00:23:49.980
Sure. I've tried to boil the ocean before.

00:23:49.980 --> 00:23:50.740
It's not so fun.

00:23:50.740 --> 00:23:57.700
Like I remember there's this project that a whole team of us worked on for years, at least a year.

00:23:58.340 --> 00:24:08.340
And I somehow discovered this cool linting tool that would come along and tell you all the issues, even security issues, performance issues, and ran it against that.

00:24:08.340 --> 00:24:10.080
And it found like a thousand problems.

00:24:10.080 --> 00:24:14.120
And I started to work on a couple and it took like 10 minutes per one.

00:24:14.120 --> 00:24:15.500
Like, yep, we're not doing this.

00:24:15.500 --> 00:24:16.960
Just throw that away.

00:24:16.960 --> 00:24:18.620
We're just going to just keep going the way it's going.

00:24:18.620 --> 00:24:25.120
We can't take the next half year off and just make it the same, but slightly better.

00:24:25.360 --> 00:24:29.040
So there is this real tension of, I know this could be better.

00:24:29.040 --> 00:24:33.900
Maybe I should refactor this to use not deep inheritance, but I should use composition.

00:24:33.900 --> 00:24:39.920
Or I should refactor this so this is a separate package and then we can all use that and things along those lines.

00:24:39.920 --> 00:24:51.640
But one of the challenges with software design, I think, is it's almost got this creativity, this art aspect to it, where you could just keep polishing or keep sculpting indefinitely, right?

00:24:51.640 --> 00:24:57.160
I could continually refactor this code or restructure it basically indefinitely.

00:24:57.160 --> 00:25:06.340
And so, you know, you need to know maybe some reasons or triggers that say it's time now to go put a little effort into this or it's time to stop.

00:25:06.340 --> 00:25:08.140
Yeah, I could probably could refactor that as well.

00:25:08.140 --> 00:25:08.860
But you know what?

00:25:08.860 --> 00:25:10.360
Nobody touches that part.

00:25:10.360 --> 00:25:11.480
It doesn't really matter.

00:25:11.660 --> 00:25:12.520
Yeah, that's a great point.

00:25:12.520 --> 00:25:25.580
And I think a lot of newcomers, as they learn sort of new tricks, if you will, tend to try to use them as much as they can, which is it's a great way to continue learning that subject and understand more of the nuances around it.

00:25:25.580 --> 00:25:35.200
But sometimes if a nuance around, like you said, when to stop or when things are good enough is missed, you can certainly continue much too far down that track.

00:25:35.200 --> 00:25:41.200
Yeah, so let me throw out a couple of ideas on what I might think of as like clues there and you can comment or add to it.

00:25:41.200 --> 00:25:41.380
Yeah.

00:25:41.460 --> 00:25:51.280
So if I'm trying to add a feature and it's super hard to add the feature without causing a bug, I need to make a change and I got to touch a bunch of places or something like that.

00:25:51.280 --> 00:25:54.760
That seems like I need to redesign something so that doesn't happen too much.

00:25:54.760 --> 00:25:59.480
Or there's a part that bugs keep coming back to or something like that.

00:25:59.480 --> 00:26:11.860
If it's really problematic and every time you need to make a change, I got to spend 10, 15 minutes on this section just to make sure it doesn't break or to make sure it's in sync over and over and over again.

00:26:11.860 --> 00:26:22.860
I guess if you feel annoyed at your code, you're like, this is really, you're like, wait a minute, maybe that's a signal that I should take that frustration and fix rather than just endure this code.

00:26:22.860 --> 00:26:23.960
Yeah, that's exactly right.

00:26:23.960 --> 00:26:27.280
I think the squeaky wheel gets the grease in that sense, right?

00:26:27.380 --> 00:26:35.920
Like as you go about your day-to-day work, if you find an area of code that's commonly the thing causing you grief, that is a pretty strong signal.

00:26:35.920 --> 00:26:51.900
And to the point about going too far, I think if it is giving you grief at that time and you choose to attack it, like it's very easy to get tunnel vision and want to solve it to its extremity, but try to focus on solving the thing that was causing you pain.

00:26:52.280 --> 00:26:58.340
And, you know, if you need to change some peripheral things to solve that direct problem, that's okay.

00:26:58.340 --> 00:27:03.960
But try not to fix every problem until they really jump out at you.

00:27:03.960 --> 00:27:04.140
Yeah.

00:27:04.140 --> 00:27:09.440
And you probably also need some guide rails, maybe safety nets is a better analogy here.

00:27:10.200 --> 00:27:15.860
If you're going to start tearing stuff up, maybe you want to have tests to make sure that it still works or something like that, right?

00:27:15.860 --> 00:27:23.760
Like it's not every bit of code needs testing, but if you're going to start really, really pounding on it, you know, might be worth putting some basic rough.

00:27:23.760 --> 00:27:28.000
Does this kind of still sort of work tests in place before you do that?

00:27:28.000 --> 00:27:28.180
Right.

00:27:28.180 --> 00:27:30.560
These are like these characterization tests, right?

00:27:30.800 --> 00:27:36.500
Like you want to make sure that the most important aspects of your code continue to stay.

00:27:36.500 --> 00:27:36.940
Right.

00:27:36.940 --> 00:27:39.120
If this breaks, it's going to be really bad.

00:27:39.120 --> 00:27:40.280
In line with your expectations.

00:27:40.280 --> 00:27:41.560
Right.

00:27:41.560 --> 00:27:46.840
Or the MetaBank, the core trading engine that decides buy or sell, that part can't break.

00:27:46.840 --> 00:27:48.280
So we better fuck this up now.

00:27:48.280 --> 00:27:53.400
I'm sure I'm going to hear of it if I switch a minus to a plus the wrong way.

00:27:53.400 --> 00:27:54.540
Yeah.

00:27:55.580 --> 00:28:00.280
That's not one you want to hear about with a production error going up.

00:28:00.280 --> 00:28:02.880
No, no, it's definitely not.

00:28:02.880 --> 00:28:06.360
I guess when it comes to this design and like restructuring your code.

00:28:06.360 --> 00:28:10.140
So I kind of try to follow what I guess I'd call the Boy Scout rule.

00:28:10.140 --> 00:28:11.000
I was never a Boy Scout.

00:28:11.000 --> 00:28:16.460
So maybe I'm mischaracterizing them, but just leave the code slightly nicer than I found it.

00:28:16.460 --> 00:28:25.460
You know, if I come in here, instead of making it worse, what could I do in a little bit here and there to make it better than when I, if I got to touch it anyway.

00:28:25.460 --> 00:28:26.760
How do I make it a little bit better?

00:28:26.760 --> 00:28:27.060
Yeah.

00:28:27.060 --> 00:28:34.060
And I think the corollary of that is that that's a great place to start incrementally improving your code if you're not sure where to start.

00:28:34.060 --> 00:28:44.420
Like as you're working on something already, whether it's to add a feature or to fix a bug, why not use that place where you're already working as the place to improve?

00:28:44.540 --> 00:28:51.640
So if it feels like there's too much and you need to fix everything, start by fixing where you're already going.

00:28:51.640 --> 00:28:51.900
Right.

00:28:51.900 --> 00:28:52.680
Yeah, that's a good point.

00:28:52.680 --> 00:29:00.320
So you call it some interesting things, some considerations of making software good as a user and as a developer.

00:29:00.460 --> 00:29:06.160
And I think these can also guide this design thinking and this refactoring story.

00:29:06.160 --> 00:29:10.800
So some of the considerations as a user of how the software is designed.

00:29:10.800 --> 00:29:20.980
I mean, you as a user, hopefully you don't see the code, you know, you see the buttons and the widgets and whatnot, but you still get a sense of like, I can tell you there's certain times where I've worked with certain websites.

00:29:20.980 --> 00:29:24.360
I'm like, whoa, this is one shady, crappy website right here.

00:29:24.540 --> 00:29:30.240
Or other ones are like, this thing is super slick and maybe it's crummy underneath, but it feels like at least pretty well put together.

00:29:30.240 --> 00:29:35.440
And some of those for the user or like speed, you know, how quickly does it respond to me?

00:29:35.440 --> 00:29:39.180
Or data integrity, does the data get corrupted?

00:29:39.180 --> 00:29:42.240
And is it accurate in terms of resources?

00:29:42.240 --> 00:29:47.840
Maybe if it's a website, you don't see these, but certainly if it's a desktop app or something, you would.

00:29:47.840 --> 00:29:50.780
And, you know, does it feel secure, right?

00:29:50.780 --> 00:29:53.520
So these are certainly things that people can think about as well, right?

00:29:53.700 --> 00:29:57.500
I talk a little bit in the book about when is good enough to the point of speed.

00:29:57.500 --> 00:30:01.840
Things are often down to your user's perception, right?

00:30:01.840 --> 00:30:08.800
You don't necessarily need to continue making something faster from 100 milliseconds to one millisecond.

00:30:08.800 --> 00:30:17.020
If it's, for instance, some sort of UI interaction, like human perception doesn't go much faster than about 100 milliseconds, right?

00:30:17.020 --> 00:30:22.700
So there's heuristics, if you will, that can kind of help guide where you should shoot for.

00:30:22.860 --> 00:30:23.720
Yeah, and that's interesting.

00:30:23.720 --> 00:30:29.180
Certainly, there's the single user speed and then there's the scalability speed, you know.

00:30:29.180 --> 00:30:34.320
On Friday, nobody can use the website because everyone's entering their timesheet or something like that, right?

00:30:34.320 --> 00:30:36.380
But on Monday, it's really fast.

00:30:36.380 --> 00:30:39.900
That's also another one to consider.

00:30:40.100 --> 00:30:44.800
At least in the web world, maybe even in apps for APIs and stuff.

00:30:44.800 --> 00:30:51.440
There's a lot of stuff that doesn't, it seems like it's sort of some weird side case.

00:30:51.440 --> 00:30:52.920
I don't really care about this.

00:30:52.920 --> 00:31:00.560
For example, if I'm working on a website and I want to make it fast and the page loads in 150 milliseconds, I could optimize indices.

00:31:00.640 --> 00:31:03.080
I could refactor databases.

00:31:03.080 --> 00:31:04.220
I could do cluster.

00:31:04.220 --> 00:31:05.280
I could do all sorts of stuff.

00:31:05.280 --> 00:31:19.500
But if there's a bunch of JavaScript and a bunch of CSS and a bunch of images that don't have the right cache setting and the page appears to me as a user in one and a half seconds, whether I shave 10, 20 milliseconds off it, I don't care.

00:31:19.580 --> 00:31:21.160
The thing is super, super slow.

00:31:21.160 --> 00:31:25.940
I'm not going to call any companies out, but there's so many professional sites out there.

00:31:25.940 --> 00:31:27.800
Big companies are like, why is this so bad?

00:31:27.800 --> 00:31:31.620
It's inconceivable to me that it is this bad.

00:31:31.620 --> 00:31:34.160
And I actually have a recommendation for people.

00:31:34.160 --> 00:31:38.240
I don't know if you're familiar with this, but you know PageSpeed Insights from Google?

00:31:38.240 --> 00:31:38.520
Yeah.

00:31:38.520 --> 00:31:39.820
So that's a really great place.

00:31:39.820 --> 00:31:46.100
You can just put your domain or actually put any particular page in there and it'll tell you how fast your site is.

00:31:46.180 --> 00:31:51.860
So, for example, the training site that I run, the Talk Python training, its response time is super fast.

00:31:51.860 --> 00:31:57.280
I've got that dialed in so well and it was responded in like 15 milliseconds, right?

00:31:57.280 --> 00:31:58.600
Out the other side of the web server.

00:31:58.600 --> 00:32:00.440
That seemed like, well, I can't do much better than that.

00:32:00.440 --> 00:32:02.340
No one's going to perceive that last five milliseconds.

00:32:02.340 --> 00:32:07.800
I throw it into PageSpeed Insight and it says, your pages, it's average to slow.

00:32:07.800 --> 00:32:09.580
I'm like, wait, wait, wait, wait, wait, wait.

00:32:09.580 --> 00:32:10.080
What is it?

00:32:10.080 --> 00:32:11.080
Like, it's 15 milliseconds.

00:32:11.080 --> 00:32:11.900
What are you talking about?

00:32:11.900 --> 00:32:14.940
And then there's all these other things like, well, this type of caching does this.

00:32:15.000 --> 00:32:18.620
And these images are like 1,200 pixels.

00:32:18.620 --> 00:32:23.120
But when you put them into a phone, the phone has to resize it and that makes it render more slowly and stuff.

00:32:23.120 --> 00:32:31.840
So I did actually a ton of work and now I've got it down to 95 on mobile and 99 out of 100 on its speed.

00:32:31.840 --> 00:32:32.940
Higher is better, right?

00:32:32.940 --> 00:32:35.620
So there's actually different levels, right?

00:32:35.620 --> 00:32:39.880
Like, you can get really focused in on, well, let me make the database query fast and it should be fast.

00:32:39.880 --> 00:32:43.520
But there might be bigger problems that are actually easier to solve.

00:32:43.520 --> 00:32:44.340
That's a really good point.

00:32:44.340 --> 00:32:47.460
That process that you described sounds very familiar to me.

00:32:47.460 --> 00:32:49.740
Did you put something into PageSpeed Insight?

00:32:49.740 --> 00:32:51.400
You're like, I thought this was good.

00:32:51.400 --> 00:32:52.440
What is the problem here?

00:32:52.440 --> 00:32:53.760
This is not what I expected.

00:32:53.760 --> 00:32:54.400
Yeah, exactly.

00:32:54.620 --> 00:32:59.000
And like Google Webmaster Tools start to incorporate some of that data too.

00:32:59.000 --> 00:33:01.560
So you can see like how often you're terrible.

00:33:01.560 --> 00:33:02.580
Yeah.

00:33:02.940 --> 00:33:10.600
Well, and to put a little more fire under people to like try this out, Google is starting to use that for rank.

00:33:10.600 --> 00:33:11.180
Absolutely.

00:33:11.180 --> 00:33:11.660
Right?

00:33:11.660 --> 00:33:13.400
So it's an advantage.

00:33:13.400 --> 00:33:13.940
Yeah.

00:33:13.940 --> 00:33:28.240
They're including things like on mobile, if you have an icon-based navigation menu or something, if the icons are too close together, they'll ding you because it's difficult to touch the icon you meant to, right?

00:33:28.240 --> 00:33:31.440
Especially for people with mobility issues or things like that.

00:33:31.440 --> 00:33:37.040
So they're really starting to, like you said, incorporate that back into how well you're actually ranked.

00:33:37.040 --> 00:33:37.320
Yeah.

00:33:37.320 --> 00:33:37.540
Yeah.

00:33:37.540 --> 00:33:46.920
So I guess to wrap it up is like, you definitely want a fast website, fast app, whatever, but make sure you're viewing it from the user perspective.

00:33:46.920 --> 00:33:48.900
What does fast really mean?

00:33:48.900 --> 00:33:58.620
You know, if something is running quick, but another part is really slow, make sure that the way the user feels it is actually the way you want them to feel it, I guess.

00:33:58.620 --> 00:33:58.900
Yeah.

00:33:58.900 --> 00:33:59.360
Well said.

00:33:59.360 --> 00:33:59.440
Yeah.

00:33:59.440 --> 00:34:01.780
Yeah.

00:34:01.780 --> 00:34:04.420
This portion of Talk Python To Me is brought to you by Linode.

00:34:04.420 --> 00:34:13.360
Whether you're working on a personal project or managing your enterprise's infrastructure, Linode has the pricing, support, and scale that you need to take your project to the next level.

00:34:13.360 --> 00:34:28.000
With 11 data centers worldwide, including their newest data center in Sydney, Australia, enterprise-grade hardware, S3-compatible storage, and the next-generation network, Linode delivers the performance that you expect at a price that you don't.

00:34:28.000 --> 00:34:30.420
Get started on Linode.

00:34:30.420 --> 00:34:32.920
And you'll be able to take your time to have a lot of data center in the next level.

00:34:32.920 --> 00:34:33.880
And you'll be able to take your time to learn.

00:34:33.880 --> 00:34:34.920
And you'll be able to learn.

00:34:34.920 --> 00:34:34.920
And you'll be able to learn.

00:34:34.920 --> 00:34:35.880
And you'll be able to learn.

00:34:35.880 --> 00:34:35.880
And you'll be able to learn.

00:34:35.880 --> 00:34:36.880
And you'll be able to learn.

00:34:36.880 --> 00:34:36.880
And you'll be able to learn.

00:34:36.880 --> 00:34:37.880
And you'll be able to learn.

00:34:37.880 --> 00:34:38.880
And you'll be able to learn.

00:34:38.880 --> 00:34:38.880
And you'll be able to learn.

00:34:38.880 --> 00:34:39.880
And you'll be able to learn.

00:34:39.880 --> 00:34:40.880
And you'll be able to learn.

00:34:40.880 --> 00:34:41.880
And you'll be able to learn.

00:34:41.880 --> 00:34:42.880
And you'll be able to learn.

00:34:42.880 --> 00:34:43.880
And you'll be able to learn.

00:34:43.880 --> 00:34:44.880
And you'll be able to learn.

00:34:44.880 --> 00:34:45.880
And you'll be able to learn.

00:34:45.880 --> 00:34:46.880
And you'll be able to learn.

00:34:46.880 --> 00:34:47.880
And you'll be able to learn.

00:34:47.880 --> 00:35:03.200
So that was considerations as a user.

00:35:03.200 --> 00:35:05.160
Speed, integrity, resources, security.

00:35:05.160 --> 00:35:08.760
But as a developer who's working on this project.

00:35:08.760 --> 00:35:11.040
Be it a library or an application or whatever.

00:35:11.040 --> 00:35:13.660
There's a different set of considerations, right?

00:35:13.660 --> 00:35:14.020
Yeah.

00:35:14.020 --> 00:35:15.940
I mean, from the developer perspective.

00:35:15.940 --> 00:35:17.080
In the book.

00:35:17.280 --> 00:35:18.940
Sort of a famous idiom.

00:35:18.940 --> 00:35:19.920
It's like, make it work.

00:35:19.920 --> 00:35:20.660
Make it right.

00:35:20.660 --> 00:35:21.540
Make it fast.

00:35:21.540 --> 00:35:25.300
So often we get to the make it work, right?

00:35:25.300 --> 00:35:27.560
Like that's the software we often ship.

00:35:27.560 --> 00:35:30.060
Or the software we often write to start.

00:35:30.060 --> 00:35:30.280
Yeah.

00:35:30.280 --> 00:35:32.880
And I think part of the problem is also the project managers.

00:35:32.880 --> 00:35:35.260
They're like, oh, I see it working.

00:35:35.260 --> 00:35:36.740
Our sprint is almost over.

00:35:36.740 --> 00:35:38.380
You can pick another item out of the sprint.

00:35:38.380 --> 00:35:39.320
You're like, no, no, no, no.

00:35:39.320 --> 00:35:42.920
You don't understand the technical debt that is deep within this beast.

00:35:42.920 --> 00:35:44.440
I have nowhere near done.

00:35:44.440 --> 00:35:45.220
Right?

00:35:45.260 --> 00:35:51.260
I actually ended up at some point, not lying, but just when somebody says, how long is this

00:35:51.260 --> 00:35:51.680
going to take?

00:35:51.680 --> 00:35:54.820
It's not like how long to minimal viable feature.

00:35:54.820 --> 00:35:58.980
It is how long to feature plus unit test plus refactoring.

00:35:59.640 --> 00:36:03.360
That's what I'm going to tell them in the estimate it is because otherwise I'm going to hate life

00:36:03.360 --> 00:36:03.960
in six months.

00:36:03.960 --> 00:36:05.240
It's like that builds up.

00:36:05.240 --> 00:36:05.500
Yeah.

00:36:05.500 --> 00:36:11.120
In my experience, the best time to incorporate those things is as you're writing the code,

00:36:11.120 --> 00:36:16.440
because at least then you can't, you have some leverage because things aren't shipped

00:36:16.440 --> 00:36:16.660
yet.

00:36:16.660 --> 00:36:16.900
Right?

00:36:16.900 --> 00:36:17.860
Yeah.

00:36:18.140 --> 00:36:23.000
And, you know, six months from now, if you didn't address the tech debt back then,

00:36:23.000 --> 00:36:24.920
it's really often difficult.

00:36:24.920 --> 00:36:26.520
And, you know, it's understandable, right?

00:36:26.520 --> 00:36:30.660
Because at the end of the day, most of us work for some sort of business and they do have

00:36:30.660 --> 00:36:32.820
to have value to keep the lights on.

00:36:32.900 --> 00:36:38.240
And so that's why I kind of encourage people to bring this in as an iterative part of their

00:36:38.240 --> 00:36:43.840
day-to-day programming process, because again, that's kind of the best time to do it, especially

00:36:43.840 --> 00:36:49.500
because you have all the context and everything that's easy to lose after, you know, even a

00:36:49.500 --> 00:36:51.840
couple hours after leaving some code.

00:36:51.840 --> 00:36:53.600
So yeah, it's hard to get that back.

00:36:53.600 --> 00:36:58.340
It's like, it's much easier to keep your credit card paid off than it is to deal with

00:36:58.340 --> 00:36:59.280
it when it's maxed out.

00:36:59.280 --> 00:37:00.380
Yeah, exactly.

00:37:01.060 --> 00:37:04.540
I mean, you've had the same amount of money over the same period of time, but it doesn't

00:37:04.540 --> 00:37:05.120
feel the same.

00:37:05.120 --> 00:37:05.460
Yeah.

00:37:05.460 --> 00:37:11.560
And so like, as you start shipping stuff, you also then, as a developer, you've hopefully

00:37:11.560 --> 00:37:16.660
already worked on the ideas of speed and security and things like that as part of the feature

00:37:16.660 --> 00:37:17.400
you've developed.

00:37:17.400 --> 00:37:22.120
But sort of under all of that is the actual code that you wrote.

00:37:22.120 --> 00:37:28.880
If ever you need to return to it to add another feature or fix a bug or fix performance, the way

00:37:28.880 --> 00:37:32.800
you've designed your code is sort of when it becomes really important.

00:37:32.800 --> 00:37:37.800
Because I often find if I haven't put a lot of thought into some code, when I come back

00:37:37.800 --> 00:37:43.160
to it later, I'm kind of viewing it for the first time, even if I was the one who wrote

00:37:43.160 --> 00:37:43.560
it, you know?

00:37:43.560 --> 00:37:45.380
What is that saying?

00:37:45.380 --> 00:37:50.140
Like code as if a person inheriting this code in six months is a psychopath and they know

00:37:50.140 --> 00:37:51.380
where you live or something like that?

00:37:51.380 --> 00:37:51.600
Right.

00:37:51.760 --> 00:37:51.900
Yeah.

00:37:51.900 --> 00:37:55.280
I mean, but that sort of applies to you as well, because you'll forget, right?

00:37:55.280 --> 00:37:56.440
You'll forget.

00:37:56.440 --> 00:38:02.000
And it seems so clear and simple at the time when it was all perfectly balanced in your mind.

00:38:02.000 --> 00:38:05.600
But then when you haven't picked it up for a long time, you're like, why is this still

00:38:05.600 --> 00:38:06.140
not working?

00:38:06.140 --> 00:38:08.320
It's like a whack-a-mole game.

00:38:08.320 --> 00:38:09.160
Yeah.

00:38:09.960 --> 00:38:13.480
The best is when you like get blame a line and you're like, oh, I did that.

00:38:13.480 --> 00:38:15.040
This is wrong.

00:38:15.040 --> 00:38:15.940
Who wrote this?

00:38:15.940 --> 00:38:16.380
Get blame.

00:38:16.380 --> 00:38:17.320
Oh, yeah.

00:38:17.320 --> 00:38:17.820
All right.

00:38:17.820 --> 00:38:24.460
I mean, the worst to me is when I'm like trying to understand some stanza of code and I'm like,

00:38:24.460 --> 00:38:27.040
I need to go ask someone what this does.

00:38:27.040 --> 00:38:29.980
It's like, who should I ask?

00:38:29.980 --> 00:38:32.940
Well, I guess I need a time machine.

00:38:33.880 --> 00:38:34.580
Yes, exactly.

00:38:34.580 --> 00:38:39.700
If it says you wrote it, then well, you're kind of out of luck because the buck stops

00:38:39.700 --> 00:38:39.900
there.

00:38:39.900 --> 00:38:40.240
That's right.

00:38:40.240 --> 00:38:40.660
Yeah.

00:38:40.660 --> 00:38:40.860
Yeah.

00:38:40.860 --> 00:38:44.000
So I think these are all really interesting ideas.

00:38:44.000 --> 00:38:49.300
I do feel like one of the areas you should focus most on is make it easy to add new features.

00:38:49.300 --> 00:38:54.780
And some of the things that come out of that are maybe loose coupling and extensibility.

00:38:54.780 --> 00:38:59.980
Because if one little change means I have to change five other parts of the application,

00:38:59.980 --> 00:39:03.300
well, then you do have to hold a lot of those things in your mind.

00:39:03.360 --> 00:39:08.300
But if you've got a very clear structure, like, well, here's all the strategies we have

00:39:08.300 --> 00:39:09.680
for this part of our app.

00:39:09.680 --> 00:39:14.540
And at another one, you just kind of clone this thing and derive from that and register

00:39:14.540 --> 00:39:14.960
it there.

00:39:14.960 --> 00:39:18.360
And now there's another option in the UI or whatever, right?

00:39:18.360 --> 00:39:21.960
You can definitely help yourself or hurt yourself in that regard.

00:39:21.960 --> 00:39:22.280
Yeah.

00:39:22.280 --> 00:39:28.640
I mean, we often talk about software complexity as a sort of like this inherently bad thing,

00:39:28.640 --> 00:39:31.720
which I wouldn't necessarily agree is true.

00:39:31.880 --> 00:39:34.840
I mean, you can sort of argue the semantics of it, I suppose.

00:39:34.840 --> 00:39:42.960
But to me, like the danger of complexity is that people, not software and code, but people

00:39:42.960 --> 00:39:46.200
have trouble understanding it and keeping it all in their head.

00:39:46.440 --> 00:39:51.340
And they will inevitably not have the full context when they make some change.

00:39:51.340 --> 00:39:59.020
And so bugs become an inevitability and security failures become an inevitability.

00:39:59.020 --> 00:40:01.700
And that's where things really break down.

00:40:01.700 --> 00:40:07.840
So the value in kind of breaking down complexity is often for people's benefit.

00:40:07.840 --> 00:40:10.640
It's nothing about the code itself, if that makes sense.

00:40:10.860 --> 00:40:10.980
Right.

00:40:10.980 --> 00:40:11.320
Absolutely.

00:40:11.320 --> 00:40:16.740
And with the right design, you can control how much of that complexity has to be cached

00:40:16.740 --> 00:40:17.420
in your brain.

00:40:17.420 --> 00:40:17.800
Yeah.

00:40:17.800 --> 00:40:18.020
Right.

00:40:18.020 --> 00:40:21.840
Like the software may be super complex, but you just got to work with this little part.

00:40:21.840 --> 00:40:25.560
And you know, if I'm working this part, it interacts with this other thing through this

00:40:25.560 --> 00:40:26.100
clear way.

00:40:26.100 --> 00:40:29.180
And long as I have that in my mind, I can't mess up the rest of it.

00:40:29.180 --> 00:40:34.360
Or you design it poorly and you change it 10 places because somebody's hard coded a string

00:40:34.360 --> 00:40:35.820
duplicated in four places.

00:40:35.820 --> 00:40:36.620
That means something.

00:40:36.620 --> 00:40:40.160
And now you better not forget that fourth place or you're, you know, in trouble.

00:40:40.160 --> 00:40:40.580
Yeah.

00:40:40.580 --> 00:40:47.140
And so I think new people often pretty readily understand the value of writing a function,

00:40:47.140 --> 00:40:47.440
right?

00:40:47.440 --> 00:40:50.220
Like here, you need this six times.

00:40:50.220 --> 00:40:53.300
And instead of writing it six times, you can write it one time.

00:40:53.300 --> 00:40:55.800
And so they get the value of that kind of statement.

00:40:55.800 --> 00:41:03.080
And then this book kind of tries to bring that concept along to layers of abstraction and encapsulation

00:41:03.080 --> 00:41:08.220
and things as concepts that you can further use to kind of get that same benefit at a larger

00:41:08.220 --> 00:41:10.120
scale on more complex systems, right?

00:41:10.120 --> 00:41:11.020
Yeah, that's a good point.

00:41:11.020 --> 00:41:15.820
Obviously, functions are probably the lowest level that people generally have that thought

00:41:15.820 --> 00:41:16.340
process.

00:41:16.340 --> 00:41:21.840
But yeah, you have a whole section where you talk about separation of concerns and talk about

00:41:21.840 --> 00:41:25.660
functions, but there's also classes and there's modules and there's packages.

00:41:25.660 --> 00:41:33.300
And probably the whole step from different modules, I feel like not everyone, but there's a lot of

00:41:33.300 --> 00:41:38.920
folks in the Python space that are hesitant to have many files that make up their application.

00:41:38.920 --> 00:41:43.840
They'd prefer to have just one like 2000 line file, even if it's got a bunch of functions and

00:41:43.840 --> 00:41:44.480
classes in it.

00:41:44.480 --> 00:41:48.240
And I don't know, there's just this reticence to do that.

00:41:48.480 --> 00:41:55.620
So certainly focusing on modules and then even maybe packages for broader reuse makes a lot

00:41:55.620 --> 00:41:55.960
of sense.

00:41:55.960 --> 00:41:56.280
Yeah.

00:41:56.280 --> 00:41:59.300
And I think it's easy to go crazy with those as well.

00:41:59.300 --> 00:42:04.980
You could go to the other extreme and have like one function per module and have a thousand

00:42:04.980 --> 00:42:05.800
modules, right?

00:42:06.160 --> 00:42:10.740
Again, it's kind of this balance that you have to strike and it's whatever.

00:42:10.740 --> 00:42:19.760
At the end of the day, it's always like the goal is always whatever helps people understand what they need to

00:42:19.760 --> 00:42:23.380
understand when they need to understand it and no more, no less.

00:42:23.380 --> 00:42:23.840
Right.

00:42:23.880 --> 00:42:30.020
If I could say group five actions and a few pieces of data into a module, and then if all

00:42:30.020 --> 00:42:34.420
the people have to think about is I use this module, it solves this problem.

00:42:34.420 --> 00:42:35.980
It takes this input.

00:42:35.980 --> 00:42:37.500
It has this output, right?

00:42:37.500 --> 00:42:41.080
They no longer have to worry about the details or what changes there or anything.

00:42:41.080 --> 00:42:46.340
And while that's useful on one level, if you can break your whole way of thinking your program

00:42:46.340 --> 00:42:51.040
about that, you can just think at a different level and the building blocks become much more

00:42:51.040 --> 00:42:55.120
easy to think about how you position them and how you use them and so on.

00:42:55.120 --> 00:43:01.160
And I think changing the way people think about problems is a really important part of this

00:43:01.160 --> 00:43:03.820
separation of concerns and this design thinking.

00:43:03.820 --> 00:43:11.340
If you can change the building blocks as people perceive it to be large and clear rather than many,

00:43:11.340 --> 00:43:12.880
many small pieces, that's huge.

00:43:12.880 --> 00:43:19.080
Even through the course of this book, my sense of that concept has definitely grown.

00:43:19.080 --> 00:43:26.100
It's very easy to think of the value of refactoring or pulling out functions and things as strictly

00:43:26.100 --> 00:43:28.020
for reuse purposes.

00:43:28.020 --> 00:43:29.600
Or testing purposes or something.

00:43:29.600 --> 00:43:29.840
Yeah.

00:43:29.840 --> 00:43:30.340
Yeah.

00:43:30.340 --> 00:43:36.820
And so I've come to kind of feel that instead the real value definitely is that sort of cognitive

00:43:36.820 --> 00:43:38.100
load aspect.

00:43:38.100 --> 00:43:38.500
Yeah.

00:43:38.500 --> 00:43:41.900
I find the similar value with design patterns.

00:43:42.460 --> 00:43:48.560
If instead of thinking of these 10 lines of code, I can think of it as a strategy or a

00:43:48.560 --> 00:43:49.900
something else, right?

00:43:49.900 --> 00:43:54.020
It's even though design patterns are not used that often in the Python space, it's just a

00:43:54.020 --> 00:43:54.680
little bit simpler.

00:43:54.680 --> 00:44:00.060
So many of the design patterns are about solving the inflexibility of static languages.

00:44:00.060 --> 00:44:04.840
And so you don't have to really think about them as much, but there's certainly many cases

00:44:04.840 --> 00:44:07.720
where design patterns are super valuable.

00:44:07.940 --> 00:44:13.200
You know, even just things like passing a Lambda function to a list to sort it rather than

00:44:13.200 --> 00:44:15.440
getting in there and trying to deal with it yourself or whatever.

00:44:15.440 --> 00:44:16.420
It's pretty nice.

00:44:16.420 --> 00:44:20.180
My experience is that it just takes a lot of trial and error to get there.

00:44:20.180 --> 00:44:20.520
I don't know.

00:44:20.520 --> 00:44:24.960
I think there's a lot of design patterns applied from things like Java and C++ and C# that

00:44:24.960 --> 00:44:26.260
are just, they just don't belong.

00:44:26.260 --> 00:44:26.960
Right?

00:44:26.960 --> 00:44:31.140
Like really complicated singleton patterns where, you know what, that could just be a global

00:44:31.140 --> 00:44:32.080
variable in a module.

00:44:32.380 --> 00:44:32.600
All right.

00:44:32.600 --> 00:44:33.160
What's next?

00:44:33.160 --> 00:44:34.140
You know what I mean?

00:44:34.140 --> 00:44:34.500
Yep.

00:44:34.500 --> 00:44:35.640
It's the same thing.

00:44:35.640 --> 00:44:36.480
Yeah.

00:44:36.480 --> 00:44:42.460
And so I kind of, in the book, I deliberately kind of skirt around this idea of design patterns

00:44:42.460 --> 00:44:43.060
explicitly.

00:44:43.060 --> 00:44:48.960
I do kind of mention it at the end as something to learn more about for sure.

00:44:48.960 --> 00:44:55.220
But I think like the value they provide is taking some concept and naming it.

00:44:55.220 --> 00:44:59.660
Like once you have a name for a thing and everyone agrees what that name is, like you

00:44:59.660 --> 00:45:03.820
can start to have conversations about it and whether it's the right thing or the wrong thing.

00:45:03.820 --> 00:45:04.140
Right.

00:45:04.140 --> 00:45:09.080
And it has, it has clear trade-offs, you know, well, like for singleton, it has the trade-off

00:45:09.080 --> 00:45:13.500
that you have shared data and it could be really tricky to test it or other things, but it also

00:45:13.500 --> 00:45:14.620
is really clear how you use it.

00:45:14.620 --> 00:45:20.400
And so I think it's not just the name, it's that the name plus known trade-off, like these

00:45:20.400 --> 00:45:21.480
are the positives.

00:45:21.480 --> 00:45:23.160
These are the pros and these are the cons.

00:45:23.160 --> 00:45:24.360
Do we use that here?

00:45:24.360 --> 00:45:26.680
Like that's really valuable to bring in quickly.

00:45:26.680 --> 00:45:27.000
Yeah.

00:45:27.000 --> 00:45:32.060
And so like, if you didn't have a name for that, you couldn't even start to apply those

00:45:32.060 --> 00:45:33.040
traits and trade-offs.

00:45:33.040 --> 00:45:33.300
Right.

00:45:33.300 --> 00:45:38.640
So even if you aren't using design patterns per se in your code, it's good to at least

00:45:38.640 --> 00:45:39.500
understand.

00:45:39.500 --> 00:45:42.300
I mean, there will be patterns of some kind, right?

00:45:42.300 --> 00:45:44.940
Whether they're design patterns that have a name or not.

00:45:44.940 --> 00:45:45.260
Right.

00:45:45.260 --> 00:45:45.540
Right.

00:45:45.540 --> 00:45:48.240
Are they organic or are they like well-known ones?

00:45:48.240 --> 00:45:48.600
Yeah.

00:45:48.600 --> 00:45:48.880
Right.

00:45:48.880 --> 00:45:54.000
So they give you the name just gives you kind of the hook around which you can, you can

00:45:54.000 --> 00:45:54.600
explore more.

00:45:54.600 --> 00:45:54.860
Yeah.

00:45:54.860 --> 00:45:55.200
Yeah.

00:45:55.200 --> 00:45:55.940
The nomenclature.

00:45:55.940 --> 00:45:56.380
That's cool.

00:45:56.380 --> 00:45:56.640
Yeah.

00:45:56.640 --> 00:45:56.920
Yeah.

00:45:56.920 --> 00:46:00.600
So another thing you talk about in the book is designing for performance.

00:46:00.600 --> 00:46:03.040
Do you want to touch on some of the highlights from that?

00:46:03.040 --> 00:46:03.380
Yeah.

00:46:03.380 --> 00:46:08.820
I think that goes back to what you said earlier about using, knowing and using the right data

00:46:08.820 --> 00:46:10.340
types for jobs, right?

00:46:10.340 --> 00:46:10.380
Right.

00:46:10.380 --> 00:46:18.360
And understanding a little bit about complexity and about how to do things as iterative chunks

00:46:18.360 --> 00:46:23.360
of work rather than trying to read, you know, large files into memory and things like this.

00:46:23.600 --> 00:46:29.420
That in part is where you do become so-called more professional in a language at least.

00:46:29.420 --> 00:46:29.860
Yeah.

00:46:29.860 --> 00:46:35.600
Is when you, I think, have a good handle on those data types and when they're useful or expensive.

00:46:35.840 --> 00:46:41.460
You know, I think there's a lot of people who in the industry these days who are just kind

00:46:41.460 --> 00:46:47.800
of, they don't know how to address this kind of broader conversation in hiring people or

00:46:47.800 --> 00:46:49.220
assessing skills.

00:46:49.220 --> 00:46:51.780
And they kind of fall back to just testing algorithms.

00:46:51.780 --> 00:46:55.880
And, you know, a lot of the technical interviews seem to be like, well, implement quick sort

00:46:55.880 --> 00:46:57.020
on a whiteboard.

00:46:57.020 --> 00:46:57.840
Like, you know what?

00:46:57.840 --> 00:47:00.380
Nobody needs to implement quick sort on a whiteboard.

00:47:00.380 --> 00:47:07.040
But one thing I do think really is an important skill and it's an indicator of how effective you're

00:47:07.040 --> 00:47:10.220
going to be is, do you know what a dictionary is?

00:47:10.220 --> 00:47:11.280
Do you want a set is?

00:47:11.280 --> 00:47:12.240
Do you want a list is?

00:47:12.240 --> 00:47:14.640
Do you know when to use a dictionary over a set?

00:47:14.640 --> 00:47:16.840
When should I use a list over a dictionary?

00:47:16.840 --> 00:47:21.680
Like those types of things can just dramatically change the complexity of the code you got to

00:47:21.680 --> 00:47:25.380
write, the speed that you write it in or speed that it runs in, maybe both.

00:47:25.380 --> 00:47:31.480
But those seem like these data, these simple common data structures seem just so valuable.

00:47:31.480 --> 00:47:31.860
Yeah.

00:47:31.860 --> 00:47:36.140
And I think that's a thing you can translate to most any language, right?

00:47:36.140 --> 00:47:38.360
You can carry that with you wherever you go.

00:47:38.360 --> 00:47:43.860
So you just, most times if you have a background in one language with those in another language,

00:47:43.860 --> 00:47:46.520
it's really just learning the syntax to produce those.

00:47:46.520 --> 00:47:50.900
And so, I mean, sometimes they vary names, whether it's a hash or a map or a dictionary,

00:47:50.900 --> 00:47:54.020
that kind of thing, but largely, largely the same.

00:47:54.020 --> 00:47:58.300
So, yeah, I definitely remember an experience where we were storing some data in a list and

00:47:58.300 --> 00:48:00.260
we had to look up some feature about it.

00:48:00.260 --> 00:48:04.600
So we would iterate through the list and then go find it and then work with it.

00:48:04.600 --> 00:48:06.940
And that was happening over and over and over.

00:48:07.500 --> 00:48:10.700
And the code was supposed to be something kind of like real time.

00:48:10.700 --> 00:48:12.740
And it was just too slow.

00:48:12.740 --> 00:48:14.900
The other thing you talk about in there is profiling.

00:48:14.900 --> 00:48:21.400
So I actually threw into a profiler and I found, oh my gosh, it's spending 80% of its time in

00:48:21.400 --> 00:48:23.120
this list finding the item.

00:48:23.120 --> 00:48:24.160
80%.

00:48:24.160 --> 00:48:25.420
It was a huge complicated thing.

00:48:25.420 --> 00:48:29.240
80% was one line trying to find the item in the list to go do something with it.

00:48:29.340 --> 00:48:34.140
And I switched it to a dictionary and that 80% went to like 1% or something.

00:48:34.140 --> 00:48:35.280
Because you know what?

00:48:35.280 --> 00:48:39.180
Dictionaries are awesome looking up by feature and getting the real thing back.

00:48:39.180 --> 00:48:39.940
Right?

00:48:39.940 --> 00:48:44.060
And it's just like, ever since that, I'm just like, oh boy, I'm going to pay so much better

00:48:44.060 --> 00:48:45.800
attention to data structures.

00:48:45.800 --> 00:48:49.900
I think that was 20 years ago or something, but it really still stuck with me because, wow.

00:48:49.900 --> 00:48:50.280
Yeah.

00:48:50.280 --> 00:48:50.580
Yeah.

00:48:50.580 --> 00:48:51.580
It's pretty interesting.

00:48:51.580 --> 00:48:57.140
I emphasize the benefits, I guess, of profiling in the book, because I do think the situation

00:48:57.140 --> 00:49:02.720
you describe is sometimes difficult to find, even if you're familiar with your code.

00:49:02.720 --> 00:49:07.760
And certainly as someone maybe less familiar with data types and things like that, it would

00:49:07.760 --> 00:49:10.860
sort of be a needle in the haystack kind of search.

00:49:10.860 --> 00:49:12.740
And so profiling really gives you that.

00:49:12.740 --> 00:49:17.020
People are really bad at estimating what, if you show them code, like where is this slow?

00:49:17.020 --> 00:49:20.560
Even if you're pretty experienced, you could still get it quite wrong.

00:49:20.740 --> 00:49:20.900
Yeah.

00:49:20.900 --> 00:49:25.300
We build up these very subjective views of these things in our minds, I think.

00:49:25.300 --> 00:49:29.500
And the profiler is a way to kind of strip away all of that.

00:49:29.500 --> 00:49:35.200
And it's nice too, because it's much easier to take feedback from a computer, I find.

00:49:35.200 --> 00:49:36.300
That's right.

00:49:36.300 --> 00:49:38.320
It removes a lot of the guesswork.

00:49:38.320 --> 00:49:45.620
And so I emphasize definitely shoot for, always profile and gather some kind of evidence for

00:49:45.620 --> 00:49:47.940
your changes that are performance related, at least.

00:49:48.340 --> 00:49:52.900
And as you're changing things and looking at the profiling data, shoot for things that are

00:49:52.900 --> 00:49:58.560
like order of magnitude changes and not just beating it with a hammer bit by bit until

00:49:58.560 --> 00:50:00.620
it gets roughly where you want, right?

00:50:00.620 --> 00:50:02.240
Yeah.

00:50:02.240 --> 00:50:05.840
Because there's certainly different things that you can do.

00:50:05.840 --> 00:50:10.560
And knowing, I guess the first thing is, if you've got, let's say a thousand lines of code

00:50:10.560 --> 00:50:15.880
and you look at it and you say, I think this five lines of this function is where it's slow.

00:50:15.880 --> 00:50:21.020
If it turns out that that's only 2% of the time, it doesn't matter if you can make it infinitely

00:50:21.020 --> 00:50:21.600
faster.

00:50:21.600 --> 00:50:24.480
You're only going to make it 2% faster, right?

00:50:24.920 --> 00:50:26.200
That's the upper bound.

00:50:26.200 --> 00:50:29.200
If you can make it go to zero, that's as fast, that's as good as it gets.

00:50:29.200 --> 00:50:34.080
So knowing where to put that energy, that's what I find the value of the profiling is like,

00:50:34.080 --> 00:50:39.980
maybe not saying this algorithm is bad or whatever, but just like, we should focus here because

00:50:39.980 --> 00:50:42.060
80% of the time is on this little bit.

00:50:42.680 --> 00:50:44.460
And I don't know what the fix is.

00:50:44.460 --> 00:50:46.040
Maybe it's to use a different library.

00:50:46.040 --> 00:50:48.580
Maybe it's to rewrite this part in Cython.

00:50:48.580 --> 00:50:53.640
Maybe it's to just use a different data structure, but this is where the energy and effort should

00:50:53.640 --> 00:50:56.120
go because we can optimize the rest all day.

00:50:56.120 --> 00:50:58.800
Maybe introduce a bunch of bugs and it won't get much faster.

00:50:58.800 --> 00:50:59.980
Yeah.

00:50:59.980 --> 00:51:06.040
It's often true too, that trying to eek performance out of something necessarily makes the code

00:51:06.040 --> 00:51:07.580
more difficult, right?

00:51:07.580 --> 00:51:12.200
Because you are either going closer to the middle or doing these kinds of

00:51:12.200 --> 00:51:15.980
hoop jumping that doesn't really result in clear code.

00:51:15.980 --> 00:51:16.480
Right.

00:51:16.480 --> 00:51:20.020
You're like, well, this library that we could just call and get the answer to, well, now

00:51:20.020 --> 00:51:22.700
we've got to rewrite it because we need to have more control over it.

00:51:22.700 --> 00:51:27.360
But now, you know, all of a sudden, what's what one or two lines is now many, many lines

00:51:27.360 --> 00:51:29.020
that is your baby to take care of.

00:51:29.020 --> 00:51:29.160
Right.

00:51:29.160 --> 00:51:29.520
Yeah.

00:51:29.520 --> 00:51:30.000
Yeah.

00:51:30.000 --> 00:51:30.620
Cool.

00:51:30.620 --> 00:51:31.700
So definitely profiling.

00:51:31.700 --> 00:51:32.600
I think it's really good.

00:51:32.600 --> 00:51:36.840
Another thing to think about, I guess, is test data versus real data.

00:51:36.840 --> 00:51:42.180
You know, how many times have there been website launches where, oh, it seemed like

00:51:42.180 --> 00:51:47.340
it was fine, but now it's down because there are actually more than, you know, 10 rows in

00:51:47.340 --> 00:51:49.440
the database and they forgot to put indexes.

00:51:49.440 --> 00:51:54.100
I don't know how people can forget to put indexes because they're like magic to databases.

00:51:54.100 --> 00:51:55.240
They're like speed magic.

00:51:55.240 --> 00:51:58.780
You can just give them and it's like a thousand times faster.

00:51:58.780 --> 00:52:01.100
Like, so as soon as you see it slow, put an index on it.

00:52:01.100 --> 00:52:03.140
Now, now let's go worry about what's next.

00:52:03.140 --> 00:52:03.360
Right.

00:52:03.420 --> 00:52:05.780
But still, this happens all the time.

00:52:05.780 --> 00:52:06.100
Yeah.

00:52:06.100 --> 00:52:07.180
And I don't know.

00:52:07.180 --> 00:52:12.260
Indexes are sort of notoriously, notoriously hard, even when you are thinking about them.

00:52:12.260 --> 00:52:15.800
You can have situations where you're like, you know, it did this index didn't cover it

00:52:15.800 --> 00:52:17.460
right because we were sorting this way.

00:52:17.460 --> 00:52:19.000
It actually used a different index.

00:52:19.000 --> 00:52:19.880
We had to give it a hint.

00:52:19.880 --> 00:52:21.120
I'm not talking about that.

00:52:21.120 --> 00:52:25.060
I'm talking about we've got a million rows that we're doing a query with no index, which

00:52:25.060 --> 00:52:27.360
I think happens more than people want to admit, you know?

00:52:27.460 --> 00:52:27.980
Yeah, definitely.

00:52:27.980 --> 00:52:34.080
And I guess to the point about real data also sort of at the, at the product and user

00:52:34.080 --> 00:52:39.340
and social level, there's a bunch of videos where people of color can't use a product because

00:52:39.340 --> 00:52:42.080
they didn't test it on people with that.

00:52:42.080 --> 00:52:46.600
Like those automatic hand dispenser, sand soap dispenser things and all sorts of stuff.

00:52:46.600 --> 00:52:46.960
Yeah, exactly.

00:52:46.960 --> 00:52:47.440
It's fresh.

00:52:47.440 --> 00:52:48.900
It's got to be super frustrating.

00:52:48.900 --> 00:52:50.240
Those things already frustrate me.

00:52:50.240 --> 00:52:51.040
And yeah.

00:52:51.040 --> 00:52:53.300
So I mean, I'm not only, yeah.

00:52:53.300 --> 00:52:53.400
Yeah.

00:52:53.400 --> 00:52:59.480
It not only like manifests as a cost to you as the business, but absolutely like impacts

00:52:59.480 --> 00:53:01.700
people in the real world in very negative ways.

00:53:01.700 --> 00:53:02.020
Yeah.

00:53:02.020 --> 00:53:05.920
Well, I can speak to a hardware testing of that sort.

00:53:05.920 --> 00:53:10.400
But one thing that I've, I found Bob Belderbos introduced me to this is this place called

00:53:10.400 --> 00:53:11.700
Mockaroo.

00:53:11.700 --> 00:53:13.000
You know Mockaroo?

00:53:13.000 --> 00:53:13.820
I'm not familiar.

00:53:13.820 --> 00:53:14.520
Mockaroo.

00:53:14.520 --> 00:53:16.880
Make sure I spell it right for people.

00:53:16.880 --> 00:53:17.500
Yeah.

00:53:17.500 --> 00:53:19.320
Mock A-R-O-O.

00:53:19.320 --> 00:53:19.920
Yeah.

00:53:19.920 --> 00:53:23.420
And what you can do is they have all these different types of data and you can say,

00:53:23.420 --> 00:53:25.280
go generate me certain amounts.

00:53:25.280 --> 00:53:30.620
So you can ask for like first name, last name, email, but you can also thing, ask for all different

00:53:30.620 --> 00:53:31.480
kinds of stuff.

00:53:31.480 --> 00:53:32.840
There's so many.

00:53:32.840 --> 00:53:35.820
So I could ask for like cars, VIN numbers.

00:53:35.820 --> 00:53:39.000
I could ask for, let's see, for commerce.

00:53:39.000 --> 00:53:45.740
I could ask for currency codes or stock names or, you know, and it'll generate as many of

00:53:45.740 --> 00:53:46.320
those as you want.

00:53:46.320 --> 00:53:48.940
I want a million of those in a JSON format like this.

00:53:49.080 --> 00:53:49.600
Give it to me.

00:53:49.600 --> 00:53:51.660
And it looks real and it feels real.

00:53:51.660 --> 00:53:56.220
So, you know, you can definitely generate some quick data with Mockaroo and it's, it's pretty

00:53:56.220 --> 00:53:56.500
awesome.

00:53:56.500 --> 00:53:56.780
Yeah.

00:53:56.780 --> 00:53:57.580
That is really cool.

00:53:57.580 --> 00:54:03.060
There's a couple of plugins I know for Django that do something similar meant exactly for

00:54:03.060 --> 00:54:04.040
that, that same reason.

00:54:04.040 --> 00:54:10.020
Like testing, testing often is people espouse like testing in isolation and testing just

00:54:10.020 --> 00:54:11.900
the, just this part or that part.

00:54:11.900 --> 00:54:17.060
And there's like unit testing and integration testing and all sorts of varieties of that stuff.

00:54:17.160 --> 00:54:23.800
But I don't think this point is talked about enough, which is like test it in isolation,

00:54:23.800 --> 00:54:26.800
but also use values that make sense.

00:54:26.800 --> 00:54:27.160
Right.

00:54:27.160 --> 00:54:29.920
Maybe don't just test with a first name and a last name.

00:54:29.920 --> 00:54:34.080
Some names, it's like a three part name or something like that, you know?

00:54:34.080 --> 00:54:38.420
And if you're splitting on the space, that's probably not going to come out.

00:54:38.420 --> 00:54:38.660
Okay.

00:54:38.660 --> 00:54:38.940
Right.

00:54:38.940 --> 00:54:39.180
Yep.

00:54:39.240 --> 00:54:40.600
So yeah, yeah, definitely testing.

00:54:40.600 --> 00:54:41.020
Yeah.

00:54:41.020 --> 00:54:46.900
Or if you, you're always using like foo, the string as your test variable, like maybe you

00:54:46.900 --> 00:54:51.900
won't uncover your bugs that are throughout your code when there's Unicode characters and

00:54:51.900 --> 00:54:52.380
things like that.

00:54:52.380 --> 00:54:52.600
Yeah.

00:54:52.600 --> 00:54:52.980
True.

00:54:52.980 --> 00:54:55.580
Test with emojis, test with emojis as well, I guess.

00:54:55.580 --> 00:54:58.920
That's pretty awesome.

00:54:59.380 --> 00:55:03.060
So we're kind of getting near the end of our time to talk about all this.

00:55:03.060 --> 00:55:07.680
Let me throw out a quick rule of thumb that I use a lot of times around this.

00:55:07.680 --> 00:55:09.240
And I just want to hear your thoughts on it.

00:55:09.240 --> 00:55:10.340
You can disagree with it if you want.

00:55:10.340 --> 00:55:16.840
But one of the rules of thumbs that I have is that if a function or a class or some part of

00:55:16.840 --> 00:55:19.140
code needs a comment, it's probably broken.

00:55:19.140 --> 00:55:19.460
Yeah.

00:55:19.460 --> 00:55:20.240
That's interesting.

00:55:20.500 --> 00:55:21.820
I'm not talking to doc string, right?

00:55:21.820 --> 00:55:23.760
Like if you want to document it, that's a different thing.

00:55:23.760 --> 00:55:28.500
But if you're like, well, we got to do this weird thing because, or the function is named

00:55:28.500 --> 00:55:32.320
so badly, there's a comment saying what the function name should have really just been,

00:55:32.320 --> 00:55:33.560
you know, something like that.

00:55:33.560 --> 00:55:33.800
Yep.

00:55:33.800 --> 00:55:40.900
So I would agree that like comments that are redundant to what the code around it could

00:55:40.900 --> 00:55:44.340
have been or could have said are definitely an anti-pattern.

00:55:44.340 --> 00:55:51.060
I don't mind when a comment says the why of the code.

00:55:51.060 --> 00:55:55.920
So like code often expresses simply the how or the what.

00:55:55.920 --> 00:56:01.760
But if you can't get all of that just by your variable names or your class names and stuff

00:56:01.760 --> 00:56:04.920
like comments, giving you that extra context are okay.

00:56:04.920 --> 00:56:05.220
Yeah.

00:56:05.220 --> 00:56:09.660
Maybe you're calling some API and it returns a dictionary and you're like, this looks weird,

00:56:09.660 --> 00:56:14.080
but we have to do this thing because sometimes it does this and sometimes we don't control it.

00:56:14.080 --> 00:56:18.220
We got to live with it, but just please leave this check here because I know it looks like it's

00:56:18.220 --> 00:56:22.360
not necessary, but on the first month, first day of the month, it always goes weird.

00:56:22.360 --> 00:56:23.660
So we're going to just need it.

00:56:23.660 --> 00:56:24.340
Right.

00:56:24.340 --> 00:56:25.200
That's cool.

00:56:25.200 --> 00:56:29.940
Postal's law is like this idea that you should be liberal in what you accept and conservative

00:56:29.940 --> 00:56:30.840
in what you send.

00:56:30.840 --> 00:56:31.100
Right.

00:56:31.100 --> 00:56:31.460
Right.

00:56:31.460 --> 00:56:36.000
Sometimes being liberal in what you accept means exactly that.

00:56:36.000 --> 00:56:40.840
We have this API we have no control over, but we want to use it because it provides us other

00:56:40.840 --> 00:56:41.280
value.

00:56:42.060 --> 00:56:46.680
And so we're going to accept this reality and we wrote this code to deal with it.

00:56:46.680 --> 00:56:48.160
And here's the situation.

00:56:48.160 --> 00:56:48.560
Yeah.

00:56:48.560 --> 00:56:48.920
Yeah.

00:56:48.920 --> 00:56:49.400
Pretty cool.

00:56:49.400 --> 00:56:51.340
And those comments make perfect sense, right?

00:56:51.340 --> 00:56:52.480
Like, please don't take this out.

00:56:52.480 --> 00:56:54.740
It's I'm going to hide that away in a function.

00:56:54.740 --> 00:56:58.000
So hopefully you don't look at it, but if you got to get in there, here's what we're doing.

00:56:58.000 --> 00:56:59.320
So look out.

00:56:59.320 --> 00:56:59.560
Yeah.

00:56:59.560 --> 00:56:59.820
Yeah.

00:56:59.820 --> 00:57:00.300
Pretty cool.

00:57:00.300 --> 00:57:00.900
All right.

00:57:00.900 --> 00:57:03.720
Well, it's been really fun to think about these design concepts.

00:57:04.200 --> 00:57:08.620
And I think a lot of what we talked about is actually pretty broadly applicable, although

00:57:08.620 --> 00:57:11.940
we did talk about some stuff that very much is Pythonic, right?

00:57:11.940 --> 00:57:14.420
We talked about comprehensions and whatnot a little bit.

00:57:14.420 --> 00:57:14.940
Yeah.

00:57:14.940 --> 00:57:15.900
So it's great.

00:57:15.900 --> 00:57:16.240
Yeah.

00:57:16.260 --> 00:57:21.600
I think this major chunk of the book, I would say, is very translatable to other languages.

00:57:21.600 --> 00:57:26.780
I use Python as sort of the vehicle of teaching the concepts, if you will.

00:57:26.780 --> 00:57:27.040
Yeah.

00:57:27.040 --> 00:57:27.380
Yeah.

00:57:27.380 --> 00:57:27.560
Sure.

00:57:27.560 --> 00:57:29.060
Not that people shouldn't use Python.

00:57:29.060 --> 00:57:30.720
It's an awesome language, right?

00:57:30.720 --> 00:57:35.060
But, you know, even I think it's just, these are just, I guess the point I'm trying to

00:57:35.060 --> 00:57:38.920
make is these ideas transcend individual languages.

00:57:38.920 --> 00:57:45.620
Knowing this kind of stuff will help you across if now you're a Python developer and later you're

00:57:45.620 --> 00:57:49.300
going to go learn C#, or you're going to learn Java, or you're going to do C++, knowing

00:57:49.300 --> 00:57:51.720
a lot of the stuff is really applicable.

00:57:51.720 --> 00:57:52.520
Yeah, absolutely.

00:57:52.520 --> 00:57:55.700
And I think that's also maybe one of the pro things, right?

00:57:55.700 --> 00:57:59.920
When you're a beginner, you're very much focused on the syntax of the language and just making

00:57:59.920 --> 00:58:05.540
the tools do their thing and not worried about these higher order general ways of thinking.

00:58:05.540 --> 00:58:08.940
So that's probably another little indicator there, like we started at the beginning.

00:58:08.940 --> 00:58:09.260
Yeah.

00:58:09.260 --> 00:58:14.280
And I think sort of parallel to design patterns, there's just these patterns of languages and

00:58:14.280 --> 00:58:18.860
patterns of ways of thinking about systems that only come sort of with time.

00:58:18.860 --> 00:58:23.160
And as you learn the names for those concepts, you can, again, have those conversations.

00:58:23.160 --> 00:58:24.320
Yeah, absolutely.

00:58:24.320 --> 00:58:25.200
All right.

00:58:25.200 --> 00:58:25.680
Cool.

00:58:25.680 --> 00:58:29.560
Well, let me ask you the two last questions before you get out of here.

00:58:29.560 --> 00:58:32.360
If you're going to write some Python code, what editor do you use?

00:58:32.360 --> 00:58:37.360
So I would say I split my time fairly evenly between PyCharm and VI.

00:58:37.360 --> 00:58:37.900
Okay.

00:58:37.900 --> 00:58:42.660
I have, I guess when I'm working in a larger context and I need to be flipping between a lot

00:58:42.660 --> 00:58:47.800
of files and jumping through code a little more often, or if I want to attach a debugger,

00:58:47.800 --> 00:58:49.080
I usually will use PyCharm.

00:58:49.080 --> 00:58:55.180
And then if I'm just doing some quick things, I prefer VI because I like moving around the text

00:58:55.180 --> 00:58:55.680
that way.

00:58:55.680 --> 00:58:59.620
There are like VI bindings for PyCharm and I might be happy with that.

00:58:59.620 --> 00:59:00.920
Can you bring those worlds together?

00:59:00.920 --> 00:59:01.860
Yeah.

00:59:01.860 --> 00:59:02.260
I don't know.

00:59:02.260 --> 00:59:03.200
I don't know.

00:59:03.200 --> 00:59:07.160
You know, speaking of debuggers, I suspect, I don't know if you cover it anywhere in the

00:59:07.160 --> 00:59:07.360
book.

00:59:07.400 --> 00:59:07.900
I don't recall.

00:59:07.900 --> 00:59:12.960
But using like consider a debugger is probably not a bad piece of recommendation.

00:59:12.960 --> 00:59:13.320
Yeah.

00:59:13.320 --> 00:59:14.920
That's a really great advice.

00:59:14.920 --> 00:59:20.820
If you can sort of understand what it's doing and why you would want to step through your

00:59:20.820 --> 00:59:22.020
individual lines of code.

00:59:22.020 --> 00:59:24.780
Like it's a great way to solve problems.

00:59:25.120 --> 00:59:30.980
There is a tendency for some people to use it as a crutch almost to just not really think

00:59:30.980 --> 00:59:31.200
it through.

00:59:31.200 --> 00:59:33.000
It is just like, well, the debugger will show me.

00:59:33.000 --> 00:59:38.860
But I think there's a bigger tendency of people to put 20 print statements, not because it really

00:59:38.860 --> 00:59:41.700
has had some timing issue and you really have to have the print statements.

00:59:41.700 --> 00:59:45.680
It's just like, well, I'm not in a thing that debugs easily or I didn't set it up right

00:59:45.680 --> 00:59:46.300
in VS Code.

00:59:46.300 --> 00:59:50.380
So there's no button to press, even though like you could just go and set up a run configuration,

00:59:50.380 --> 00:59:51.160
whatever they call it.

00:59:51.160 --> 00:59:54.440
So yeah, I think definitely that's probably something in there as well.

00:59:54.440 --> 00:59:54.700
Yeah.

00:59:54.700 --> 00:59:58.020
And it can help you like kind of bisect where the problem is.

00:59:58.020 --> 01:00:01.800
Like if you, if you have a suspicion about where the problem is, but don't know exactly

01:00:01.800 --> 01:00:07.000
what's going wrong, picking a couple of like starting points and then slowly moving your

01:00:07.000 --> 01:00:11.580
break points until you really find like the line that was mucking things up.

01:00:12.000 --> 01:00:14.020
It is a really nice way to solve problems.

01:00:14.020 --> 01:00:16.380
It comes back to just having less in your head at once.

01:00:16.380 --> 01:00:17.700
You're like, well, it's down to these three lines.

01:00:17.700 --> 01:00:19.860
What do I have to think about for these three lines, right?

01:00:19.860 --> 01:00:20.740
Yeah, sure.

01:00:20.740 --> 01:00:21.780
Cool.

01:00:21.780 --> 01:00:26.080
And then notable PyPI package, not necessarily something super popular, but something you

01:00:26.080 --> 01:00:26.520
came across.

01:00:26.520 --> 01:00:27.840
You're like, oh, this thing was so sweet.

01:00:27.840 --> 01:00:28.740
I can't believe I found it.

01:00:28.740 --> 01:00:32.200
We've developed a couple of services in FastAPI recently.

01:00:32.200 --> 01:00:32.660
Okay.

01:00:32.660 --> 01:00:32.960
Yeah.

01:00:32.960 --> 01:00:34.600
I've heard tons of good things about FastAPI.

01:00:34.600 --> 01:00:36.560
It seems like there's a lot of momentum around it.

01:00:36.560 --> 01:00:39.260
It's really kind of a joy to work with.

01:00:39.940 --> 01:00:44.680
There's sort of some underlying packages that it uses, Starlette and things like that.

01:00:44.680 --> 01:00:47.740
But there's also some that it works in tandem with.

01:00:47.740 --> 01:00:48.780
Pedantic is one.

01:00:48.780 --> 01:00:50.420
Pedantic is really cool.

01:00:50.420 --> 01:00:50.740
Yeah.

01:00:50.740 --> 01:00:51.120
Yeah.

01:00:51.120 --> 01:00:54.360
It's like a data modeling related library and just love them all.

01:00:54.360 --> 01:00:54.800
Yeah.

01:00:54.800 --> 01:00:57.160
You can put a little pedantic constraints on it.

01:00:57.160 --> 01:00:59.160
Decorators and then decorators, I think.

01:00:59.160 --> 01:00:59.400
Right.

01:00:59.400 --> 01:01:03.080
And then it's a little bit like data classes with validators, if you will.

01:01:03.080 --> 01:01:03.800
Yes, exactly.

01:01:03.800 --> 01:01:05.000
It's, it's looks super cool.

01:01:05.080 --> 01:01:08.280
I haven't had a chance to use it, but I just really kind of got the zen of it a while ago

01:01:08.280 --> 01:01:09.080
and I want to know.

01:01:09.080 --> 01:01:09.340
Yeah.

01:01:09.340 --> 01:01:12.740
Especially if you're working in microservices and things like that.

01:01:12.740 --> 01:01:16.120
Asynchronous microservices kind of where it shines.

01:01:16.120 --> 01:01:16.500
Yeah.

01:01:16.500 --> 01:01:17.380
That's super cool.

01:01:17.380 --> 01:01:17.760
Awesome.

01:01:17.760 --> 01:01:19.340
Well, those are some good recommendations as well.

01:01:19.340 --> 01:01:19.620
All right.

01:01:19.620 --> 01:01:20.540
So final call to action.

01:01:20.540 --> 01:01:22.660
People are inspired about this design stuff.

01:01:22.660 --> 01:01:24.160
What's your advice to them?

01:01:24.160 --> 01:01:24.600
What do they do?

01:01:24.820 --> 01:01:29.220
I mean, there's a couple of other sort of seminal works that I would say to read.

01:01:29.220 --> 01:01:32.740
There's like the Gang of Four book and other things like that.

01:01:32.740 --> 01:01:36.640
If you're interested in Python, I would certainly hope you'll take a look at this book.

01:01:36.640 --> 01:01:36.880
Yeah.

01:01:36.880 --> 01:01:40.580
And I'll put your book, I'll link to your book in the show notes so people can get to it easily.

01:01:40.580 --> 01:01:40.860
Yeah.

01:01:40.860 --> 01:01:41.300
Fantastic.

01:01:41.300 --> 01:01:47.340
And I think once you get beyond that or maybe even in parallel, this idea about testing and

01:01:47.340 --> 01:01:51.120
refactoring are both super valuable, super valuable bits.

01:01:51.120 --> 01:01:54.100
So Martin Fowler has a good book about refactoring.

01:01:54.400 --> 01:01:58.480
It's got a pretty straightforward title, Refactoring from 1999.

01:01:58.480 --> 01:01:59.920
It's still totally valid though.

01:01:59.920 --> 01:02:00.580
It's a great book.

01:02:00.580 --> 01:02:00.880
Yeah.

01:02:00.880 --> 01:02:03.820
And there's Working Effectively with Legacy Code.

01:02:03.820 --> 01:02:06.960
I think Michael Feathers maybe is the name of the author.

01:02:06.960 --> 01:02:07.080
Yeah.

01:02:07.080 --> 01:02:07.720
Michael Feathers wrote that.

01:02:07.720 --> 01:02:08.940
That's a really good book.

01:02:08.940 --> 01:02:13.880
If you've got a large code base and you're like, you know, the problem I described where

01:02:13.880 --> 01:02:16.240
there's a thousand issues and we're just like, well, we're not fixing these.

01:02:16.240 --> 01:02:20.180
Like if you're in that situation, but you want to carve out a part that behaves better,

01:02:20.180 --> 01:02:21.500
his book is beautiful for that.

01:02:21.500 --> 01:02:21.720
Yep.

01:02:22.000 --> 01:02:24.700
So those are even the ones I'm reading to some degree now.

01:02:24.700 --> 01:02:25.420
So super.

01:02:25.420 --> 01:02:25.960
All right.

01:02:25.960 --> 01:02:27.260
Well, Dane, thanks for being on the show.

01:02:27.260 --> 01:02:28.760
It was really great to have this chat with you.

01:02:28.760 --> 01:02:29.040
Yeah.

01:02:29.040 --> 01:02:29.860
I really appreciate it.

01:02:29.860 --> 01:02:30.720
It was a lot of fun.

01:02:30.720 --> 01:02:30.920
Yep.

01:02:30.920 --> 01:02:31.180
You bet.

01:02:31.180 --> 01:02:31.400
Bye.

01:02:31.400 --> 01:02:31.680
Yeah.

01:02:31.680 --> 01:02:32.080
Take care.

01:02:32.080 --> 01:02:35.200
This has been another episode of Talk Python To Me.

01:02:35.200 --> 01:02:40.020
Our guest on this episode is Dane Hillard, and it's been brought to you by Tidelift and Linode.

01:02:40.020 --> 01:02:45.260
If you run an open source project, Tidelift wants to help you get paid for keeping it going

01:02:45.260 --> 01:02:45.760
strong.

01:02:45.760 --> 01:02:49.040
Just visit talkpython.fm/Tidelift.

01:02:49.040 --> 01:02:51.360
Search for your package and get started today.

01:02:51.360 --> 01:02:55.840
Start your next Python project on Linode's state-of-the-art cloud service.

01:02:56.180 --> 01:03:00.340
Just visit talkpython.fm/Linode, L-I-N-O-D-E.

01:03:00.340 --> 01:03:03.540
You'll automatically get a $20 credit when you create a new account.

01:03:03.540 --> 01:03:05.920
Want to level up your Python?

01:03:05.920 --> 01:03:10.780
If you're just getting started, try my Python Jumpstart by Building 10 Apps course.

01:03:10.780 --> 01:03:15.880
Or if you're looking for something more advanced, check out our new Async course that digs into

01:03:15.880 --> 01:03:18.960
all the different types of Async programming you can do in Python.

01:03:18.960 --> 01:03:22.900
And of course, if you're interested in more than one of these, be sure to check out our

01:03:22.900 --> 01:03:23.620
Everything Bundle.

01:03:23.620 --> 01:03:25.500
It's like a subscription that never expires.

01:03:25.500 --> 01:03:27.640
Be sure to subscribe to the show.

01:03:27.640 --> 01:03:30.060
Open your favorite podcatcher and search for Python.

01:03:30.060 --> 01:03:31.280
We should be right at the top.

01:03:31.280 --> 01:03:36.120
You can also find the iTunes feed at /itunes, the Google Play feed at /play,

01:03:36.120 --> 01:03:40.280
and the direct RSS feed at /rss on talkpython.fm.

01:03:40.280 --> 01:03:42.340
This is your host, Michael Kennedy.

01:03:42.340 --> 01:03:43.840
Thanks so much for listening.

01:03:43.840 --> 01:03:44.880
I really appreciate it.

01:03:44.880 --> 01:03:46.680
Now get out there and write some Python code.

01:03:46.680 --> 01:04:06.880
I really appreciate it.

