Placeholder Image

Subtitles section Play video

  • All right.

  • Hello, world.

  • This is CS 50 on Twitch.

  • My name is called Knocking.

  • I'm joined by David Malin today, and we're going to do something really cool, which we haven't done yet so far.

  • Also make might be cool.

  • It's an experiment, but what we do, what we did to be broadcasted.

  • We sent out a Google form with a link that people could include their Twitter user name and also a link to a get hungry boat.

  • Or adjust and send us and source code that we could take a look at and then maybe provide feedback along the way.

  • We do would see us 50 with design in style but not correctness.

  • We will not be testing code for functionality.

  • No, in fact, that it works.

  • It's cold mentions for many years, the axes, so to speak, along which we evaluate students.

  • Cody's correctness.

  • Does it work?

  • Is it supposed to we?

  • Of course.

  • He's check 50 for that these days.

  • Design.

  • How well written is it?

  • Did you use Maur nested loops than you need to?

  • Did you write functions instead of copying and pasting code and so forth?

  • And then style does it look pretty.

  • Did you indented June?

  • Name your variables.

  • Well, for which we now have, for the most part style 50.

  • So that middle component is very much a human process.

  • And that's the part we do in person with students or a synchronously by get hub comments.

  • So that's what we're here to do today.

  • It's gonna be awesome.

  • There are a lot of different kinds of repose.

  • There was a good amount of python co, a little bit of Java script.

  • And if you have the language, somebody even submitted a C library, which that was really cool and fairly appropriate.

  • So why don't we start diving in here?

  • I'm gonna switch us.

  • We have a brand new Microsoft surface pro this big computer right here, the Sikh and kind of see that we're using.

  • It's got a nice touch game.

  • There we go.

  • There we go.

  • Nice.

  • Represent the wind ice brand placement today.

  • Okay, but yeah, we're using a new device today, so hopefully we have no pickups there.

  • This is our view.

  • So we have a nice full screen view and this is our first project and this is N a c l Eric.

  • It's assault Eric.

  • So any sale sodium, which is salt in the gaming community, That means like you lost in your upset Major salty.

  • So that's kind of the reference there.

  • It's apt because this is a super smash brothers, huh?

  • Themed project.

  • And so that's kind of where the reference comes on to see if any seal Eric's actually in the chat.

  • Because I feel a bit like an old man here.

  • Tell me more about this, this newfangled machine.

  • No, no, I don't see any seal arrogant yet already, but I'm sure that he will see a little bit later.

  • So this is just if you're not familiar.

  • Super Smash Brothers is a Nintendo fighting game on, and there's a very strong competitive scene, and there are multiple games that have varying degrees of relevance, sort of.

  • In that scene, Melee is probably the most popular one.

  • So this is a game that commandos in 1000 Jews and Smash Brothers melee very famous iteration of the franchise.

  • And this application here is kind of just a tournament data analyzer.

  • So maybe you want to pull up the C S V file here ashore on 18 issue H.

  • Nazi s V.

  • So this is just kind of some.

  • Now all of these on the left are essentially in the top.

  • It's basically a matrix of tournament data, and I haven't analyzed this deeply to know exactly what the numbers mean but essentially got from reading the Repo.

  • Looking at the other modules that it's sort of what I can infer, wins and losses against other players.

  • So hungry box versus hungry box.

  • Obviously, you're not gonna get wins and losses against yourself, so that's an empty grid.

  • But you can see against plucked, for example.

  • I imagine that's 16 wins, five losses, for example.

  • So that's just kind of the way that this great is laid out.

  • It may or may not be.

  • It might be the opposite way.

  • Might be losses and winds up in a cell.

  • Various NHL Erickson The chat of the very bottom.

  • If you can elaborate, maybe on the data for my hear, if I got it wrong or right, let me know.

  • But in any case, this is our database.

  • But you said this is a C S V.

  • But I'm seeing an HTML table here.

  • Correct, correct.

  • So get Hubble actually render a CSF very a table view, which is a cool feature of get hub.

  • If you have a CCTV in your repo, it'll actually render a table in its place instead of just, you know, the actual comma separated list of strong.

  • So if I click raw, though we should see all the commas so much you would less user friendly where we could open this in Excel or Google spreadsheets or Apple numbers?

  • Absolutely, Absolutely.

  • So, uh, this is the data format.

  • So essentially players and the wins and losses against other players if you want, maybe we could go back into the prior director.

  • There's a lot of drug fox.

  • That's an interesting name s.

  • So now, if you want, we could maybe go through some of the pi falls and maybe you can give your thoughts.

  • I'm sure she would take a look at the Read me to understand what it is we're looking at absolutely quick.

  • All right, so they read me dot MD is, you probably know is like a default file in the get hub world where you can set up some instructions for what it is you're looking at.

  • Frankly, this is the first place to look when you open a repo for the first time, and I have no idea perhaps what you're looking at.

  • So it looks like our n A.

  • C l friend kindly set us up very straightforwardly with some instructions.

  • So python three, setting up a virtual environment or the end.

  • We don't use these in CS 50 but it essentially allows you to encapsulate an application and a folder and in an environment, so to speak, so that you can install certain dependencies in that local environment without affecting your other applications had almost like Dr Rising a set of it's lightweight, lighter weight.

  • Pipe on specific.

  • Why, sure, sure.

  • So, indeed, it looks like our friend has some package requirements and requirements.

  • Dot texts.

  • I might take a quick glance at that.

  • In a moment you're setting a couple of environment variables, and even though you might not have done this in CS 50 itself, we do this for you in CS 50 I.

  • D.

  • We, for instance, have a default value off Last cap equals application dot pie, and that's how flask knows when you just type flats run what file to look at.

  • It looks like a and A C L.

  • How do we want to pronounce us?

  • And they sail?

  • Eric?

  • Yeah.

  • We're getting a salt to salt, Eric.

  • Okay, salt.

  • There.

  • Correct us If you'd like salt.

  • Eric here has chosen a p i dot pie for his final name, which is fine and flask Debug.

  • One will enable some nice debugging features.

  • But you see, just like in CS 50 flats Koran, we'll kick this off.

  • This isn't something that you necessarily get red at the gate when you're insulting a flask application?

  • Uh, well, ideally, if the 12 documented I mean, this is nice, because this is telling you when you started a new flask application, what about you have to do this in order to get this flash friend capability you have to do that is if you're using flesh run.

  • Yes.

  • You need to set those environment variables somehow.

  • And exporting it to your environment is the most persistent way to do it, at least for your current shell.

  • This is nice, because honestly, the first thing I was gonna ask is what are we looking at here?

  • Malay dot pie contains the function to query the CSB file.

  • AP Ida Pies, The main flask app cleaned up, I clears, cleans the data, and then we'll try to decrease the amount of material changes and add them.

  • So that feels more to do than a no.

  • So I feel like I would first be inclined to take a look at requirements that text just to wrap my mind around what this is using and then maybe start with a p i dot pie and makes sense because that's also that looks like that's the flask app itself.

  • So hopefully this is an easy one.

  • If we go up here on requirements dot text, all this is that fun?

  • Familiar is a text file.

  • That line by line has a requirement.

  • And if you want to fix the version of a pit python package you're using, you just do what assault Eric did here with the equals equals specific version number.

  • All right, so a few of these look familiar flask Jinja markup safe is probably HTML related.

  • I've used It's dangerous.

  • I don't remember what functions have used their and but we'll see what we're using them for.

  • In library name.

  • I haven't used that one.

  • Salt Eric feel free to chime in at any point cause you know the code and we're making it up as we Oh, so here we go a p i dot pie.

  • Nice.

  • All right, so we position this, I think, is an opportunity to comment on code.

  • So how do you want to proceed here?

  • I'll say what my original inclination is.

  • And I think this is a common theme throughout a lot of the reports that we see is there's there no comments in this particular module, and that may or may not be important for this example, because it's kind of small, but I mean, right off the bat, I'm already kind of forcing myself to go into read the code and not really get a program or high level understanding of what I'm looking at, S o.

  • I think definitely having at least a small dock string, if not just a single line header over all of these routes can at least you know, Seo, this route does.

  • It serves this information from here.

  • Is that our docks during?

  • What do you mean by that?

  • So Doc String is a comment like a block level comment that goes over a function that specifies your inputs and outputs to your function gives you a sense of, um you know what date I can feed the function.

  • What I'm expecting back and without having to necessarily get into the nitty gritty details.

  • Especially for looking at a really long, gargantuan function that we have no idea what it means.

  • Lincoln immediately kind of at least high at a high level.

  • Understand the code that and actually, can we talk?

  • Go over to your main screen.

  • Let me just go ahead and log in here real quick.

  • Sure.

  • So I'm gonna go ahead and Loggins with an account here just so that we theoretically could submit some pull requests here.

  • Just let me know when you want to do.

  • It would be right back.

  • Just typing in my super secure password.

  • In the meantime, remote says wait windows.

  • Yeah.

  • Now we're switching to windows today.

  • Um, Sem Perera.

  • Lee, here we go.

  • All right, let me go ahead and log in here.

  • Give me one second.

  • Yeah, it's a really nice piece of hardware and a 3000 but something Pixels two, we're going down to just 10 80 feet tonight, so we scaled down just a little bit.

  • Somebody my commercial.

  • Okay, interesting alley one.

  • I think that was a separate conversation.

  • OK, Do you want to keep here?

  • Let me change one thing here.

  • You want to go ahead and read some of the comments we have what we have to get going.

  • Don't Ton saying here from Nigeria thing that might be the first Nigerian student we've had.

  • Actually, it's so awesome.

  • Thank you so much.

  • Welcome from Nigeria.

  • Um okay, just make sure I don't want the folks got caught up in a little Facebook commercialization, chatting on a non contextually pull a little bit out of that.

  • Um, just make sure So all the regular a lot of regulars air here.

  • Isabella cures McKnight remote.

  • Sergio one says hi.

  • I don't know, it's kind of a familiar name, but that might be the first time I've seen Sergio.

  • BBO one Brenda Saying Good morning.

  • So Hi, Brenda.

  • Thanks for joining us today.

  • Acid Jack, three of three says hello, world.

  • Nice.

  • Hello as well.

  • Um m Kloppenburg.

  • So Martin from Facebook.

  • Thanks for joining in Injure ready five you make with the hello and that always every time I see that you think I'm looking at Aaron?

  • Looks like Aaron from it does.

  • Yeah, Aaron, from our own team here, which which we're trying to get her onstream as well.

  • This this bear is drunk.

  • That's a great user name.

  • Kaizer Twitch.

  • Um, see, for mostly, Kind of.

  • Just make sure sends a touch.

  • Three D.

  • Awesome.

  • Thanks.

  • So much lasagna.

  • Eleanor says love your CS.

  • 50 course on YouTube.

  • Nice.

  • Nice.

  • And they don't forget me.

  • Well, everyone.

  • Hello, Cold.

  • Hello, Professor Malin says Andre.

  • I lo I Lo Andre.

  • Good.

  • Familiar name to thank you very much for joining us today.

  • All right, Think we're caught up and I'm good to go here.

  • Okay, let me go ahead.

  • Emma switches back to our service pro here.

  • All right, So first, take all this with a grain of salt, if you will, which is an expression meaning don't necessarily take.

  • What we're saying is gospel cause reasonable people will disagree.

  • Hopefully, we'll be able to offer some objective comments that even some software and python standards will corroborate.

  • But certainly again feel free to disagree with some of the things we said.

  • Maybe not everything.

  • So I'm gonna go ahead and just pretend to edit this just so that we can kind of talk as we go.

  • I could go so far is to submit a pole request.

  • Thio Salt Eric if we wanted to.

  • But at least this way, we have a little bit of edit ability.

  • So the fort do you forget?

  • You know, I just click to the the pencil icon, which allows me to on the fly start editing the file.

  • And if I were to try to save this, then I would actually have to seo say, this is a brand new start over.

  • I think that's cool indeed.

  • So there aRer standards in the world of python known as Pet for a python enhancement proposal.

  • And this has come to mean a set of standards have been added to the languages community over time that govern how you should write python code.

  • And Pep eight, for instance, is the newest version of the style standards that, actually, if you're familiar from CS 50 style, 50 tries to enforce, so anytime you run style 50 and get feedback on your python code, we are comparing it to this so called pep eight Standard.

  • And any time there's a difference between your coat and that standard, we pointed out with red or green highlighting to imply you should be changing it in this way or some other.

  • So I've gotten good enough at running style 50 on my own coat that I know some things to look for.

  • And I'm pretty sure, for instance, that Pep is gonna complain about some of the aspects of this file.

  • For instance, it's conventional toe actually separate your imports at the top of the file from your actual lines of code or logic.

  • So having a single space there, it turns out that Pep also says, even though I find this one a little annoying, you should have to blank lines in between functions and above the first function.

  • So you'll notice that we have a deaf hello function here.