all right hello world this is cs50 on
twitch my name is called Naga and I'm
joined by David Malin today and we are
going to do something really cool which
we haven't done yet so far well so mate
might be cool because I think it's an
experiment but what we do it what we did
is we broadcasted or sent out a Google
Form with a link that people could
include their twitch username and also a
link to a github repo or a gist and send
us some source code that we could take a
look at and then maybe provide feedback
along the way we do with cs50 with
design and home in style but not
correctness we will not be testing code
for functionality no index that it works
it's called mentions for many years the
AXI so to speak along which we evaluate
students code is correctness does it
work as it's supposed to we of course
use check 50 for that these days design
how well-written is it did you use more
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 indent did
you name your variable as 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
asynchronously by a github comments so
that's what we're here to do today yeah
it's gonna be awesome
there are a lot of different kinds of
repos there is a good amount of Python
code a little bit of JavaScript and if
you have the language is somebody even
submitted a C library which I thought
was really cool nice and 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 UC can kind of
see that we are using it's kind of nice
touchscreen there we go there we go yeah
a nice represent the wind nice brand
placement today okay but yeah we're
using a new device today so hopefully we
have no hiccups there this is our view
so we have a nice fullscreen view and
this is our first project and this is
NaCl Eric so salt Eric so NaCl sodium
which is salt in the in the gaming
community that means like you lost in
you're upset maybe you're salty so
that's kind of the reference there it's
apt because this is a Super Smash
Brothers Eames project and so that's
kind of where the referee
comes I'm asleep nacl Eric's actually in
the chat because I feel a bit of like an
old man here tell me more about this
this newfangled machine no no I don't
see any CCL Eric in the chat 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 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 came out
shows what it doesn't do there's much
booze mail a very famous iteration of
the franchise and this application here
is kind of just a tournament data
analyzer so I don't maybe you want to
pull up the CSV file here Shawn 18 h2h
dot CSV 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 I essentially got from
reading the repo looking at the other
modules that is sort of what I can infer
wins and losses against other players so
hungry box versus hungry box obviously
you're not going to get wins and losses
against yourself so that's an empty grid
but you can see against pull up for
example I imagine that 16 wins 5 losses
for example so that's just kind of the
way that this grid is laid out it may or
may not be it might be the opposite way
might be losses and wins NaCl Eric Berry
is NaCl
Eric's in the chat at the very bottom if
you can elaborate maybe on the the data
format here if I got it wrong or right
let me know but in any case this is our
database but you said this is a CSV but
I'm seeing an HTML table here correct
correct so github will actually render a
CS bury a table view which is a cool
feature of github if you have a CSV in
your repo it'll actually render a table
in its place instead of just you know
the actual comma separated list of
strings
so if I click raw though we should see
all the commas in all the CSV so much
you would less user-friendly where but
we could open this in Excel or Google
Spreadsheets or Apple numbers absolutely
absolutely absolutely so this is the
data format so essentially players and
the wins and losses against other
players if you want maybe we can go back
into the prior directory there's a lot
of drugged fox doesn't interesting name
okay
now if you want we can maybe go through
some of the the PI files and maybe you
can give me your thoughts I'm sure I
mean should we take a look at the readme
time and what it is we're looking at
absolutely this is the wink wink all
right so the readme MD as you probably
know is like a default file in the
github 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 have no idea
perhaps what you're looking at so it
looks like our nacl friend kindly set us
up very straightforwardly with some
instructions so Python 3 setting up a
virtual environment or VM we don't use
these in cs50 but it essentially allows
you to encapsulate an application in 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 and almost like docker
izing is set up it's a slight wave
Python specific why sure sure
so indeed it looks like our friend has
some package requirements and
requirements text 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 cs50 itself we do this
for you in cs50 IDE we for instance have
a default value of flask app equals
application dot PI and that's how flask
knows when you just type flask run what
file to look at it looks like a NaCl
uh-huh how do we want to pronounce this
and they say L err yeah we can say salt
Eric - salt Eric okay salt there correct
us if he'd like salt Eric here has
chosen API PI for his file name which is
fine and flask debug l1 will enable some
nice debugging features but you see just
like in cs50 flask run will kick this
off so this isn't something that you
necessarily get rid of the gate when
you're installing a flask application
well ideally if it's well documented I
mean this is nice because this is tell
me what are you sorry when you start a
new flask application what about you you
have to do this to order to get this
flask run capability you have to do this
is if you're using flash 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 male 8 pi contains the
function to query the CSV file API dot
pi is the main flask app clean dot PI
clears cleans the data
and then we'll try to decrease the
amount of messages and add them so it
feels more but to do then I know sure so
I feel like I would first be inclined to
take a look at requirements texts just
to wrap my mind around what this is
using and then maybe start with API PI
it makes sense because that's also that
it looks like that's the flask app
itself so hopefully this is an easy one
if we go up here on requirements text
all this is if unfamiliar is a text file
that line by line has a requirement and
if you want to fix the version of a pip
Python package you're using you just do
what is salt Eric did here with the
equals equals specific version number so
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 I've used there
and but we'll see hopefully using them
for in library name I haven't used that
one currently salt Eric feel free to
chime in at any point because you know
the code and we are making it up as we
go yeah so here we go API dot PI nice
alright 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 gonna be a common theme
throughout a lot of the repos that we
see is there's there are no comments in
this particular module and then 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 like read the
code and not really get a program or a
high level understanding of what I'm
looking at and so I think definitely
having at least a small doc string if
not just a single line header over all
of these routes can at least you know
say oh this route does you know it
serves this information from here
instead of doctoring 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 so it gives you
a sense of you know what data I can feed
the function what I'm expecting back and
without having to necessarily get into
the nitty-gritty details especially if
we're looking at a really long
gargantuan function though we have no
idea what it means we can immediately
kind of at least high at a high level
understand the code that works out good
and actually can we toggle over to your
main screen let me just go ahead and log
in here real quick
oh sure so I'm gonna go ahead and log
into with an account here just so that
we could submit some pull requests here
so let me know when you want me doing
switch be right back just typing in my
super secure password in the meantime
my remote says wait windows yeah now
we're switching to Windows today
temporarily here we go all right let me
go ahead and login here give me one
second
yeah it's a really nice piece of
hardware and a like a three thousand but
if something pixels to we're going down
to just 1080p today so we scaled down
just a little bit some of my questions
is or is it because men are lying okay
interesting alley one I think that was a
separate conversation okay 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 shortly a bit
get going doulton saying here from
Nigeria I think that might be the first
Nigerian soon though we've had actually
it's so awesome thank you so much
welcome from from Nigeria okay let me
just make sure I don't honor the folks
got caught up in a little Facebook
commercialization chatted own a non
context really pull a little bit out of
that just make sure so all the regular a
lot of regulars are here so bellick here
static night remote sergey bo1 says hi i
don't know if it's kind of a familiar
name but that might be the first time
we've seen sergey VBO one Brando saying
good morning said hi Brenda thanks for
joining us today
acid Jack 303 says hello world nice
hello as well M Cloppenburg so Martin
from Facebook thanks Martin for joining
in Indra ready five you mech with the
hello and that always every time I see
that that you I think I'm looking at
Aaron look it looks like Aaron for that
does yeah Aaron from our own team here
yeah which which we're trying to get her
on stream as well this this bear is
drunk that's in great username Kai's at
which you see and for mostly kind of you
just make sure sensotouch 3d awesome
thank you so much
lasagna L&R says love your cs50 course
on YouTube nice nice and Nate don't
forget me hello everyone hello will
called and hello professor valence is
Andre hello I love Andre good email your
name too
thank you very much for joining us today
all right I think we're caught up and
I'm good to go here okay let me go ahead
I'm gonna switch us back to our yeah
surface pro here alright 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 because 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 with some of the
things we say 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 as to
submit a pull request to salt Eric if we
wanted to but at least this way we have
a little bit of edit ability so the fork
oh no I just clicked 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
submit save this that's cool indeed so
their error standards in the world of
Python known as pep or a Python
enhancement proposal and this has come
to mean a set of standards that 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 cs50 style 50 tries to
enforce so any time you run style 50 and
get feedback on your Python code we are
comparing it to this so-called pep 8
standard and any time there's a
difference between your code 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 code 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 to
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 that
you should have two blank lines in
between functions and above the first
function so you'll notice that we have a
def hello function here so pythons gonna
yell at us our pep is gonna yell at us
if we try to have any fewer than just
two lines there and getting ahead of
myself
it's gonna want two lines there and
maybe I think below this one as well
though I don't recall 100% on that one
interesting I don't think I typically do
the two lines after each function but it
makes sense it's okay it's a little
excessive I'm okay with one but so be it
so stylistically I think if you if this
is production code or if the application
is nearing the end of its development
you should definitely just remove stuff
that doesn't need to be there I'm
guessing this was there for debugging or
just getting you started but of course
that probably shouldn't be there
ultimately but it's okay that it is
there now but what I was noticing a
moment ago is an inconsistency there's
some quoted strings or stirs in this
code and this is this is subtle but
we're using double quotes here and then
down here we're using single quotes all
of a sudden and then down here we're
using single quotes as well very good
point and none of those is incorrect but
it's just it's sloppy I think what do
you prefer personally when your program
you so in cs50 we use double quotes only
because see for Strings requires double
quotes and it's just simpler I think
cotton the ability to keep everyone in
the same mindset however with JavaScript
we do use single quotes because that
world just really evangelize the single
quotes and honestly I've come around to
liking single quotes because it means
one fewer keystrokes you don't have to
hold shift anymore and that's compelling
but whatever you use I think it's fine
to each his or her own but you should be
consistent especially in a language like
Python where it does not matter so you
don't have to start using double quotes
just to achieve some feature like in
pipe like in PHP where double quotes are
actually functionally different from
single quotes okay so we could just
ignore this problem though and delete
those lines of code is probably not
germane to the program's easy fix and
honestly this does not need to be here
any more - this is a remnant of older
versions of class you don't need that
anymore you should instead according to
flex own documentation use flask run and
not even have a main routine in your
flat so kind of engine
main does it like injects a main routine
or something like that underneath the
header this here so this would the the
when you call foster home without main
without this app that run call does it
does it take the this module and
therefore inject its own app dot run or
behind-the-scenes kind of do that when
it's not there it actually looks for it
believe a variable it looks for a
variable called app inside of the file
that you're specifying via the art
environment variable which application
dot pie or API pie okay as well got it
so we don't strictly speaking need this
year and this one I don't love I'm
almost okay with this because if you had
sort of route wall actually we're using
I can't tell from github if it's spaces
or tabs it's fine if you want to line it
up that way however this line is short
enough honestly that I would probably
just keep it on one just like this here
what do you got going on you can keep
going out I'm in check the YouTube
stream ok Colton's going to check the
YouTube stream here so what else might
we do here well we have H 2h stats and
that's being paired to this named
argument here matchups you could of
course make this even trimmer by taking
that print player function and just
assigning it there I don't know yet what
print player does but I'll admit I'm a
little uncomfortable with the fact that
the function is called print player the
variables called H to H stats and you
might know better what that signifies
and then the named parameter is called
match-ups like semantically it just
feels like the names are all over the
place here and again i say that without
knowing what the function does yet but
I'm not seeing any relationship among
these three strings and so I'd like to
see this cleaned up but I don't know
offhand how best to do that yeah I think
I think like I said with the doc string
having like kind of a mapping between
what is H - H stats mean or what's that
short for for somebody coming into the
code maybe they don't know what melee is
or smash maybe not in that scene at all
but unit you need to hire an engineer to
work on your code base I think having
these you know acronyms yeah variables
that map kind of makes sense and
somebody just followed I don't have the
indicator up thank you very much Liz a
lasagna Lonard lasagna Lonard welcome
aboard lasagna
nice to see you if you have any other
mentions it's up now the BK labs also
thank you very much for following in
puppy puppy stomper 92 ok great I'm sure
they have move on from there
all right so what else might we comment
on here well that's a pretty trim file
assuming assault eric is okay with our
removing so many lines of code but I
kind of liked thinking about new code
that you're looking at for the first
time is kind of following the
breadcrumbs and the fact that I'm you
and I are curious now what print player
is yeah suggest that we should follow
that breadcrumb and see okay well print
player comes from a file called male 8
pi presumably if it's from the local app
so let's actually go back I'm not going
to save these changes we're not going to
impose our ideas on you but feel free to
adopt yourself let's go take a look at
that file as well but before we do that
let me go back to the read-only version
of this which is where we started and I
just googled earlier because you could
run style 50 on your own Mac or PC and
in fact or you could use cs50 IDE but it
turns out someone online made a website
called pep 8 online comm where you can
paste your Python code click check code
and then this website will lint it so to
speak
analyze it statically top to bottom left
to right and provide you with feedback
it's not quite as may be visually useful
as style 50 tries to be because it just
has this list of all the problems with
the code but if salt Eric wants to take
a look at this too you could see on line
5 and 9 and 13 and 16 are their
suggestions for how to align this code
with pep 8 it says nothing about
correctness nothing about design but
does say something about style there's a
add on to that a lot of modern text
editors to have these have plug-in
systems yeah vs code Adams sublime
totally and within those plug-in
ecosystems is usually very someone big
really good linting plug-in that you can
install for Python and many other
languages but they usually defer
ultimately to a command-line tool called
PI lint but it will inject the actual
linting sort of how we have here on the
screen there's red and yellow tags with
the actual numbers for the code for the
pep spec to actually inject those into
the left side so vs code is what I use
you can get it for vs code Adam and
sublime amongst other plugins as well
indeed and actually we're seeing some
things that I didn't even notice in
github notice here this warning on line
13 indentation contains tabs so here -
we're not gonna probably shouldn't start
a religious debate over spaces versus
tabs even though you should use spaces
but mixing them badge certainly frowned
upon for the same reason stylistically
that you shouldn't be mixing your quotes
it's just sloppy it's harder to see case
in point I can't even see the tabs in
github so frankly personally I would
actually add I'm doing it already I
would advocate spaces because they are
100 percent robust on any persons text
editor and what we're seeing here is
exactly the symptom it might look like
uniform indentation but there's some
tabs intermingled and most text editors
now will just let you convert tabs to
spaces oh yeah if not by default yet
we'll just do that for you there's
nothing you have to worry about that too
much if you're using a modern text item
if you're using something that's not you
know something like does been doing
automatically if you configure it
automatically yeah so yeah either way
yeah I find myself in agreement with
that all right well that's so there we
go we we slipped into the religious
debate there so what's going to may
light up high where there should be at
least one function that was reported at
least print planner we do indeed see it
here yeah yeah and this is really the
meat and potatoes of the application as
far as I was able to see this one
function yeah I do see that as well so
CSV file okay so let's just kind of read
this top to bottom so importing the CSV
for comma separated values to read that
big data file that you gave everyone at
or oh here's our function takes a player
is input up just to your point earlier
I'd love to see some comments here
because honestly my brain is already
starting to hurt as to now you're making
me think too much next to what this does
yeah I would love to see minimally a doc
string if not I mean we do have comments
here along the right-hand side but the
problem with the comments along you know
being here on the right-hand side
especially when you have lines like 21
here the line that starts with Jason
here might be a little small on the when
i enhance yeah little bit that's about
as big as we can write it didn't look
like it got any larger well it will in a
few seconds all right cuz I'm sorry
happiness I thought it was looking at
our current view
looking at our livestream version bring
this up here okay that's gonna be better
so on line 21 here which is a really
long line if you're mixing that with
these comments that are in line comments
not only will those lines be very large
in your text editor thereby requiring
you to sort of zoom out but it gets it
kind of mix and match your actual code
with where your comments are it is just
a little bit hard to read and a little
bit to was the word I'm looking for
jam-packed and am looking forward for
you sub where it's 500 cluttered yeah
it's cluttered all right so what else
could we comment on up here so match up
data in JSON I don't really know what
those are gonna be yet it'd be nice to
probably comment what they're gonna be
used for and honestly I'm not even
seeing them used in the next several
lines and so here too I would argue they
should not be declared right at the top
of the file like this isn't C from
yesteryear I would define those
variables closer to where you're
actually using them just to give them
proximity to where they're logically
being useful these lines here are fine
although honestly there's so much you
could just nest all of this into one
line if you really wanted to in order to
read the entire contents of the CSV
however design wise this seems very
vulnerable to errors for instance if
this file is missing or for some reason
it doesn't parse correctly all of this
should probably be encapsulated in a try
except rank so as to handle an error we
don't introduce this in cs50 but it's a
more sophisticated way of doing error
checking trying literally to do
something and except if something goes
wrong you handle the exception in some
way and they literally have predefined
exceptions like file not found error
which is which is probably what we would
use here for that example and you would
see some pretty arcane error messages on
the screen that if you're new programmer
or user god forbid is seeing this it's
going to completely confuse them you can
catch those and provide much more user
friendly messages like 2018 h28 dot CSV
not found I'm in here too this is
generally frowned upon design wipes to
hard code something like this string
this file name into your code that
should probably be factored out to a
constant or a global variable somewhere
that's configurable maybe in a file
called config PI in a JSON file or a
llamó file or even a CSV file a ver
variables for the program or just take
it in as an input to the function and I
would go so far as to say it's okay to
assign that the default value to a
parameter but allow the caller to
override it so that when you're playing
maybe you want to test it with a super
small CSV you don't have to go go
changing your actual code to test it
with a different file it's a good point
yeah for a scalability so here it looks
like we're just filtering out all of the
empty elements of that list and I'm okay
with that although stylistically there
should be a space between the hash sign
and the first character according to
pep-pep also frowns upon these inline
comments that are at the ends of lines
they should really be going above the
corresponding blocks of code and it's
nice that you've aligned them all like
this for readability but that is a pain
in the neck to maintain and that quickly
becomes more of a headache than anything
and I would just not even go there put
it above the line so you can read the
code top to bottom
offhand do you remember so typically
what we do internally for our comments
is we capitalize the first letter of
each comments we do yeah is that a pet
thing or is that just something we do no
that is not yours if you have multiple
sentences and a pep comment it's sapote
you're supposed to use proper grammar in
periods I don't think it specifies if
you just have a single phrase if it so
much matters we did standardized though
really bit to be nitpicky because if you
do have a two sentence comment you're of
course gonna start capitalizing so I
just inferred from that well we should
probably just start capitalizing the
first one for consistency makes sense so
here is where suppose I were your
colleague working on this code for the
first time like you're really hurting my
brain trying to read through this now
like I would really love a comment a
top-line 10 maybe 11 just tell me in a
short phrase what are the following five
or six or seven lines of code doing and
don't make me think because I'm
literally gonna start staring at this
code trying to understand what it's
doing looking back at the CSV file to
see what the data is and it's just
wasting time like you know right off the
top of your head what this is doing and
you can save yourself weeks hence and
even others days hence a huge amount of
time in onboarding on line 21 especially
I think that's the largest line that I
can
see yeah I mean there there is some
readability in there because it can say
that's wins and losses I'm assuming
that's you know putting those two
together in some sort of data structure
you know to compare them at some point
but or does at least it probably to
display them here but just having a
string there just to our comment there
to let me know what I'm doing exactly
where code gets pretty complicated like
that I think very well oh great
now here strictly speaking we have the
single quotes but that's fine in this
file because they're used uniformly I
don't love now that I see how this is
being used in line 21 that the variable
is called JSON because frankly it's not
this is a Python dictionary now I
understand the intent it's eventually
meant to be thrown kicked out by the API
route in API PI as JSON but this feels
like it's prematurely named this should
really be a player data or player or
some representation of the actual data
the fact that it becomes JSON later is
really an implementation detail part of
the controller not part of the model so
to speak itself and we don't need to go
down this road but this is an example it
seems of MVC this is kind of a model
file it doesn't need to get into the
weeds of the transport mechanism which
might be JSON might be something else
altogether sure and I would also say to
add on to that there you know given that
Python has a library called Jason I
believe it has a library called Jason
yep there is there's a potential
opportunity for a bug here yep indeed an
agreed agreed another note here you can
actually have Python close files for you
if you use the width preposition and say
with open such-and-such you can do that
and honestly this should have been done
way earlier because if this file were
opened here and we converted the whole
thing to a list here we already have all
of the data as of line 8 it would seem
so we certainly shouldn't be closing it
all the way there again close things as
soon as you're done just finish your
thought as proximal to the code wherein
you're using it just like I proposed to
clear your variables proximal to where
you're using those as well sure pep-pep
is also not going to like this I think
it's gonna want spaces in between the
arguments to a function like range so
minor point
yeah pure because on my they do use Oh
yep now we got you inconsistency so even
if you disagree you got to agree with
consistency consistency that's probably
one of the main themes right just being
consistent and also being
well-documented those two are probably
good first stepping stones yeah
absolutely I see it again here there's
no space after this comma even though
there is nicely enough after the colons
there so just be consistent pep is
probably gonna want you to have spaces
around the plus sign even I find that
it's getting a little bulky but so be it
if you're gonna use pep and just just we
won't go through pep every time let me
go ahead and copy this code and just
paste it in and you'll see that we do
get a nice summary of a lot of these
same stylistic concerns not in the
design ones and indeed here those a
whole bunch of warnings or errors visa V
the pep specifications alright so I feel
like we've got it let me go ahead oh I
was gonna say block off a few comments
or talk up a few comments will do that
wall if you want to switch to the next
repo I'll bring us over to the blank
screen here we got a couple of funny
ones that I did notice what we were
doing so the isle of Mahlon username
somebody created here Oh interesting
thank you let me see if somebody
mentioned Airbnb styler baby has a good
style guide yeah very detailed spaces
imposed indentation style across the
team ITES and text editors can be
configured to set tabs as to spaces for
spaces or whatever both spaces if you're
using four that's four spaces for
everyone so that is true but frankly
within a company in a code base you
should all be using the same thing
anyway and honestly I haven't here we go
I have never bought the argument that
programmer should be able to interpret
the tabs as two spaces if they prefer or
four or eight I think frankly within a
code base you should all just agree to
disagree on some standard and stick with
it the reality is spaces avoids exactly
the silliness that we just encountered
where there's actually mixed tabs in
spaces and you can't tell how about your
what's your personal opinion on two
versus four spaces because two is very
common in the JavaScript world yeah it
is just because I've still used for
certainly for cs50 and for learning code
I think it's just a little more it's
twice as obvious and it's two spaces is
eight is excessive you shouldn't even be
no one should be talking about eight six
is weird two is okay H
more okay with it but for code honestly
I think four is reasonable and honestly
now that you have promises and async and
other such techniques in JavaScript and
you don't like to worry about callback
hell like you don't really need to worry
about indentation as much sure sure I
think I think four is fine I think I
prefer four verses to cs50 one TV it's
all nice so we got to check that channel
can I get an upgrade yes tune in
tomorrow to cs50 one TV oh there's
somebody before you mentioned is that
the open computer who's nice thanks for
catching that
snores says think cs50 I know what to do
with my life now smiley face it's a very
sweet coma
pretty simple codes is the duck though
yeah the code is simple but yeah even
regardless of simplicity though I think
the documentation having documentation
is key no matter how simple your code is
ultimately mm-hm
jaylen a7 is just the first people you
reviewed yep the first one we're about
to get to our second one yeah
how many repos are we gonna cover as
many as we can get in and out absolutely
so probably three or four yeah indeed
adamantine saying just got here code
reviews very thorough good happy happy
you think so variable names are
inconsistent camel case versus snake
case Oh Oh did we miss a good scenario
oh thank you very good catch yeah I'm
seeing some scouts can't a snake case
here with underscores but indeed camel
case up here at top it's very aromatic
in Python to use snake case there was a
case that was made to me as I was
reading some documentation about older
Python modules that like re for example
I think it was or one of those other
modules it might have been it might have
been an XML library whatever part of the
core standard library was written in
camel case and people were saying if
you're using that library it's idiomatic
to stick with camel case despite the
fact that Python as a whole its
idiomatic to snake case so that's a it's
a bit of a weird ecosystem but I think
it's probably safer to use snake case
always yeah I think we couple more
comments hello from India says kill
stealer 1080 wait I think we missed one
why are we not talking about Fibonacci
indentation we're not so how do we ban
someone
Oh lasagna was saying this guy is a
walking encyclopedia that's--you Oh in
NaCl saying thanks for the comments
we'll definitely make some of the
changes united sighs some thanks Eric
mean yeah we meet everyone all of what
we're saying although we mean is
definitely just to help you improve it's
not meant to crap on your coat at all we
promise thank you very much for
submitting we're happy happy yeah no
this is great great place to start
okay go away the logging python written
camelcase
yeah and oh and the jason g from greece
hasn't been a long time one of our
original hello greece hello india i saw
as well very nice cool all right so do
we have let me uh okay so we're on this
the thing there so let's go back to i
think we looked at api we do cocaine
melee yeah I mean I think that's it we
could keep going a little deeper but I
think we're okay I can't if we really
want to nitpick convention would be to
lowercase the MD an uppercase the readme
for whatever reason but that's clearly
renders okay fine and github should we
take a look at another one yeah let me
go ahead and say thank you again to salt
Eric thanks things you appreciate it
alright so we're gonna go back to
another another one here let me go back
through our submissions here real quick
and let's gets the next URL next up
Indre ready five Indre ready five cool
this is a rock-paper-scissors game nice
so what i from what i remember it's a
fairly short repo it's not it's not too
long but there were a few points that i
definitely thought of when i was reading
it and i think it's actually a jist so
i'm gonna go ahead and just back to our
our computer here and it just for those
unfamiliar is just like a paste bin it's
like a quick and dirty way of pasting
and syntax highlighting code for other
people to see really yeah yeah nice way
it's specific to get home yeah you're
not gonna show your whole repo just a
just a single thing yeah all right well
i already liked how indra went ahead
here and have this has the space after
the import that would be pythonic if you
will
o list i don't know what may be ordered
list if it is an ordered list it really
doesn't need to be called ordered list
because lists are ordered in python of
course you can't call it list because
list is a class in
pythons so I think here I mean we're
really gonna start nitpicking quickly
tell me what these are right like I
don't even know what they are in the
game rock paper it's like the moves or
the symbols I would give it something
semantically meaningful yeah describe
what the data is not how you're storing
and probably call it move underscore
types something move types types I would
like yeah absolutely
okay another thing that I wish we had
and I wish more repos did this is having
the doc string if we have enough time it
might get to a couple of examples that
have great doc string is used in them
but this one doesn't have doc strings so
game we're not sure what it takes what
it returns what it does just but we see
that it says game play and result but
that's way too general of a statement it
doesn't sort of encapsulate the flow of
the function I don't know you know what
the start middle and end is you know and
it's a long function this function is
basically the entire the entire script
here and I think if I I think so and in
fact I'd kind of propose we pause
because I don't know what the game
function is we should probably scroll
down and see what's going on sure so I
see another function here computer C
player C and main so funny enough I
would argue that the whole point of main
is to be indeed the main function and
the value of giving it a name is
generally to put it way up top because
you already made us think you made me
scroll through all of your code and yet
all I care about is main and ironically
game is the first function called so
that's a good thing we can go back up
but if you're going through these hoops
and python of actually checking whether
the name of the file is underscore
underscore main and you're defending
defining a main function put that main
function up top because this way all of
your other functions are helper
functions or more generally speaking
abstractions that you don't need to look
at unless you care to but main you
presumably do care about I agree yeah if
you if you see at the very beginning
instead of us trying to parse this what
I don't remember the name of the
function offhand the very first function
but now we know that we should indeed
work our way backwards and look a game
first get into the overall encompassing
view of the application indeed and I
would comment to these kinds of comments
while in the spirit of commenting
rigorously are not that helpful because
main is by convention the main part of
your program so you've not really added
anything and so honestly I've struggled
with this because I comment all of my
functions when writing code but I never
really know what
right for Maine and I just settled on
writing nothing for Maine when at least
it's obvious that that's the main point
of the program definitely don't write
main part of the program you're just now
you're just wasting the readers time
like don't repeat yourself kind of the
dry prints out in the context of comment
indeed so let me go ahead and scroll
back up to what's going on here and it
looks like this game plays
rock-paper-scissors you know why don't
we go ahead and play this game real
quick on our human hands for those
unfamiliar especially in other
communities all right so you can either
be a rock by holding your fists up paper
by holding it flat or scissors by
holding it like this and let's do two
out of three and we'll explain as we go
who's winning and why sure all right so
we want one go rob a person and then the
third one is where you know you'll Rock
Paper Scissors shoot
oh is that how you do how do you do in
California we did rock paper and then a
third one is is rock paper scissors you
say scissors but so you got to say shoot
okay fine we'll do it rocked all right
we'll do it East Coast style Rock Paper
Scissors shoot okay but we were book
paper so nothing happens it's a tie so
no one gets a point okay because paper
is just the same thing in this paper
Rock Paper Scissors shoot try to trick
him okay one more time Rock Paper
Scissors shoot alright so Rock : was
Rock rocks obviously break scissors so
Colton gets the point and so forth so
it's a way of like I don't know passing
the time as kids but also to see like
maybe who gets the last cookie you know
if you win Rock Paper Scissors it's like
even our odds or other kinds of things
yeah there's a triangle of it's like
hierarchy essentially but it's a
cyclical higher indeed
so that the scissors beats the paper you
know paper scissors cut paper paper
covers the rock and beats the rock and
then the rock crushes the scissors or
however you want to think about it it
did alright so let's go ahead and
critique this this is presumably an
implementation of that human game here
so I do like these default values
because that suggests that there's some
versatility here however this is working
I will say that much as I like how the
menu if you will is all isolated to the
top of this function honestly this seems
so logically different from what I
gather is going to be the rest of the
code this should probably be factored
out and it should be a function called
menu or it should be a constant
somewhere else or even in a text file
that you open up and
print the contents of because there's
also this messiness here you're printing
some new lines explicitly you're doing
it implicitly via these print calls I
would just be consistent there and in
factored this out somehow and here is
actually one of the best reasons to
actually twitch between twitch between
switch between single quotes and double
quotes if you want to print double
quotes you can surround the whole thing
with single quotes or you can do this
too it just starts to get a little
annoying to read I would say there's no
strong feelings here that make sense so
I don't really know what this is yet a
comment would help me here like player
gets player C and I don't love how this
functions called now player C just to
distinguish it from a variable called
player so let's go down the rabbit hole
so to speak and scroll down and if I go
to player C it looks like this function
is maybe player choice I'm gonna guess
that would make sense but in this case I
would say if that is the case we should
just be more verbose and say player
underscore choice yeah because then you
don't have to do any you know mental
gymnastics to figure out what this
actually means indeed and I might even
this is really this is now just an
argument if this is all about getting
user input I might even call it get
player or get player move or something
that just make the code self descriptive
because the more descriptive your
variables and your functions the fewer
comments you need to write making it a
verb phrase instead of a it's almost
like a player choice it feels like a
noun agreed alright so I like what's
done here we've forced the users input
to lowercase just to simplify our logic
and we're checking if the user typed in
quit or queue in which case we'll just
return none presumably meaning the user
just bowed out and isn't playing anymore
if the player is not in a list here to
like I want to know what Oh list is you
could make this a function you could
just call it in is valid move function
that just returns true or false but this
is a short program so I don't mind just
checking this global variable but I
don't like calling it o list and this
would be so much more readable too if
this were if player moved not in move
list yes before variable naming is so
key indeed I like that and honestly is
here too we've hard-coded now a very you
know it's a very smart decision I think
to put all the possible moves in that
list but here we've hard-coded those
same words there's probably an
opportunity here to like have a little
for loop iterate
over that list and print out what the
valid moves are just so that you're not
repeating yourself again small program
not a huge deal no one's going to rename
the game rock paper sis on paper
scissors here in the East Coast but
we've called described at his rock
scissors paper and that's fine too if
that's sort of the the the saying but
this could be made more dynamic and if
something I wanted to do Rock Paper
Scissors dynamite that was one that we
played as kids and dynamite go over
there but you can't do that it's a game
for the slower kids yeah okay so let me
make sure yet do we have a new follower
oh yeah who do we have thank you very
much - sorry I should have had this oh
man
you followers yeah nice William got
Doane sam says 112 that chat cat steals
vagina TV and I love man I love Malin
and then Kaiser twitch I think that was
the last those are the last few hello
I love mailing this he's good doing TV
okay well so the one line of code I do
have strong feelings on are this this is
not the way to use recursion you are
essentially checking if the player is
not in Oh list and the list of valid
moves call this function again call this
function again now a smart compiler and
arguably contr prett or top tamai zuwaid
but if you think about cs50 at least in
the context of c and naive compilers and
interpreters you're just piling all
these frames on the stack using more and
more memory for all of these local
variables again and again and again just
hoping that you'll eventually get to an
answer this is a perfect opportunity for
actually just using iteration some
languages were tail call optimized so if
I understand this correctly I don't know
if python is tail call optimized it's
not is it
I don't know offhand I'd have to google
it would depend on the interpreter to it
I think like some modern versions of
JavaScript for example are and they
basically take that stack and they kind
of repackage it from the last frame to
avoid that issue but you can't always
trust that that's gonna be in your
environment no one even in C come GCC
clang can do that but don't necessarily
do it for you so you can avoid this very
easily and then you picked player is
exactly what the user typed so it's not
bad I mean I like how you've
encapsulated the getting of the players
input I think this is can just be a
little tighter and a little more
maintainable than it currently is or I
agree all right now let's go back up to
where we started
now we kind of go we're sort of popping
our own stack like we just took a look
at that function now let's come back to
where the caller is yeah and that's how
we get the player move here we like the
comment but I would generally put a
blank line above the comment just to
make clear that this comment pertains to
the code below it and not above it weird
things and I like to see when I'm
looking through code blocks so I can see
like there's individual chunks that's a
good way to have even know that maybe I
could take this code out it because I
would probably put up a new line after
this fourth print statement here and
this seeing that by that by itself might
tell me oh that could actually be a
separate function like a little to your
point earlier maybe this could be a
separate function check you know check
player or whatever that is so yet nice
alright so let's see now once we have
the computers move and you know I don't
care for the moment how the computers
move is implemented let's just assume
that that's a black box that gives me
back an answer there's three cases
either you and I both put the same thing
like paper paper or you beat me or I
beat you so it looks like it looks like
Indra has gone ahead and checked that as
follows this is kind of clever I like
this in that we have a interesting is
curly braces used for sets what are we
looking at here yes usually used for
sentencing that's what that is okay so
what we're looking at is taking a couple
of player comma computer though those
parentheses probably aren't strictly
necessary in that context if it's in
these any of these tuples if it matches
any of these tuples then go ahead and
conclude that the player has one and
increment his or her score and go ahead
and announce as much the player wins
otherwise go ahead and assume that the
computer won if it just doesn't match
one of those tuples it's a pretty
elegant Leno like line 18 yeah you know
I'm trying to think of better ways but
it's pretty clean and I kind of like the
straightforwardness of it you just look
left to right which one beats which and
you could come up with some kind of
hierarchy but I think this is very
succinct might be a little messy if
there were more than three possible
moves but I like this ring a clever yeah
I don't like however this additional
prints here because again you're sort of
combining the games logic with or rather
with the game's aesthetics with now the
games logic and
I thought based on the main function
that game is supposed to return
something and it's having all of these
side effects the side effect in a
function is when it does something that
the caller does not know about and has
no access to printing is perhaps the
most common side effect and you probably
want to avoid that if at least you
intend to have a return value at all
yeah all right so let's now scroll down
here and it looks like I see what the
return value is meant to be passing in
game of player score computer score
pretty cool well it's a little I mean
it's a little I would say maybe
convoluted but it's I can see the
cleverness and and what they were going
well it's just more recursion which is
kind of unnecessary in fact what I would
probably have done here is in the main
function have a loop that iterates again
and again and again calling the game
every time the humans wants to play and
then figure out whether he or she has
one and increment the score it's
somewhat feels like they maybe not miss
it possibly just learned recursion or
maybe they were looking for a way to try
using recursion in a more robust context
we get in a you know CS exercise or
whatnot
so very good yeah very good effort but I
probably wouldn't use something like
this in dev I agree line 28 just a
little sloppy here I mean this is just
in English detail of course like having
a space after the comma here player
score should be two words computer score
should be two words but that's just
grammar they're not code here we're just
checking who won so I like that if
player scores greater than computer
score you won last you lost I like that
big fan of the emoticons here and oh no
it's a tie if it all actually equals the
same thing cs50 itself uses emoticons
for check50 yeah indeed old-school style
now I am carrots now let's see how a
computer choice is made shall we alright
so computer C computer choice I'm
guessing first chooses the computers
move somewhere in olace between 0 and 2
so that's 0 1 or 2 so that's
rock-paper-scissors or whatever the
order was there we're saying what the
computer did and then returning the
computers choice so that's pretty clean
implementation again Oh list tell me
what it is but otherwise I think that's
pretty clean yeah in computer also
computer choice underscore choice like
making it
we're very obvious what your nouns are
what your adjectives yeah your
adjectives what your nouns and verbs are
agreeing I mean and make sense and
randint for those unfamiliar if we
scroll to the top here this is just a
handy function that comes with Python in
the random package whereby it's were
give you a random int between an upper
and a lower bound yeah really nice well
enjoy thank you for sharing really like
this and it's definitely a nice
implementation of a very familiar game
yeah yeah so all right should we take a
look at another example any comments in
the meantime as I switch over I'm gonna
switch back here so we're all right
which means there I'm gonna read any of
the comments that lean it why should we
miss quite a few comments but let me go
back up here to where we left off okay
why does cs50 style guide recommend
inserting opening braces on new lines as
opposed to in line oh that's a really
good question because of scratch to be
honest early on in cs50 we of course
introduced students for the very first
time to scratch and you'll recall that
in scratch there are some puzzle pieces
like the if condition or the forever
block or the repeat block that kind of
looked like they're hugging the other
puzzle pieces let me raise my hands kind
of looks like this and I'll know no
you're messing it up and the curly
braces that we then see a week later in
C I think the closest way to approximate
the aesthetic of that is to actually put
them on their own line then it looks
like the for block or the if block is
actually encapsulating or hugging the
lines of code they're in and so it just
looks cleaner I think it does take up a
little more space but honestly
readability is so important especially
early on so I have no qualms about that
we only start using curly brace the
opening curly brace on the same line of
code once we get to JavaScript just
because then it's sort of what is done
in that world and we figured we might as
well show students what they're gonna
see in the real world at that point
right cool so web stick 23 says
shouldn't have entered HTML but funny
you should bring that that's really
funny because guess who's coming up next
let's do a little blip hello lip street
thank you so much for your your
repo here so this is this is cool I like
this example and and we'll go back to
some more comments I think after this
example but this is actually very
similar to what we do in cs50 when you
talk about wrapping Google in your own
custom page where you just take the
functionality of Moodle but you kind of
proxy it with your own HTML simply sure
sure and that's exactly what they did
but they did it with some see it more
custom CSS okay this is a cute example
all right well let's take a look and let
me just call out Brenda here in New
Zealand you're doing it wrong in New
Zealand you do say Rock Paper Scissors
shoot that's how the East Coast
standardizes things and you should know
that having spent time on the East Coast
here and now speak two dialects of
rock-paper-scissors when what's your
other game calls where you just always
win rock paper scissors dynamite
okay I gotta play that game okay so let
me be rather than go line by line let's
just scroll through the whole thing and
wrap our mind around what we're about to
get into okay so a lot of CSS up there
alright here comes some HTML I'm wishing
there were a little more indentation
here we've got some comments Bruin
alright alright so let's scroll up so it
looks like yeah this is gonna be an
implementation of a simple front end a
webform that submits to Google alright
so let's go ahead and start with the
HTML honestly because the CSS is
presumably the last mile so to speak
aesthetically just kind of makes things
pretty yeah so let's take a look I'm
okay
per earlier with two spaces for HTML
just because this stuff does start to
get indented but for programming I'll
hold my ground on four spaces all right
I agree actually so let's take a look
form action this is just what I do in
class so I'm fine with this method
equals get technically speaking it's not
necessary because get is the default in
html5 but there's nothing wrong with
that explicit I think is good here we
have an input whose name is Q which
matches what Google does for its own
type is text which I like as well and
class equals search B so here I might
off-the-cuff have a qualm like search B
that really isn't descriptive like it's
related to search but B maybe it's bold
or something I don't know so I'd like to
know what that if you're going to the
trouble of defining your own classes
give them descriptive names yeah my
initial thought is maybe search bar but
but again it's ambiguous it is ambiguous
and don't make me think yeah yeah here
is actually a remnant of XHTML this
strictly speaking denotes an empty
element which is a tag that has an open
tag but doesn't need logically and close
tag I actually have wavered on this I
mean HTML that it's a little
loosey-goosey when it comes to whether
or not you have to open or close tags I
would prefer a world where all tags have
to be closed even via empty elements
like this but I've dropped that because
I think I was just being a little too
anal to be honest and it is an extra
keystroke it doesn't add anything
semantically and honestly I was hard
pressed to justify it to students it
seems reasonable just to say sometimes
you don't need it and I've gotten I've
gotten I've gotten peace with that now
is it the case in html5 that any tag
that self-closing doesn't need a slash
that is not true the script tag when it
has a source attribute should not have
content but it must have an explicit
close script tag okay and that is
required and stupid is that because
normally it has a closing separate
closing tag maybe that's you want to do
that I honestly I don't know it might be
because it's a weird tag and that it can
either have a child or it does not have
to have a child and it just might mean I
have to read the specification to know
to be honest all right so let's take a
look so P class equals about I love this
class name it probably means about some
kind of descriptive text so I really
think that one works well this is going
to some long URL about Google honestly
you're just helping Google with its own
analytics you don't really need to
include any of these UTM parameters
these are just for tracking information
I would generally if I'm linking to
someone else's website just link the
most canonical part of the URL just
because but there's no strong argument
there that term canonical URL being
anything but the query string no I mean
I'm making that term up here
I just mean I know that these have to do
with like Google Analytics and stuff
like that and it's not my job to like
help them track their URLs I would just
use the most basic URL that I heard
cool URL somewhere like enroll deform
that is a term of our in HTML if you
have I think a meta tag and you want to
specify for scrapers what the the
canonical the authoritative URL is for
this page if it's accessible in
different ways so yes it can relate
there I think rel equals canonical might
even be a thing okay all right so let's
see here we relapsed class equals a one
really don't know what that is so I
would like to see that differently
differently done and here too if you're
linking to Gmail linked to gmail.com or
mail Google calm this feels like a
Google specific implementation detail
this part of the path it does work
that's the kind of thing that I feel
could break tomorrow if Google
reorganizes its application but they're
not gonna break gmail.com or mail Google
com so I would just throw that stuff
away when linking to it in a web page
and if anything that I feel like that'll
probably redirect because that assumes
you're logged in as user zero on an
account it might refer to yourself but
this is a little implementation detail
that you and I should presume to even
understand yeah but I mean the fact that
it redirects which probably shouldn't be
linking to a redirected URL yeah so this
is nice there's really we had to do this
for cs50 finance one of our problem sets
I can't really think of a better way to
do this if you want to do it in text as
opposed to an image so I do like these
class names blue and red and yellow
which technically speaking it could mean
what 0 0 0 0 FF or whatnot you can
imagine different shades of green and
yellow and blue and so forth so giving
them descriptive names and then hard
code the color codes elsewhere I think
it's pretty smart
sure so that just allows like to be on
and say blue letter red letter you know
it's it yeah we wanted different parts
of our page to be red or blue but a
different shade yeah absolutely if we
had different purposes for the the blue
or the the any of the colors so here's
that search form which seems to be
curiously in two places so I'm not sure
I'm loving this I don't know what whip
streaks intent is here but curiously I'm
seeing two search forms on the same page
so I don't think I'm loving this I did
see that and I wasn't sure if that was
maybe a bug or not or he had forgotten
to take it out somewhere else but yeah
you can visibly see when you run the
page at the very top there's a bar and
then the
yeah so I don't think that one I would
pick one or the other I don't really
know the goal here this I can playfully
say it's not 1995 anymore if you want to
have lots of blank lines you should be
doing this with CSS and you're using CSS
for everything else but line breaks here
are just sloppy I mean it's like hitting
enter enter enter enter but you have so
much more precise control these days
with CSS just add some margin or some
padding we'll have a CSS stream before
long went on Wednesday so you can learn
a bit more about that and lastly we have
a link to Facebook some arbitrary amount
of space here which I'm not loving
because it's gonna be collapsed by the
browser into one yeah so I don't know
what to think about that so I don't
there and say we would do they ampersand
whatever the nbsp cola semicolon right
if you want multiple but there too no no
that's like 1996 in this case I'm gonna
use some sort of CSS that moves it yeah
and probably make it an unordered list
and then style that list in some way
sure here we have a link to the speller
P sets and then a link to cs50 s
websites and similarly I'm not sure we
need these spaces here I would just
defer to wheezy whip streak sorry I was
gonna say wheezy print which is the
library we talked about a week ago on
strand that's still in the render 50
moon and this is just a typographical
error of course there should not be that
second close break but the nice thing
that that illustrates hTML is very
generous with this parsing it will parse
all the way until you screw yeah I don't
know render the pay it's probably gonna
be fine
even though it's indeed a little buggy
so let's look at the CSS sure all right
so let's scroll up to the top here and a
couple of notes so in html5 you don't
need to specify the type attribute you
can just say style and keep that more
succinct I'm fine with the stylization
of this like it looks like whip streak
is being consistent by keeping the curly
brace on the same line totally fine
especially with CSS frankly this is
where I'd like to see more indentation
though because it would just be a little
easier for my eyes at least to
understand that this is inside of the h3
and not lined up with something else but
again that to each his or her own eye
would be considered yeah now I can call
you on this if you're gonna have spaces
after your colons have spaces after all
of your colons they're missing in the
top to here so that's a little messy I
would argue
this is just me being nitpicky I tend to
alphabetize all of my properties just
because it's easier for me to then
glance later at long lists of properties
if something's there or not
otherwise I have to do literally Big O
of n linear search to search the whole
thing
so in short lists not a big deal but
when longer lists just pick a convention
maybe it's the most important properties
come first I would be convinced by that
but I just do alphabetical that area's a
definite holds water in the context of
for example in Python having your
imports at the top of the file oh yeah
no it just keeps you sane like just
spend an extra second alphabetizing now
and not wasting time later skimming to
see where something is if at all agree
so I'm fine with the rest of this pixels
although this is okay will come you will
price spend more time on this perhaps in
the CSS stream just a little bit on rim
yeah you don't need to specify the pixel
sizes of all of your fonts generally
speaking you would choose a default
pixel size for like your HTML tag or
your body tag as the default for
everything and then everything after
that should be relative to that font
size using these days called REM a
relative PM text-align:right I'm okay
with that
blue red green yellow I'm okay with that
too because I think that's in the order
in which you're using them perhaps in
Google but maybe alphabetize them maybe
not I don't really care there because
there's only four colors form text align
value color blue search I'm okay with
all of these still search B I still
don't know what this means
honestly in search box maybe yeah search
box and I'm unclear now what the
difference is between these two one is
smaller one is bigger oh maybe it's
search big if the two different forms
they have the two different ones at the
top and the they go to the same place so
I don't know what's going on maybe
that's just remnants whip streak would
know if you want to comment there whip
streak here's our anchors height and
width the catch here is that this height
and width these are inline elements I'm
not sure this is actually gonna have an
impact we'd have to render this but
insofar as an anchor is a inline element
by default display call an inline height
might have an effect I don't know if Oh
with my II I don't know what the
behavior is interact with two
and heightened not to buy even now I'm
testing I have to play but this seems
dangerous either way because if you have
links like Facebook and Twitter I think
we saw you're now confining them to a
fixed number of pixels even though the
words might not be the same length so
this just feels a little dangerous
anyway a one definitely don't know what
that is let's definitely rename that is
it kind of hot sauce isn't there you go
here here in the US indeed in button one
oh you got me wondering well if there's
a button one where it's button 2 or 0
yeah so and also give me something
that's in curly brackets here on on that
part yeah I got a little sloppy at the
end there and I don't know about this
new tab title now that I see it but
that's ok is that is that how Google
does it's a good when you open up for
example if I do Google com oh maybe are
we looking at Google's own source code
oh no not and it is a good word then
yeah but if I open up Google you'll be
it on Windows here new tab I'm getting a
little suspicious here no okay we're not
looking at Google source code perhaps
whip Street re-implemented it I was a
little suspicious you submitted Google's
code to us in which case shame on them
for all these little things but that's
ok for the first time around for making
a form like this no we're sure it is not
yeah I like take a look away from code
actually look at a web page instead I
thought thought it was a nice little
yeah sure we got any comments that come
in yeah watch you I'm gonna bring us to
the to the blank screen web site ahead
and choose the next repo there and then
I'll filled out some of these comments
here demands er professor Malin is it
possible to have more projects to
practice in the cs50 web dev like
they're not obligatory for students but
for self talks it'd be a gym to have
those projects so short answer yes if
you haven't to practicode it to practice
in that course short answer no how about
to refer you to that same course nothing
comes to mind except this could you go
ahead and type in cs50 Harvard edu slash
beyond this was a one-week course that
cs50 is on Brian you taught recently who
also teaches the web 50 class that does
have some smaller projects there in you
might want to take a look at they're not
as
large scale as the ones in the course
but take a look at those but give us
time and we'll hopefully flesh out
what's available project wise and you
can also kind of choose any website that
you like or that you were inspired by
and kind of reverse created it's a nice
exercise it yeah we I'd learned games a
lot of the time just kind of taking a
game that I know and breaking it down in
reverse engineering it applies to any
context web and being among them and
with creme de the chrome developer tools
you can more easily do that as well so
positive social is coral option list
Brenda proposes option lists that make
our oldest that makes sense that makes
sense although this the naming I think
player mu or move list would be homes
yeah yeah if the player holds down the
entered the game could crash because of
recursion they're saying with the rock
paper scissors because enter was
considered a invalid oh yeah potentially
if there's no optimization of that yeah
recursive call said how do you start
winning Python I want to learn AI
programming says kill Co at 1080 oh my
goodness you know two years ago in cs50
we had a lecture on AI that gives you a
hint at how you can go about using it we
used sentiment analysis in one of the
problem sets which was one such example
there of albeit a simple one and in fact
if you google cs50 sentimental problem
set odds are you'll find the
specification if you'd like to play with
that and that one was in Python though
not in C or C++ I'll have to get that
one some thought for other such
references keeping with to missus when
we're doing databases ORM in flask and
to your point before about beyond brian
has a lecture on or around yeah you can
check out that same URL for or on I
don't think we've scheduled anything for
on stream we're not forums but all if
somebody a flask you did on flask we did
we maybe will do a follow-up flask so
got stream that has more detail okay TC
tail optimization yeah and then some
folks I think ended up talking about it
but in options I know that we have
excuse me hello I'm Andres right I
actually ran into this with a demo in
class it does I think it is hard coded
at a thousand function calls one on top
of the other so thank you Andre for
pointing that out
if you
if your science says JP guy JP guys
plugging some links in the chat
Harvard cs50 learn Python other
languages sometimes tail call
optimization messes up the back-trace as
flint 16 I could imagine that being
possible if it's if it doesn't preserve
any information about prior prior frames
we there's one question which
programming language do you think is
best for beginners in 2019 on jugo first
best for beginners in 2019 probably
Python for beginners from and I mean I
think seems to me does a great job of
using C and scratch too I think if I
were gonna teach somebody I personally
would have an easier time I think in
more productive time using Python but C
does lay a great foundation that the
students can build off of and scratch is
much easier to get into so I don't know
it's it's that's kind of a religious
thing I don't think it's necessarily
hard set yeah it's just in Python what I
don't like and we just did this this
morning actually at Harvard Business
School where we're teaching a course
called cs50 for MBAs for business school
students I think it's certain layers on
top of Python has certain abstractions
like for I in range of such-and-such
that really doesn't make obvious what is
going on and I love the pedantic nough
sub C and Java and C++ where it's for
int I equals 0 I less than n I plus plus
where it's really very mechanical I'm
you can almost see the gears moving
inside of the computer and even though
it's a little more tedious there's
really no magic and frankly range of N
is magic I think yeah so if you're
pressed for time
I might even propose doing what cs50
does in play with scratch get a little
comfy with that learn C a little bit of
C and if you really want stopped short
of pointers even though I do think
there's very high intellectual returns
even though high emotional pain that
comes along with it and then transition
to Python but I do think learning to
program and C go understanding what a
compiler is and really going through the
pedantic process of making source code
turn into machine code is valuable unto
itself yeah I agree I agree click off a
couple other comments and then
transition to a fourth example so this
is a very login assembly yeah those
probably not those probably not those
options okay here we go Thank You Andre
for inferring what my answer would have
been no
jabs with danger noodles as trolls lol
I'm not sure what that was reference to
yep and kloppenburg also knows what's
what Andres referring to alas is Lord
oxic Johnny Bravo's descent into gaggy
animus and get one which is reference to
my hair probably I need to get a haircut
hasn't you said that last time and I've
said that for like three weeks now
did you notice there's no check for the
quit command says meow cat missed that
actually I'm not sure so miss ml new
mentions that computer see only works
with three options that's true I think
I'm okay with that though because at
least as far as I grew up not without
the dynamite option there's only three
options and so in this case I'm okay
with the hard coding because the reality
is this game hasn't changed in 40 years
for me and probably isn't gonna change
next year either anything different on
the west coast backs it up a little bit
we just thought David does not check his
Twitter that often feel free to email me
my email address is on the beginning of
most of our videos but I'll try to
remember later today to check that out
as well and the whip whip streak was
very happy that we chose his repo and it
says search is the second search so like
ABCD nice alright should we take a look
at some more code yeah so what do we
have here oh all right let me switch
over to our handy-dandy surface here we
have J 50 ones weather tool Thank You J
51 for contributing this awesome but
here really quick let's verify that's
there if you want to go back to the just
make sure that that's there JL 97 is the
twitch username so today all 97 we have
seen quite a few times in the stream so
shadows to jail 97 nice actually he just
commented totally agree with the Jetta
and which programming languages here we
go all right you say that now but here
we go with some feedback Jay Jay alright
so as before I'm gonna start with the
readme just to wrap my mind around what
we're looking at a CLI weather tool to
display the weather in your area area
CLI meaning command line interface so
text-based
I am a fan of the styling of oh it's I
forgot this is hush can you can you do
this you don't have to use the arrow
keys but yeah the I like these the
stylization of these checkboxes with
these bullet points I mean having a nice
readme is pretty valuable and if we had
time we've go into more repos I had
really nice readings that I wanted to
mention we might not have time in
particular one button in part two maybe
but having little things like this kind
of really visually lets me parse what
this application is going to try to it
is but if we want a nitpick the readme
usually checkboxes mean tasks that need
to be done or have been done and that is
true here but I read how it works as
instruction as a summary of what it's
doing and honestly this probably should
be a numbered list that's one step two
step three we're not gonna pick pick a
pick on the readme alright so how to
install you'd clone the repo CD into the
project to create a virtual environment
as discussed before install your
dependencies and now you can run dot
slash app dot pi I'd only quibble here
you have a wonderful enumeration of
steps one two three four five and then
your sixth step is kind of hidden at the
end of your fifth step I just move that
out to make clear how that last step
actually runs just to be dummy proof for
people like me on the internet here I'd
say all right so let's go ahead and dive
into ok oh you want to look at
requirements not txt just to see what
you're using all right Auto pep eight so
that's actually the tool but it's
similar to the website we pulled up that
will automatically check the style of
your code a few packages here I'm not
too familiar with certifies SSL
Certificates I know that ok I remember
we had to deal with that requests URL
Lib relates to URLs so some familiar
ones here as well alright let's go back
and let's take a look at init PI and
there's nothing in there which makes me
think we can probably get rid of that
although if this is implemented as a
package might technically be necessary
to have it somewhere that you you do
need that for packages but I don't see a
setup dot PI so I'm pretty sure we don't
strictly speaking need this but let's
see oh if you're just if you're nope
because it's not importing anything no I
don't think that's serving a role here
but please J chime in if if you believe
otherwise this is great look right here
on line eight and nine criteria prior
point before double-spaced yeah I like
that someone's been using auto Pepe very
nice so this is a shebang at the top
which makes the file it makes clear that
how it should be interpreted frankly the
convention though is if you do have a
shebang or haps bang at the top of the
file you don't need the file extension
one of the whole points of the shebang
is to hide that implementation details
so it's a compiled binary a Perl script
the Python screw
the user doesn't need to know so you can
change the programs name to just app or
maybe even weather tool the only thing
that quibble about here is just making
them alphabetical this just seems thrown
in for no good reason even though it's
not admittedly a long list so let's say
def main tool equals weather tool
strictly speaking I guess this doesn't
really need a line but I might then just
move this line of code line 11
underneath the comment just because
that's where you're starting to use the
tool but then you're using it down here
too so I don't know I'd like to
understand a little I just don't like
the inconsistency it's commented it's
commented but it's not commented what's
nice is that they put main at the very
top of their primary help space yeah
very good comment agreed
all right so if tool if the user
provided a city go ahead and grab that
else if the cities in the environment go
ahead and grab that else go ahead and
get the location via the tool somehow we
don't know how that's working yet and
then save that city to file so I don't
quite know maybe this isn't kind of a
local cache these are just saying a
cache yeah so that way you can keep
pulling it over and over and over again
you don't have to read and enter into
the file or into the program yeah but
very nice style I think here no no
qualms really in fact the functions are
all pretty straightforwardly named and
even though I don't exactly know how
this works I can infer that okay it's
getting the location somehow I'm not too
interested in how just yet
alright so API key if the user provided
his own API key go ahead and grab that
and save it's a file else read it from
the environment let's use this one
that's hard-coded here so I do have a
few opinions here if the user let's see
where this would be coming over from
somehow passed in the key I don't like
how you're saving our credential to a
file presumptuously it feels like I
should be alerted to the fact that
you're saving it maybe this is not my
machine maybe it is a machine but
someone else has access makes me a
little nervous at least some kind of
prompt that says this will install this
file and whatever location haywire in
indeed this here unless these are no
that's a single quote this is not going
to work this is a string in the middle
of nowhere
I think you probably meant for this to
be a comment and not just a stir which
this is I think you
and does that one thing you can just
post regular regular strings with one
quote yeah
really I think so that's a percent sure
lack and we're gonna secretly Google
that off-camera I keep going and I'll
look into that I'm kind of okay if this
is indeed a throwaway API key that's
hard-coded into the program that's fine
but convention would generally argue
that you should put at the top of the
file in a in a variable global variable
that can be changed or even a
configuration file that accompanies the
code just so that it's not buried
somewhere in your logic here I benefit
from a line of a comment saying get
weather for current city and key or
using key and then format text should be
formats without the e grammatically but
otherwise looks like that's gonna
somehow print out the weather all right
so let's scroll down here to how this
function works it looks like weather
tools implemented as a class which is a
common paradigm if you want to
concatenate some related functionality
and perhaps some data as well here we
have an init function we might not have
seen this in cs50 but if you've gone on
further with Python this is like the
constructor to a Python class the
function that's called by default by
convention its first argument should be
called self and thereafter it can take
zero or more other arguments the
greeting nice cute default here with
another emoticon just to just to close
that loop so you definitely can do it
but it's frowned upon having a single
quoted string as a dog's restaurant
however common yeah I've never even done
it so I've only used triples yeah
triples are which are idiotic looking to
be fair a little bit they those actually
get parsed by tools as documentation
right well then those we won't have that
effective the single interesting I
learned something new Thank You Jay
alright so argument parser I'm a big fan
of this we use this in all of cs50 s
command-line tools for actually parsing
command-line arguments that the human
has typed in just makes your life easier
so you don't have to parse Arg V
yourself it just feels a little messy
here like I like how you have some
comments here but this one's capitalized
this one isn't this one isn't there
isn't even a comment up here so it just
feels a little sloppy here so again
maybe things that Stan insistency very
important yeah either have them or don't
have them but don't kind of sort of have
them I would say for more on this do
look at the documentation it's actually
a little hard
frankly the Python documentation is a
little non-obvious stackoverflow and
Google will probably explain these
better but there's a lot of handy
features like type and args which can
really give you flexible handling of
arguments this already is a lot more
readable with with the steps that they
did employ with the commenting and then
the spacing of everything yeah there's
still certainly areas of improvement
indeed so just yet a little messy here
like what's going on here I'm kind of
you know I'm getting confused I put it a
comment above here rather a blank line
above this comment be careful with the
English especially if you're
collaborating with someone else this
probably is meant to say enter en ter
multi words should not be capitalized so
again just be consistent because your
code and your English and your comments
is gonna reflect I think on the care
that you put into something I mean it's
certainly fine if English isn't your
primary language but certainly when
you're at the point of wanting to share
your code and having others look at it
just you know run things through Google
Translate Microsoft Word Google Docs
just to kind of clean things up because
I think it'll just reflect well on the
code itself or just ask like have
someone like you know me or Colton or a
friend just comment on your code just
like we're doing here no big deal at all
alright so let's scroll down here join
yeah if they enter in a multi-city word
like I can infer what you're doing it
looks like you're putting your URL
escaping it by putting pluses instead of
spaces however someone else previously
use this that URL Lib package and Python
don't implement escaping yourself let it
function do that and you can use pythons
URL Lib library to do all of this for
you and the computing other special
characters from lists to string whatever
right because if the user typed in a
funky character like a question mark or
an ampersand then that's this could
potentially break because you're gonna
be passing in an invalid URL alright and
then it looks like we're saving to the
file alright so what else is going on
here there's a get weather function that
takes the actual API call itself yeah so
again no doc string and that's kind of a
thing I mean you get the great variable
naming children function naming choices
get weather I know that's a verb I'm
getting the weather that's great get
location save the file but still a doc
string that specifies the flow of the
function
inputs and the outputs I think that
that's really nice to have really nice I
don't know and J if you're there still
I'd love to hear what you what you
intended here I don't know why the
function is being passed in dynamically
like this and while you're not just
using requests get could be if you don't
want to require requests as a dependency
and the user wants to provide something
else but you can just pip install or
easy install it so I'm not sure J do way
in there nicely formatted URL here makes
clear what's going on you're calling the
function and getting back the response I
instead of our I would call it response
even though we all know what's going on
here you're getting the JSON properties
from the API and then you're just doing
a dictionary comprehension here to
actually get at the values you want and
return those and then down here get
location so looks like IP info this
looks like a nice free service for
looking up geo-locating a user I presume
and then a function for saving to a file
here so what I'm not really seeing
what's nice though they do have a try
except to a file not found
all that is nice your point before
indeed so I'm just skimming ahead and
honestly I'm not seeing good motivation
for a class here because classes would
typically be used to share state across
functions or to encapsulate some
real-world entity and while yes this is
a weather service you're not really
storing any state to be a singleton in
this case and I don't think that it
gives us any value if there aren't other
classes to which it's you know in a
company in a ecosystem with yeah I mean
I would rather see this not really as a
class called weather tool but like as a
Python package called weather tool from
which you can import functions like get
weather for a given query or given any
given API key get location to geo locate
a user saving to file is kind of a
helper function I think I would actually
get rid of the class and then honestly
all of this argh par stuff this is what
should really go and whoops this is what
should really go I would argue in app
dot pi itself outside the class this is
your app you're doing the manipulation
but you're building an application that
uses these helper
that you could absolutely encapsulate in
a Python package but a class is kind of
a very Java esque way of encapsulating
this information python has packages and
modules for a reason so I think you can
get the same features but without adding
a class which you're not really
benefiting from here I agree especially
given there are other classes that it's
mixed with yeah indeed but I do like
your error handling with the exception
as Colton points out using width which
is nice because that automatically
handles the close little debugging
information making n file although that
could probably be parameterised you know
it's very common in programs to have a
verbose mode where if you really want to
see what's going on run it with - V or -
- verbose I would make the printing
optional because otherwise it's just
cluttering the output and then lastly
formatting the text anything to comment
on here just the the spaces between the
comments and the code yeah just give us
a little more readability here yeah I
don't like seeing all that scrunched up
functionality together yeah indeed all
right well very nice well thank you Jay
for contributing that really fun example
to look at as well altogether a very
good variable naming and well style just
means a few minor - yeah I think so
should we take a look at any questions
or comments that have come in in our
remaining time yeah sure so we're right
about at the end so I'm gonna go home
there's a lot of comments and then come
up here where are we left off and I'm
just gonna take us back to our okay
got me in there so you can see us in
larger size you know wow yeah we already
saw that the Twitter yeah so okay react
JC Nick have a closing tag and every
elements is on cue
look for the question of ours why not
run the code in a private browser tab
I'm not sure oh we could we were gonna
focus just only on the code though today
not I'm actually running things lest
there be some correctness issues yeah
and we went kind of long as is or at
least it took a long time as is which is
good I think that there's a lot of good
points to bring out but if we were to
also run the code and test it live I
think that would inflate the D flare
decrease the number of projects we could
potentially
examine search be is the second search
box okay so we did notice that in whip
streak if you're still there and want to
comment why were there two though just
curious are you actually doing coding
review of viewers yes indeed we did
Steve Ronix we solicited people's code
by a Google form and pro do this again I
think yeah finding it useful I like this
a lot
twitch code reviews was a shorter URL
unavailable I wanted something that I
that a yeah not too generic
okay via Steve UNIX we could we're
probably running short on time today but
do go to the form that Colton just paste
it in yeah submit it we'll take a look
at it and then we'll include it if if we
think it's you know there are a few
first of all there are a few problems
with people submitting their repos
private so we can't actually see it so
you'll have to make them public so they
can indeed do the source code and then
additionally make sure your project is
at least roughly feature complete we had
a couple folks who submitted essentially
a very like a light shell of an
application on a full application
something that was heavily in progress
so make sure your code is at least
mostly complete if not complete
altogether
indeed I should say out saying hello
hello hello to India from Cambridge
[Music]
maybe when we do a a JavaScript stream
in the future Ashish [ __ ] plug that
again we're gonna be a little light on
time - I think dive too deep into some
into some JavaScript code here of what
is random REO I'll pluck this one off is
called and keep scrolling what is the
name of RAM random access memory this is
a very random question for our code
review to move random access memory
refers to a type of hardware that the
computer can randomly access in constant
time and it's not random is in just pick
any location it means it can jump in
constant time that is instantly to any
location it's not like an old-school
cassette tape or record that has to spin
or be accessed serially it can jump
randomly to any point immediately cool
do we still have seminars on SDL - sis
116 now there was really no idea anyone
recently Thomas lively did one a long
time ago it's on the YouTube channel and
also I have to shout out all the people
that followed with no less like 30 or
more minutes we have a lot of people
hi guys so kill CEO 1080 I think was the
last one Sam code let me just get to
this little thing here it's great a
little too fast
Sam code Adam KDX be lured oxic Reds 96
gonzo zero zero zero seven seven seven
Liam will be Nikhil Shaw 30 maybe Lamia
Basti Fenway cheer you Kong giggity VP
five seven Philly seven and Al Ahly afin
wow there was a lot of people thank you
very much for following much appreciated
good job with the pronunciation that I
was just letting you take care of that I
had as I almost struggled a little bit
it's funny the Jason G is saying that's
funny that yeah they have a Mac and we
got a he he got a Mac and it's in the
interim period between he was last year
and we got a Windows machine Oh
trade you new thing there's a matter we
access you get constant time access
Aslan Spota Goran Rufus to Graham
Kloppenburg is making a reference to
calculation like hello to Janelle who
just followed Danilo Gallinari
ml lube the way you can accent you don't
need to do sequential searchers so first
you can directly access a value at a
given address so here's one is it
possible to include Python in an HTML
site I tried JavaScript but Python is my
preference short answer no not on the
client side you can certainly use Python
on the server side just as we've been
using in flask and cs50 and last week
stream on flask and in others you can
technically run Python code in a browser
using a Python interpreter implemented
in JavaScript but that's a very
specialized case and so I think the
short answer is is no use Python on the
server javascript on the front end yeah
see this is this is a bit of a
controversial statement C's for computer
science students Python is for
programmers over everyone can learn a
little C Haskell is for math fans as
Flynn 16 that might be true ml noob
brain bleep is for brains I'm not sure
don't have any don't have any brains
inside
SuperMario and debit all thank you guys
welcome aboard everyone you create a
Python interpreter with the languages
support on the web JavaScript and web
assembly yeah Julia keeps getting
mentioned to as a programming language I
don't know much about it but it is more
of a specialized tool that seems to be
getting momentum and we should look into
it I heard it about it a long time it's
been a long time since I worry about it
but yeah oh yeah no I hear good things
but can't really speak to it just yet
totally agree with the Jedi on which
programming languages one should learn
when I was in school they only offered
basic Pascal and Fortran juban through
it was that roughly around the time you
basic I mean they were all around basic
I still remember seeing basic was fun
because you numbered your lines and the
Convention was to number them like 10 20
30 40 feet just in case you need to go
and add nine more lines in between lines
you already wrote without a number and
that is that scrap design again I
understand it there is it possible to
stream on operating systems fundamentals
with Professor Malin who is that
something that you would want to do sure
if you'd like to teach me about
operating systems I'd love to turn into
that no it's been a long time since I
took an operating systems course if you
want to be more specific as to the
topics we can try to refresh ourselves
but it's I'm rusty is it too late to
register for code review no I just
submitted the link the bitly URL and
martin kindly we plugged it so submit
that we'll probably do another stream on
this in the future because it looked
like we have a lot of viewers today so a
lot of people are interested in it so
definitely if you want us to review your
code we'll take a look at it and we'll
do a part two of them or part through
your part and whatever does anyone want
to do pleasure of doing it I'm not sure
if that's reference to the code review
Sasha kaun hey I'm super late yeah we're
just about to close up now Sasha kaun
that's okay you can always tune in to
the on-demand version which we'll post
on the stream shortly yep thanks it's
this video tending a lot of hackathons
and building cool websites that's
awesome glad to hear
Jacob or Jeff catch a since I think hey
guys what's up we just finished the code
review you're gonna have to probably
tune in to the vaad but unfortunate that
we had to miss you but we might do a
part two yeah what's your opinion on
react J yes who are certainly super
popular these days it's an alternative
to things like angular
view j/s and the like it's pioneered by
Facebook freely available we do have do
we have a stream on it yet Brandon a
basic stream by nu into Manik and we
might do a second one at some yeah so
I'm not used it much myself but it seems
sort of inevitable because forefront in
it has a huge amount of momentum right
now and it's all about having one part
of your page or Daum react to changes
elsewhere so it makes sense and it
actually does solve a problem makes
things much more interactive than just
our typical Python and JavaScript raw
JavaScript alone so it's worth looking
at it's just syntactically a little
messy it's not much better than view and
it's not much worse though than things
like view but it's a useful paradigm and
I would definitely start learning one or
I would encourage you to expose yourself
to one of those frameworks at least just
so you're familiar with these
up-and-coming paradigms
KooKoo well we are weird there was a lot
of comments today but we're talking
about doc shrinks earlier talk sharing
has three quotes correct not the single
one Oh jail 97 was saying that was a
typo so maybe he meant to do the three
the triple quoted string but the single
one is still legal oh just just escape
that one J and look at this whip streak
I see you're ten years old thanks for
looking at my google rapper code I'm
only ten years old and it benefited so
much from cs50 that's awesome Wow
welcome aboard and not expect that thank
you very much for joining that and
realize you're a ten yeah I hope that's
helpful it's incredible yeah props to
you for getting in so early I'm
interested in web development says meow
cat at a age of twenty plus a bit of a
security stuff like reverse engineering
and the security stuff was very hard for
me to learn should I give up I didn't
try to learn web dev except a little bit
of HTML and CSS also I didn't learn in
university the thing is that subject of
the seat of computer science is
interesting to me web development in
particular but I'm unsuccessful and I
need to find a place to work I need
advice yeah I mean I definitely wouldn't
be discouraged if you liked the material
then certainly porridge ahead it could
be the course you were taking that you
didn't like maybe it was cs50 and our
security discussions and that's fine
find some other course or find some
other person or mentor that resonates
with you and that is more accessible
look for any number of free online
resources or PDFs of books or actual
books or the like and ask for
recommendations among the audience here
ask folks how they went about learning
about security as people like us for
recommendations
certainly no reason to give up this
people find different aspects of
computer science more difficult than
others I struggled early on with various
aspects of computer science theory and
it's only 10 20 years later that I
actually realized in retrospect wow that
was really interesting I just wasn't
good at at that time and that's fine you
got your whole life to sort of get
comfortable with material and you have a
whole community of support out there to
support you in the meantime let's do
some Theory streams because I want to
learn more about that to a camping
burger and Samir eight eight one one
thank you very much for the follows
puppy stomper 92 well that's it I'm
inspired nice we did it nice yes why do
you want people like to show off their
age ding of Jason's I don't know that's
pretty impressive I wasn't programming
at the age of 10 so I didn't start until
I was maybe 15 16 that was like two
years ago I know I remember starting
program when I was 12 sis Kaiser twitch
but I only found the cs50 c-sharp this
is probably this C course with when I
was 14 it's great that you're learning
this while you're young you have a great
jumpstart you didn't do any Seashore to
know if you found the cs50 c-sharp
course let me know because I don't know
who's teaching that yes we teach cs50 in
C which is an older language moah Farouk
a credi and logic thank you very much
for the follows they really enjoyed
their birthday it says the Lance
protocol in Spota Guara ml new can't
blame anyone for saying their age can
you I'm more happy about reading about
age than reading insults sure okay that
makes sense
oh there's a URL URL encode layer URL
loads I feel like they're doing social
cool they are flown 16 for unit tests
what is that a reference to I'm not sure
I understand that that question
dependency injection must have been in
the context of what we were talking
about before
dependency injection for testing Oh for
the for the API function that took in
the request gate function as an object
they were saying for testing dependency
injection okay yeah if you want to stub
it out okay make sense is the stream
broken for others as well no it looks
like we're we're still going alive
you know I was a while this is other
back okay interesting I didn't see it go
down a good motivation for a class what
do you mean is motivation a thing or
just a cliche by motivation I mean does
it make technical sense not like I'm
motivated to write a class but rather
does it solve an actual technical
problem and I would argue that in our
last example it didn't really this is a
problem the course we asked folks to
submit code that wasn't part of the
class says Brenda in a reference to oh
galvo Bart asked is this code for a
problem in the cs50 course no and
actually we encourage the opposite we
encourage non pset code so that we can
look at it and therefore not give away
spoilers to people taking the class for
the first time what is the best way to
learn more about CS as a student I'm
sixteen asks Bazeley I think what you're
doing right now tune into educational
streams like this one or others that are
out there Coursera EDX iTunes U YouTube
itself so many free curricular resources
out there so just find topics that
interest you and better still find
projects that interest you so that
you're not just listening and watching
you're actually doing agreed meow cat
says low level stuff important ApS
tonight will you guys review remaining
repositories if yes when I don't think
we've decided just yet we do have a
great collection of code that people
have submitted will definitely puck off
some more of those so just stay tuned to
cs50 s Facebook and Twitter and reddit
for announcements as to when we'll be
doing that yeah the twitch feed itself
will definitely do some more we'll
announce it very shortly in pool hall to
thank you very much for the follow best
ways to make a goal and not give up till
you accomplish it says meow cat in
reference to the last comment that you
also responded I think it's the best way
or find something interesting to you and
learn it and do it well
okay if you're on lanova that's a
reference of me I swear Mao cat said
puppy puppy stomper oh here we go hello
this show was fun enough that I might
come back to twitch nice well welcome
back that's a success on our end as far
as I'm concerned okay was it where is
the best way to learn it especially if
you're not inhabitant of the you know
it's like you need to be in the u.s. to
be honest I mean the Internet is
assuming you have internet access the
whole world is accessible to you in
terms of academic resources there might
be a lot of content coming from the US
but there certainly is abroad my daresay
most half of the people at least tuning
into the stream today or not from the
United States we saw several countries
explicitly mentioned so certainly don't
read anything into the fact that you're
not in the US Google is your friends and
again those sites I mentioned EDX
Coursera YouTube iTunes you ask people
like us ask other classmates in the
stream there's so much out there yeah
yeah definitely if you can get on Twitch
then there's you know the whole
Internet's basically open to you best
way is intuitive just try Google Learn X
and find a bunch of results I think yeah
that's kind of like that yeah just jump
right into the water approach open
source curriculum Lintz Protagoras
suggested cs50 on YouTube yep we have a
lot of videos on YouTube including all
these twitch streams if you're
interested and swordsmith plug the link
as well to that same thing playing
reality I'm a fan of c-sharp personally
I think one of the repos that we had
that we might review in the future is
c-sharp so tune in for that is rust a
good language to practice data structure
since the ham 95 I don't have any
insight I'm not sure I've heard great
things about rust I know it's a systems
level language so probably but I can't
speak authoritative lead on that a crazy
saying I like your style and passion for
CS surely probably a reference to you
may be using garbage collector language
borrow checkers very odd to make sense
of where can I find a mentor says meow
cat oh as a different question mentor
ask people here honestly do what we're
doing ask people hey everyone here's the
gist here's my github repo would anyone
mind commenting on my code and see what
kind of bites you get I'm sure some
people would be happy to and the tuning
tuning into these streams you might even
find someone in the
you know who might have some knowledge
that is relevant to you that you could
dive into or sorry start a partnership
with and maybe collaborate on project
Samir saying hello guys David you are a
legend oh no kind thank you for the
comment Theory streams would be nice
thought I said CLO else's kind of
Twitter yeah their friend of your C
course okay not the C course alright
good good can you do a stream on Java
I'm enrolled in a course which is of
poor quality struggling a lot need your
help people yeah it's a good question I
have to whip out my java background but
you should do that that'd be a good one
yeah I yeah I definitely asked them
Henry but I'm not sure if he'll he'll
have time now we are getting a you know
a little bit long on time here so I
think this is where grow up to one
questions surely higher sure yeah let's
see Ashfaq sighted syad if I'm
pronouncing her correctly I want to ask
David what he does when he gets stuck on
a problem a problem solving one and is
stuck I already asked Colton and it did
help me a lot just wanted to know a
different perspective how a mentor did
it in his time that's okay we'll give
you a better answer then you already
tried here once on the stream
I mean honestly asked lots of questions
of friends do what we're doing literally
right here when I was learning another a
new language years ago called PHP very
popular at the time for web programming
I literally it was instant messaging a
friend of mine questions constantly
probably annoyingly so because frankly I
guess I wasn't very good at reading the
documentation but that helped me hugely
and just asking questions of the PHP
documentation - I know it's ironic
well once I discovered it so ask lots of
questions of others and do code reviews
I mean this is how you get better even
internally here in cs50 for the most
part any time we're working on some tool
that we make publicly available one or
more of us is actually commenting on the
changes before we actually ship it or
make it available online so that it's as
good as possible hopefully and even then
it never is we're constantly iterating
even on old code so ask lots of
questions and for lots of feedback cool
okay
and then maybe the last okay sorry you
bet often I was just gonna say jabbed
coches in the university I go to to just
PHP in 2019 help I mean it's not such a
bad thing I mean PHP these days is a lot
cleaner a lot better than it was in
yesteryear and even though there's some
remnants of earlier versions of PHP like
there's not it's not a bad thing per se
with that said Python definitely has a
huge amount of momentum nodejs and
JavaScript have a huge amount of
momentum these days Ruby seems to be
fading a little bit Java seems to be
used certainly but more in the
enterprise world and less in the startup
world and the like so so long as you're
learning fundamental concepts about web
programming and paradigms it probably
doesn't matter too much what language
you're using and honestly that's fine do
your homework in PHP and do your
personal projects and node or Python or
something else
all hail in the mail in says Jesus 1884
and then maybe the one of the last
questions will pluck off what is the
best way to learn Python in 2019 we're
just learning the basics then just doing
projects be a good way to learn I think
so actually doing like I mean I'm still
learning Python I mean case in point
learning that you're gonna have the
single quoted string if you want to use
that for commenting within your code and
just over time you start to learn less
and less once you get more and more
comfortable with the language so it just
takes time in terms of how to do it
taking a course is generally helpful I
think because it provides you with
structure maybe a little pressure
timewise and hopefully the instructor is
good enough to help you make your way
through pretty dense material in a way
that they think is pedagogically optimal
and that's maybe better than just
googling and reading entirely on your
own and then someone else asked a moment
ago how much time does it take to learn
a new language I don't know it took me
like a year to feel comfortable with
Python after teaching ironically after
teaching it and after using it for
various projects so I don't think
there's a hard number there I would say
using a language for at least one big
project maybe two projects and then
you're probably gonna Google less and
look less stuff up but I'm still
learning Python even what three three
years later four years later or
something like that it's been three yeah
but just be comfortable being
uncomfortable right Google's out there
it's not that compiled
a goal to memorize syntax or memorize
functions just know how to solve
problems and start to notice patterns
and new problems visa vie problems
you've solved in the past
where's case you'll mess up in front of
tens of thousands of people on video
there you go that's good pressure too
you have a lot of people watch you on
the internet and make fun of you when
you do mess up and you won't mess up
very often I don't know about that I
still mess up all the time a lot of
people watch these streams I think
that's gonna be it a lot of people had a
lot of amazing chat interaction today a
lot of people tuning in so clearly
there's interest in this program so
we'll continue to do some more of this
stuff we'll think about what the best
time slot is we'll get me and David back
in here sometime within like maybe a
week or two but yeah definitely if you
haven't already I'm gonna type it in one
more time see Billy says cs50 twitch
code review a bit of a long URL but that
will take you to a forum a Google forum
where you can submit to us your twitch
username you and then also your gist or
your get up repo make sure it's public
and then ideally make sure that it's you
know roughly fairly feature complete at
least 75% or so because we don't want to
necessarily figure out why it's half
implement that I encountered that issue
a couple of times and then thank you
also player X 5x and Tech a techie
Elliott to be for the follow and onku I
love you too thanks for tuning in yeah
thanks everybody so much up tomorrow
we're gonna be joined by Brian you
previously to the stream on react is
gonna be doing a stream on
object-oriented programming so if you're
only familiar thus far with languages
like C which are imperative or
procedural where instructions go sort of
top to bottom sets of instructions
object-oriented programming is thinking
of your code like objects that can
interact and store state and perform
interactions with either themselves or
other objects or other variables and
then on Wednesday I'll be doing a CSS
stream as well to take us from the raw
HTML we did a couple weeks ago and
actually start styling it a la what we
saw with whip streak with Nate's code
today to see a couple of cool examples
like some sidebars and navbars other
cool stuff yeah and then that's your toe
question about what language to submit
C++ is fine I think the only terms are
submitted in a language that one of us
here on cs50 staff knows certainly
Python C C++ Java Script HTML CSS
see shorten c-sharp coulton no c-sharp
c-sharp is very similar job I'm learning
Ruby but I'm not qualified to give you
feedback on it yet so write us and we'll
we'll find someone to advise it daily
yeah we'll take a we'll take a look at
everything that comes our way so thanks
again everybody so much this was our
first code review said no long code
please and none of us speak that this is
our first code review session it went in
my opinion I had a great time we'll do
another one again soon and in the
meantime tune in tomorrow for some
object-oriented program with Brian to
another Wednesday for some CSS we'll see
you very soon in Tata