Learning How to Learn: Code Libraries, SSL, and Encryption

Michael Strong walks Alana through Python libraries, imports, and the SSL module for encrypting network communication. He uses secret-code analogies to explain how encryption protects financial data, and shares learning strategies like Google and GPT for filling knowledge gaps.
Chapters
Good morning, Alana. How are you?
I'm good. How are you?
I'm well. I understand you got in late last night.
I did, did about like 1, 1 something in the morning.
But you're sufficiently well rested?
I think so. I woke up by myself at like 7 my time.
And I think I saw your mom post— it looked almost more like wrestling.
I assume it was, uh, it was still jiu-jitsu. It's just a different rule set, which might make it look like wrestling.
Okay, I think of jiu-jitsu standing up, but this, you guys are kind of rolling around on the, on the mats.
Wrestling is more standing up because jiu-jitsu, you can pull guard and there's more on ground.
Got it. OK, well, obviously, I don't know what's going on with jujitsu, so I need to learn more. Last time we talked about you finishing up the Python course and then maybe starting Harvard CS50 and that there were some concepts in the Harvard— I mean, in the Python towards the end that were difficult. Remind me, you're completely done with Python. Is that correct?
Yes.
What were the hardest concepts at the end?
Um, well, to be honest, there were a few just details, um, or different, um, functions that I didn't learn how to do. I do— I have pulled, uh, some code that my teacher gave me to run up. Um, can I share my screen?
Please do.
Oh, you have to enable screen sharing. But that has a few of the things that I couldn't understand mixed with things that I can understand. So it makes it a bit easier to decipher what it does, but I'm not entirely sure. There we go.
And this was Walaki?
Yes, Walaki gave me this code to run. Um, so I think— I guess we can start off with the imports. I know what some of them do. I mean, this one imports JSON. It's— you use it in, um, code. And then this is the import URL, urllib. And then I understand some of this. I know this is making a variable and checking if it's true or false and then doing specific things.
Mm-hmm.
Certain functions like this one where it has certain key names and certain things it does once you call those key names, I do have some trouble remembering them. I do have a helper to remind me sort of what it does. And then when we go down here, I know what try and except is. I know ifs and I know how they work. I know prints, continues, and stuff, but things like this are— have Or I, I don't know what they do.
Got it. So first of all, it's really helpful to know what you know and know what you don't know. And so it's great that you're clear on what you don't know. Have you either Googled or asked GPT for help with any of these?
I have Googled some. I don't have access to GPT right now. But I'm— I need to do that.
Maybe we— let's go from the top and see exactly where, where we need help. So first, urllib.request, I assume that's a URL library. These— do you know much about those?
I know some. I use them in different projects most of the time.
And you have a sense for what a library is?
Sort of. A library is like, um, a specific place that contains a specific amount of, um, functions that you can do, or they're all related. To be honest, um, I never understood that in depth.
Okay, no problem. Again, so you said you did understand JSON. Tell me what JSON does again.
So from what I recall, and this may not be 100% accurate, JSON is a, um, a program that, from what I remember, like, cleans up your code or does something to your code to make it do something. Um, I'm not entirely sure what that does. Here it says js equals json.loads data. So I'm assuming it has something to do with pulling data or just data.
Okay, um, and then since we're on the imports, let's look at the third one that you, you may import, SSL.
That is, um, it gives me an explanation here, but off the top of my mind, I'm not— I don't know. This module provides some more Pythonic support for SSL.
And do you know what SSL stands for?
I don't.
Okay, I'm going to start right now. I'm going to Google JSON and see what it is. First, I have, in terms of libraries, I see certain, a library of code Well, let's start there actually, because we want to have— we want to be pretty clear on what's going on when we have a code library to begin with, and then we'll understand what all of those are. And so my sense from back when I was coding was that sometimes there are pieces of code that you use over and over again, and rather than write them from scratch all the time, you can have these libraries of codes. It's sort of like when you were— if you were to write a book and you needed to kind of have the front piece that always said, this is my copyright or something like that. And the reason I give that as an example is you don't— if you were to write another book, you don't need to have an original statement of this is my copyright. You could just, as it were, call the this is my copyright library and it could just plug it in And so here I'm gonna put in chat libraries in Python. And I always like to, I always like to kind of learn bit by bit, 'cause I think if you have a clear understanding of what a library is, then the particulars make sense. So normally a library is a collection of books or is a room or place where many books are stored to be used later, right? Similarly, in the programming world, a library is a collection of pre-compiled codes that can be used later on an— on or in a program for some specific, well-defined operations. Other than compiled codes, library may contain documentation, configuration data, message templates, classes, values, etc. But I think the main thing is, what I'm getting from this is this collection of precompiled codes. Does that make sense to you?
I think so. What that means is just it has a set of hardcoded functions or pieces of code that you can use from the library.
Yeah, I mean, I expect what's happening, happening when you have the command import is import tells the computer to go to the library and grab urllib.request, urllib.parse, urllib.error, JSON, and SSL. Go grab those pieces of code and have them ready to use. Does that make sense?
Yes.
And that way you don't have to rewrite them. I bet we could look up the code for each of those. And I don't know if you know how to write those or not yet, But you could imagine, I know coders who do their own libraries. So suppose you always wanted to write all of your computers, all of your programs with something that said hello world or something like that. I expect you could write a piece of code that was hello world, and you could have a library of Alana's code library. And instead of writing the code for hello world every time, you could say import hello world, it would go grab that code and would make that happen. So then you can focus on writing the rest of your program. Does that make sense?
I think so. So libraries is sort of like functions, but that are already pre-made, and so you just call them. Is that accurate?
Exactly, exactly. And they're broader than functions because as it says, It could contain data message templates and so forth, everything you need. Here's the next statement of it, and it expands on it a little bit. A Python library is a collection of related modules. It contains bundles of code that can be used repeatedly in different programs. It makes Python programming simpler and convenient for the programmer, as we don't need to write the same code again and again for different programs. That's kind of just what I was saying, right?
Yes.
Python libraries play a very vital role in fields of machine learning, data science, data visualization, etc. I think that's just saying that I think Python libraries could be used anywhere, but a special role, or, you know, maybe, maybe it's those complicated fields. It's nice to have big libraries with lots of stuff ready to go. Yes. Let's see this. I couldn't use more, but would you say you have a pretty good sense now of kind of what a library is?
I think so.
Okay, now let's, let's do a piece of code. I'm looking, I've got a good library Python thing, which maybe SSL, or what are Which one do you want to look at first? Let's put it that way.
I think SSL.
Okay, okay. Python SSL, what does it mean? So I like to— do you like to Google for stuff?
I do.
Yeah, and I always, you know, it's interesting, there are different levels of understanding, and you can— it's kind of like when you're reading a book, you can kind of get a a sense for what it is without quite knowing what it means, but it helps if you understand more clearly. And so that's why, especially when, because if you keep going, like I'll use the analogy with reading a book. If you read a book and you sort of kind of know what some words mean and not others, at some point you kind of get lost and you feel like you now need to go back and look up the words. I think the same is true in coding. You can kind of keep going, but at some point you kind of get lost, and it's good to be clear about it. Does that make sense?
Yes.
Okay, so SSL, I'm still looking for what SSL is. Tell— I have something that tells me how can I tell if I have SSL enabled, but it doesn't tell me what SSL is. And that's why, um, that's why you need to get good at Googling. And this is why I don't have, uh, Actually, I have, I do have GPT on my phone. Let me see if I can look it up on my phone. Let's see if GPT does a better job than Google.
Okay.
What is Python SSL? Okay, let's see if it's smart. Okay, Python's SSL module is a built-in library that provides SSL, which means Secure Sockets Layer, and TLS, Transport Layer Security, encryption functionality for network communication. It allows Python programs to establish secure connections over the network, such as connecting to HTTPS web servers creating secure sockets for network communication, or implementing secure protocols. The SSL module in Python provides classes and functions for managing SSL/TLS certificates, configuring SSL/TLS contexts, and performing secure socket operations. Allows you to secure your network communication by encrypting the data sent between the client and server, ensuring the confidentiality and integrity of the data. So how was that?
I think I'd have to read over that a few times, but what catches my mind is the data between server and client. Does it do something to that data?
That's a good question. So I'm just going to type this first part so we have it. Provides SSL. Secure Socket Layer. Have you ever heard of Secure Socket Layer?
Um, I think once or twice, but I'm not sure what it means.
And TLS, Transport Layer Security. Have you ever heard of TLS, Transport Layer Security?
No, I haven't.
Okay, how about encryption? Do you have any idea what encryption is?
Not very big. Not a very big understanding, no.
No problem. Maybe let's start with, um, what is— what do you think encryption is?
Encryption? Well, I'm not sure what the word means, but it sounds— or the first thing that comes to my mind when I hear it is like encrypting or putting Like, um, putting something into another object. Like, for example, maybe in a program you would put another piece of code into it.
Okay. Um, and before going into encryption a bit more, I see you posted something. Is that what you Googled on SSL?
Yes, it's just—
yeah, I found SSL is standard technology for securing an internet connection by encrypting data sent between a website and a browser or between two servers. It prevents hackers from seeing or stealing any information transferred, including personal or financial data. So I think it is important to figure out encrypting. Cryptography, have you ever heard of cryptography?
Yes, or no, I'm thinking of cartography, not— no.
Okay, so encryption is coding. It's related to— actually, this is tricky because of course we need coding, but go back to, um, um, like spy codes. Have you ever like tried to put something in a code so that nobody else can read it?
Yes, multiple times.
Is that like in spy books you've done or games, or where, where have you done that kind of thing?
Um, to be honest, it's usually just making a secret language between my cousins and I. Fabulous.
That's a great example. That's a really great example. Um, I remember doing that as a kid, and I think it's so much fun. Do you guys have multiple secret languages?
We didn't. I don't think we have multiple, but we did come up with one last— the second to last time I saw them, and I did forget most of it, but it was fun.
Excellent. No, that's a sort of— it's a— you're doing a secret code, kind of, and it's a form of encryption. So the whole point, you know, in spy— I don't know if you've ever seen spy movies, but, you know, if in a a war, you know, the Americans in World War II, you know, we were fighting the Germans, and we didn't want the Germans to know our plans, and so we had to encrypt our messages so they couldn't read them. And actually, as an interesting case, in World War II, we actually used Navajo code talkers, where instead of kind of making up a secret code, because Navajos only live in the United States, The Germans didn't— couldn't figure out how to speak Navajo, so in World War II we actually used native Navajo speakers to— as our secret code. But normally encryption means creating kind of a secret code. How did you and your cousins create a secret code? What was— you don't have to tell me the secret, obviously, but was it like, did you change letters or something, or how did you manipulate things to make it secret?
I mean, to be honest, it wasn't that changeable. I mean, we didn't really follow a specific code. We just came up for words or different words for words. For example, like some other word was "hi" or "go over there." Got it.
Okay. That totally works. I've seen some codes where maybe instead of A, B, C, D, and so forth, you have the letter 1, 2, 3, 4. So very simple code encryption, actually very simple encryption algorithm, 'cause I wanna start using that word, is let's see if we have the number 1 instead of the letter A, if we were gonna say Alana, then it would be 1, and then we'd have to figure out what letter of the alphabet L is. And I don't know if it's 12 or whatever, and then 1, 12, and then another 1 for A, and then N, whatever letter that is, another 1. So you can imagine, if we agreed on a code where we used numbers instead of letters, normal people wouldn't— they would see this string of numbers and they would have no idea what it was saying, Alana. But if you knew that 1 was A and 2 was B and 3 was C and so forth, then you could translate that code and figure out what any set of numbers meant in letters. Does that make sense?
Yes.
So that's a very simple form of encryption. And when this says encrypting data to prevent hackers from seeing or stealing any information transferred, a lot of times we want to encrypt things when we send things over the internet. And one example, the financial data makes sense. Suppose that, you know, your dad wanted to send money about his bank account so that somebody could pay him. Obviously you don't want people to get information about your bank account so they can steal things, and so it's really important with bank account information that it be encrypted. And there it's not just, you know, A is 1, B is 2, C is 3. There they use very, very difficult sorts of codes to crack or encryptions to crack so that people can't steal the money. And occasionally somebody does decrypt something and steal stuff. But I think we're at a point where most of the time we know how to encrypt things so it's really hard for anybody to read it. Does that make sense?
Yes, it does.
And so this SSL, Secure Sockets Layer, secure tells me that's about the encryption thing. And then the piece that you got also says it's about encrypting data. And so what I'm getting from this is that there's a library where if you want to send stuff back and forth over the internet, you, Ilana, don't have to write new Python code encrypting the data every time. All you do is you call the SSL library into your code, and then when you engage in the internet, the SSL library automatically encrypts it. Does that sound right?
It does.
Okay, so we, you know, this is, you're getting definitely into the weeds, and we didn't get all of the libraries, but I am, I want to be respectful of time. But you see how you can kind of Google each thing in the library and get a good enough understanding. So right now we don't know exactly how it encrypts the data. We don't know exactly, I don't know what the socket is exactly. Do you know what a socket is?
No, not— no, I don't.
Okay, so again, with more time, what I would do— and part of this is, is if you can make the program work without understanding everything, that's okay. But at some point you will have to understand it. And so do you like my analogy of when you're reading a book, you can kind of get away without knowing words for a while, but then too much —Did that make sense?
Yes, it's the same thing for every language. I was reading a book in Old English and I had no idea what a lot of the words meant, and I didn't—
it was, it was hard. Exactly. And I bet if you started getting a few of the words, and not just getting the words, but in that case knowing how Old English is different, so there's certain kind of shifts or changes that would allow you to get to guess a few more words. And I'm personally fascinated with this process of kind of bit by bit making sense of things, where initially Old English, what? But if you start to get a few words, or even in Spanish, you know, I'm sure that you've heard people speak things in Spanish where you have no idea what it is. I don't know, how is your Spanish? We haven't checked. You're muted.
Hi, Ben. I'm moving along pretty well. I'm continuing to do Duolingo. And I'm also learning, or trying to learn Portuguese because there's so many people around me, mostly in my gym, who learn how to speak. So I've been able to pick up a few sentences here and there in both languages.
And sometimes you hear them and you don't understand them, and sometimes you partly understand them, and sometimes you do understand them? Yes. Exactly. See, that's kind of what it is with this code too. That's why they call computer languages computer languages. It's not exactly like a human language, but you can see, hey, I need to know what SSL means, and I need to know what a socket means, and I need to know what Transport Layer Security means. And that's a little bit like learning the vocabulary in Portuguese or Spanish or Hawaiian. And bit by bit, we just need to kind of keep learning. And with Google and GPT, then you can learn more quickly by just going out and getting the information. Makes sense? Yes. All right. Well, are you meeting with Sulake 4 or 5 days a week over the summer? I am.
I'm going to be— I'm going to try to be there at least a few days a week.
And are you starting the Harvard CS50?
I am. I did start it. I'm almost done with the first week. I may not do it specifically week to week, but— I'm getting there. Okay.
And is it hard or really hard?
Well, right now I'm only on the first level, and that's in Scratch. I've been doing Scratch since 2020, but I just haven't done it in a long time, so it's a bit easier than, uh, the other languages that we'll probably be doing.
Yeah, well, that's wonderful. I'm very glad you're doing it, and I do think it starts early, and I've relatively easily. I'm glad it starts in Scratch and you have experience in Scratch, and maybe you and I can kind of keep working on these basic concepts and vocabulary, because I'm certain you'll need to understand what encryption is. My bet is you'll have to understand what SSL, Secure Sockets Layer, is, and what TLS, Transport Layer Security, is, and so forth. So, you know, with both Zulaki and I and yourself and Google and maybe GPT, Let's just keep understanding all these concepts so you can become as fluent in coding languages as you are in English, where you're obviously very fluent. See? Okay. And what are you going to do for today for fun? You're muted.
Oh gosh, I didn't do that. I must accidentally press it today. My brother— my brother's friend has a birthday party, so I think we'll be going there. Um, it's definitely gonna be a restful day because I had a very long few days, or past few days, in Dallas because the time changed.
Of course, of course. Well, take good care of yourself and, uh, have a wonderful week. Okay, thank you, Michael.
See you next week. Bye-bye.










