Rock Solid Python with Python Typing Transcripts
Chapter: Typing Guidance, Patterns, and Advice
Lecture: Types on the Boundary

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Let's say you've got a program and it does not yet have types or you're thinking about
0:06 where you want to employ types in a somewhat complicated application.
0:12 We're talking multiple files, we're talking maybe you're thinking in architectural layers, right?
0:18 Here's some of the logic of the application and here's the data access layer or the part that calls the APIs and those kinds of things.
0:26 If you reach that scale, which I think is not very big at all, but you know, more than one file, I want to start thinking about the boundaries.
0:34 So one of the really important things that typing can provide is it can make sure that
0:39 consumers of code provide the correct information, assuming that they're using the tools at all, right?
0:47 They have a proper editor of some sort, or maybe they're running my pie, or there's some kind of continuing integration.
0:52 But assuming that the consumers of some part of your application, be that a whole separate
0:59 package or just an architectural section, like a data access layer, are being consumed correctly.
1:06 And one of the real values of these architectural layers is that you can just sort of think
1:10 about, well, here's the functions I call, create new user, find this record, you know,
1:16 find me this order by this user, or you don't have to think about how that happens, what
1:20 are the connections, all the details or the types involved, you just think of these sort
1:24 of high level of extraction of, of what this data, let's keep going with this data access layer is providing to you.
1:32 And because of that, if you just can make sure as you consume those high level components
1:38 of your app, that all the type information is hanging together, well, it's a good chance
1:43 that internally, the data access layer will be consistent from types, it may or may not have type information.
1:50 But one really big value with typing is to make sure at that boundary layer, like this
1:55 is the API for this section is what you think about as the data access layer or something that that's really secured and reinforced by types.


Talk Python's Mastodon Michael Kennedy's Mastodon