okay welcome back everyone so last time
we talked about binary numbers and we
talked about how the computer kind of
understands information in terms of
these bits these binary digits these
zeros and ones so today what I'd like to
do is do sort of a high-level survey of
what's going on in the IT industry in
the information technology industry the
reason for today's talk is so that as
you move forward when you listened when
you hear buzzwords you hear programming
languages you hear databases you kind of
understand what they are the differences
between a relational no SQL what machine
learning is all of this kind of stuff
will kind of begin to make sense to you
at the end of the class the following
class will start programming but before
we zoom into that to code I want us to
zoom out and get a big picture
understanding of what's going on in the
industry and so today that's what we'll
be doing so when talking about
information technology we begin with the
word information so last time again we
talked about zeros and ones that
computers understand information in
terms of these bits zeros and ones well
it turns out that these zeros and ones
are stored on a variety of hardware
hardware is what we refer to physical
tangible things software on the other
hand are the programs right so the
applications that you use those are the
software hardware is the things that you
can actually touch like your actual
physical computer your hard drive your
flash drive etc all of that is hardware
and these zeros and ones can be stored
on a variety of pieces of hardware and
different pieces of hardware store these
zeros and ones in different ways but at
the end of the day what really matters
is that they're storing these zeros and
ones so they can store them and then you
can retrieve them back later
hence memory bits on a computer are
typically organized into series of
strings called files okay so a file is
basically a whole bunch of zeros and
ones all right
files are further organized into groups
categories if you will that are known as
directories windows likes to refer to
them as folders there think of them as
directories okay so directories are just
groupings of files which themselves are
just collections of bits
all right you have an operating system
what is an operating system one
operating system is the program right
it's software if you will it's a program
that that does various things and one of
the things that it does one of the
things there you go one of the things
that it does is it controls the file
system so it has this pieces of so part
of the operating system is known as the
file system and it manages your files so
it knows how to write to the files it
know house how to read from the files it
knows how to store files right and it
also understands this organization this
understanding of directories how you can
have a directory inside of a directory
and you can have other files also stored
in directories all right now let's dive
in now obviously I'm guessing most of
you knew everything I just said right so
but let's actually dive in let's
consider the word interface what is an
interface well we have a file system
which is great but we need to interact
with the file system right
having files on a computer is useless if
you can't access the files you need to
be able to read them you need to be able
to make new files need to be able to
delete old ones need to build a search
across them right you need access to
your file system an interface is a
medium between two entities the user and
the actual system that you're trying to
use the interface sits in between think
of it this way consider your car or a
car the pedal is the interface it's the
medium between you and a lot of things
are happening underneath the hood the
engine or the Pistons all the mechanical
stuff you can
throw that with the pedal the pedal is
the interface it's the medium by which
you can communicate with that
complicated system underneath the hood
consider this though when driving a car
you don't have to know all that
complexity that's underneath the hood
you don't have to know about Pistons and
the engine and oil and a lot of that
stuff all you have to do is know how to
press the the gas pedal correctly right
and maybe turn the wheel you don't have
to understand the complexity that lies
inside the car that complexity is hidden
from you
it's abstracted away remember this word
abstraction abstraction means hiding not
showing you it's none of your business
you can always open the hood and look
inside if you choose to but if you don't
care you don't have to you're simply a
user of all of that and you use it
simply by using this and this you don't
have to worry about that does that make
sense well with a file system we have a
similar thing this here might seem
familiar to you this is an interface
it's known as a file browser why because
it allows you to browse files browse the
files in your file system right so you
have access to your if you're on Windows
to your C Drive which is kind of your
route it's like the biggest directory
it's the highest directory underneath
that you can then have more files and
directories and so on so you have this
sort of tree structure this is an
interface you don't know all the things
that are happening underneath the hood
all of the code that manages your files
that writes files this is really weird
sorry
all the code that manages your files the
operating system code the file file
management all of that stuff is
abstracted away you don't know you don't
care all you care about is that you can
see the files you can click on them you
can open them you can browse them you
can delete them it's like using the
pedal this is your interface who are you
well you're a user right you are a user
of
system you are the user of the interface
yes this is called a user interface you
see where the words are coming from now
notice how their graphics here you can
see pictures these icons these folders
this text right there are pictures here
you can see them there are graphics here
right this is known as a graphical user
interface also known as a GUI if you've
ever heard of that term GUI you now
understand where that comes from a GUI
is a graphical user interface that is to
say a medium through which you can
interact with some sort of a program
some sort of a system make sense ok well
it turns out that a graphical user
interface is not the only kind of
interface you can have something like
this this is sometimes called the
terminal also known as a command-line
interface what is a command-line
interface it's actually very similar to
this except instead of graphics instead
of clicking on pictures and dragging
them around and doing stuff like that
you're typing in commands but at the end
of the day the purpose is the same it's
an interface it's a mechanism through
which you can interact with something
behind it that you do not see the actual
programs underneath ok so this is an
interface and that's an interface but
this is a graphical user interface and
this is a command-line interface there
are other kinds of interfaces as well
suppose you write a program you're
actually writing code
this might sound abstract to you but
just it won't be they're too difficult
you're writing some code and then
somebody else wrote code they wrote a
whole bunch of really complicated code
you want to now use their code what do
you suppose you need to use their code
some sort of a medium something in
between that will help you interact with
all of that stuff that they built an
interface ok but when you're programming
it's a
and kind of interface it's a programming
interface it's still a medium through
which you're communicating with the back
with the system but now you're doing it
by programming not by clicking so this
is a programming interface now it just
so happens that just call it just
calling it a programming interface
wasn't enough so engineers started
calling it application programming
interface also known as an API so now
you know where that comes from so an API
or an application programming interface
is the medium it's that thing in between
it's the panel if you will that you
programmatically use to communicate with
a system got it simple right
very cool alright so as you cumin how
data stored zeros and ones we understand
that data on the computer is or data
okay
data and the computer is organized into
these groups called files and that files
can be further organized into these
categories these directories which
windows of course refers to as folders
same thing suppose you have a lot of
that suppose you have a whole bunch of
bits so many in fact that it doesn't fit
on one computer well what can you do
well you can just go and buy more memory
right so you can add more memory to your
computer this is known as vertical
scaling scaling means making it bigger
right scaling okay so you're vertically
scaling you're adding more stuff to your
computer making your computer more
powerful thereby scaling your computer
the problem though is at some point
computer scaling your computer becomes
very expensive and actually almost
impossible so what you can do though
instead is instead of making one
computer really powerful and really
explained supercomputers and so on you
can instead just buy a bunch of
computers and stick them together this
is known as horizontal scaling okay so
making one computer
more powerful vertical scaling adding
computers is horizontal scaling make
sense good so we talked about a file
system so a file system okay it's the
place where a whole bunch of files are
stored make sense file system system of
files okay and directories which are
just categories but what happens if you
have so many files that they don't fit
on one computer well as I said you can
add more computers and basically
distribute the files across the
computers that is to say take some of
the files put them on one computer take
some of the files put them on another
computer and so on and so forth but
treat the whole thing like one virtual
file system that is to say when you're a
user you're using it you don't really
know what computer it's stored on you
just say I want that one and it just
goes to that computer brings it to you
and shows it to you got it okay there
are different distributed file systems
out there one of them really popular
ones is known as the Hadoop file system
okay Hadoop distributed file system HDFS
ok if you guys have heard of Hadoop
raise your hands if you've heard of
Hadoop oh not to me well that's
surprising
ok Hadoop is very popular it was even
more popular a few years ago so Hadoop
basically has two parts one is the
distributed file system and one is a
thing called MapReduce which allows you
to compute over the data but don't worry
about that for now for now just know
that Hadoop allows you to create a
distributed file system again it allows
you to scale horizontally cool ok data
which can be stored on files
comes in two flavors typically it comes
in a structured form and it comes in an
unstructured form and what do I mean by
this this is some text about challenge
right so it talks about him where he was
born
etc this is text this is
things that us humans can read and
understand and understand information
about Charlotte's right this is though
an example of unstructured text why is
it unstructured notice the things that
are found in this text so in this text
we have information like his first name
his last name where he was born now
these are things that you can kind of
understand because you speak the
language right and you know how to read
and you know how to reason and you
understand how to stick words together
and it's making sense to you for
computers to understand that is actually
very difficult there's actually a whole
branch of computer science known as NLP
national natural language processing
which attempts to do exactly this it
attempts to take natural language
language that you and I understand and
make sense of it understand what's in
there what it's about
etc that's called NLP don't worry about
that for now so this is unstructured
text it's just information but there's
no structure to it it's not labeled I
don't know that this is his first name I
don't know that this is his last name I
don't know what that is okay it's just a
bunch of text conversely this is an
example of structured text so this is a
structured data this is a CSV file if
you've ever seen a file with a dot CSV
at the end CSV means comma separated
values CSV it's basically a table okay
so it's a table where you have columns
kind of like what you see in except
Jesus kind of like what you see in Excel
right
you have your columns and each column
has a label at the top right so in this
case the label here is ID and you have a
bunch of IDs first name and a bunch of
first names last name a bunch of last
names for any piece of data I know what
it is right this is an example of
structured data okay the data has
structured the day every piece of the
data is labeled so I know what
everything is one example of this kind
of a file is
a CSV file by the way you can open a CSV
file in your Excel application it will
open it
so anything dot CSV means comma
separated values Y comma separated
because that's what it looks like it's
literally like a value comma value comma
value comma and then you end of line to
go to the next row value comma value
comma that better done we all know what
CSV is cool here's another example of a
structured file this is XML again note
that it has these sort of tags raise
your hand if you know HTML if you okay
so a lot of you already did the homework
or you knew from before happy to see it
okay for those of you who didn't
basically these things here are referred
to as tags ok XML is not exactly HTML
but they're similar enough that if you
know it this makes sense to you
this tag basically says what is inside
so in this case first name that's the
beginning that's the last name and the
stuff in between is what it is so in
this case I've a tick is the first name
I saw icon is the last name etc etc and
that information is about a person and
all of this is about people there ok you
can see that this has structure right
for anything if I point at any piece of
data I know I can see exactly what that
piece of data is the data is labeled it
has structure this at this point is
probably the most popular form of
storing structured data
it's called JSON this is actually a sort
of a piece of JavaScript it's a sort of
a subset of JavaScript and you will
learn JavaScript soon so don't worry but
basically this says exactly the same
thing as what XML did so if you
understand this this is the same thing
it's just stored in a different format
right does the way you store it is a
little different but the idea is the
same so you have people that's a list
basically this is just a container an
object if you will which says you know
first name as this last name is that
birthday is that at the time right so
again every piece of data has the label
so you know what it is it has structure
okay cool
okay let's consider a use case so you
guys are running a store right so you
you know you buy a store and you have
lots of customers lots of products lots
of things you need to manage all of this
information what was sold how many how
many items were sold who bought this
information you know these products
which customer perhaps that will allow
you to do make smarter marketing
strategies right if you keep track of
who's buying what so what we could do
remember CSV remember this idea that we
can store data in tables
well imagine that's what we're doing
except instead of just having one table
consider that we have one table about
customers okay so we have a column about
the customer ID first name and last name
we have another table about products
again the product ID the name of the
product and how much it costs and let's
just say this is in dollars just
whatever okay then we have purchases
interesting so what this means is that
this is the purchase ID this is the
customer ID so that's number two so that
she does right so what this is saying is
that she does purchased product number
one that's pen three of them so what
this is saying is that she does
purchased a pen three of them right what
does this say this is the just an ID of
the purchase who is this challenge so
Chanin's bought which product again a
pen how many of them palm makes sense
now note something interesting here that
even though these are separate tables
the tables can refer to each other using
an ID so in this case for example this
number 2 refers to she does which is in
a completely different table by she
tosses ID right so there's a
relationship being created across
tables from one table you have a
relationship to the other table relation
no you might have heard of these
databases called relational databases
now we'll talk about those later this is
an example of our relational database
okay so - we'll see some examples but
relational databases work exactly like
this you have tables and you have
relationships these references by ID
between the various tables okay so if
you've heard of SQL or MySQL or sequel
server all these fancy things these are
all relational databases and all of them
at the end of the day basically store a
bunch of tables that refer to each other
that have relationships between them now
this is just showing what you already
know that we have relationships what I
was just saying
so relational databases some of the most
popular ones that you will hear if you
ever hear anything with the word SQL in
it it's a relational database it's a
it's a database that has these tables
with relationships in between right so
MySQL is the really popular one Postgres
very popular and then slightly maybe
less popular oracle and sequel server
these two are open source which is why
they're used very often open source
means literally the code is available
you can look at it you can hack it you
can use it without a problem without
paying anybody for these you have to pay
to use the difference cool so now if
anyone tells you I'm using a database or
relational database yeah which kind
which you know is it - QL yeah how do
you know hey I went to class okay cool
all right so what is SQL so this sort of
these three letters keep coming up write
SQL it stands for structured query
language language interesting why do we
have languages what is a language for
communication exactly a language I'm
speaking English communicating with you
so you can understand
what do you suppose this language is for
to communicate with the database exactly
this is a language that allows you to
communicate with relational databases
okay so if you think about a relational
database as we discussed stores data
okay it stores data in tables fine it
has these tables can have relation or
rows within tables can have
relationships between them
hence relational database okay but how
do I now search that database right how
do I actually interact with that
database
I need something some language to talk
to the database basically right so SQL
structured query language query means
like asking question right you're
querying it here language obviously
structured because there's structure to
it and because the data is structured
right okay so we have SQL and here's an
example of an SQL query look how scary
it is you're not scared No okay okay so
there it can can the people in the back
see the text can you read it
you want me to zoom in or it's okay okay
John okay so this is just a reminder of
what our tables look like and this is
the query let's sort of mentally
understand what this query wants from
the database what is it asking ok so
first let's focus on the from clause the
from Clause says the tables that we are
interested in why well a database can
have lots of tables you might yes we
have these three but you could have lots
of other tables you can have tables
about your employees for example you
could have tables about I don't know
meat products I don't know cashiers how
much each employee makes you can have
lots of other tables right right the
information that is not relevant to the
question that we're asking so what we do
is we limit the query to say I only care
about these tables so that's what the
from Clause says so the front class size
only use
these three tables forget about the
other tables by the way you can almost
think of tables like for the for those
of you who used Excel you know you can
make a spreadsheet but then you can add
another one and then you can add another
one and imagine each one of those
spreadsheets as a table and you can but
you can refer to things across
spreadsheets using an ID you can almost
think of it that way just mentally so
you understand what we're talking about
okay so this says what tables we care
about let's consider the where clause
this is interesting so the where Clause
says go to the purchase table that's
this guy and get its customer value that
would be this column here and it's
saying have that be equal to the
customer ID that's this one here this is
known as I join it's saying stick the
rows that have this ID with that ID line
them up remember we have two separate
tables but the IDS are going to line up
it's saying and also furthermore take
the Product ID that's this guy and stick
it match it line it up with the ID of
the product table okay
so wide that up so we line this up and
we lined that up
it's then saying now group by customer
ID so the rows that you've created by
lining these things up chop them up
based on the customer ID so if the
customer purchased five products you're
going to get five roast for that just
for that one customer then what we're
saying is we're going to select select
is the part we're going to get from as a
result we're going to get the customer
ID and then for each customer ID we're
going to get the purchase quantity
that's this multiplied by the price of
the product that they purchased okay
then we're going to add them up so the
result of this is that for every
customer we will know how much money
this
at our store sort of make sense don't
worry this is not going to be on the
test this is I just want you to
understand what's happening with
databases okay this is a survey don't
worry I'm not gonna just understand it
for yourself okay it makes kind of sense
good and by the way this is what I would
get as a result so the customer IDs
would be these one two three right
because those are our customers and
these would be the result of all the
money that they spent so here you can
see that number one that would be chance
is the big spender he's the one that's
spending most money at our store and the
person who's spending the least weight
sorry number three I'm sorry number
three is the one I think you say again
is the big spender you spent 27 bucks
right way more than the other guys okay
make sense cool okay so we talked about
relational databases right these
databases that support SQL the
understanding of a structured query
language a language through which you
can communicate with the database there
are no SQL databases these are databases
that don't follow these rules some of
the databases may not store tables if
you recall we studied different
structures we study tables that was the
CSV example we studied XML we studied
JSON right we saw those examples well it
turns out MongoDB for example is a
database that stores JSON Python it
stores it in binary but no one cares
it's JSON it stores JSON right it's a
database that knows how to store JSON
documents there are databases that know
how to store XML documents there are
databases that know how to store data as
graphs directed graphs right so storing
data as tables is not the only way to do
it you can structure your data in
different ways and different databases
do that however if you store a you know
your data as JSON you can no longer use
sq
because sq by definition relies on this
tabular structure this relational form
which doesn't necessarily fit with JSON
so MongoDB has a different Kwai language
couchdb has a different way of querying
neo4j has a different language for
querying its data right so the query
language has to match with the database
you're using cool okay okay you can
structure your data in different ways
first of all you can decide to store it
as a table or as JSON or AZ which is
like a tree or as XML or whatever you
can also well the naming of the
attributes right is it first name or is
it first underscore name or is it just F
name right should I store this the email
in a list or do I just have one assume I
only have one email address
understanding the structure of your data
deciding on the structure of your data
is called data modeling you're modeling
your data you're trying to understand
the structure that your data will have
is this okay is this do you have
questions so far have you missed
anything yeah it's like blank faces okay
no problem okay so we understand that we
can store data we talked about file
systems and bits and all that stuff but
at some point we want to actually do
something right we need to compute okay
we need to have the computer actually do
some calculations for us it does this by
using something like this this is called
a computation and processing unit or CPU
it's your processor okay your processor
is basically a really complicated
calculator it knows how to do a lot of
math effectively it knows how to load
data and then compute over it do
mathematical things over that programs
are actually just code that are stored
just like any other piece of data on
your filesystem
okay so just like you have your jpg for
your images and you have your whatever
name something else your a deal see for
your documents or txt for your text
files
you also have dot CPP for C++ code you
have dot Java for Java code you have dot
J's for JavaScript code all of the
programs that you guys are using are
just data just like any other data it's
just bits stored on your file system in
files okay this is an example of machine
code so this is the kind of code that
your processor understands it only
understands basically boolean logic
zeros and ones yes or no okay there are
some letters in here that's because it's
using hex don't worry about that just
assume it's zeros and ones at the end of
the day but this is machine code and it
does something can anyone tell me what
this does exactly okay
believe it or not people used to
actually program computers like this
they used punch cards so what they would
do is there would be a computer and they
would have these cards and on the card
you would punch a hole and if you punch
a hole it means a1 if you don't punch a
hole it means a zero and they would go
to ah crap throw it away next one and
then have a whole bunch of these cards
feed them into the computer don't drop
the cards okay feed them into the
computer and the computer would read the
holes and no zero one one papapapa and
in that way execute the program so
people literally program like this then
engineers began to realize okay we can
do something smarter and so they came up
with a different language or a class of
languages called assembly this looks a
little bit better right definitely
better than the previous example this is
an example of assembly code that then
can be compiled into translated into
machine code okay so you have a program
called the compiler which knows how to
take this as input
and then turn that translate that into
the machine code which is the output so
you write code here you compile it into
machine code then you give it to your
processor and your processor runs and
does and then you have Facebook okay can
anyone tell me what this does not bad
yeah it was a good guess I'm guessing
you saw hello world and you add prints
okay this is way easier right this is a
language above assembly these are known
as high level programs right so these
are programs that are even simpler than
assembly this is an example of program
written in C++ right so this is a C++
code I don't expect you to understand it
but just looking at it you can kind of
figure out okay this is probably text it
has the word HelloWorld in it C out if I
were to tell you it's like a print it
will run and it will print HelloWorld
even if you don't understand the syntax
you don't know what int is or that's a
function and that's a library you don't
know any of that intuitively you
understand that this is way easier than
that and oh my god easier than this
right again this though requires a
compiler some sort of a program that can
take this as input and turn it
eventually into machine code that can be
executed on your CPU on your processor
with me mm-hmm
okay okay so we understand what programs
are there basically a set of
instructions okay you are telling the
computer do this do that do that do that
you're communicating with the program to
communicate with something or someone
you need a language we saw SQL a
language for communicating with a
database which is a program this is some
code coffee cup drink work task executed
if the copy cup is empty
make coffee refill whatever you
understand it's a stupid algorithm but
you get the idea an algorithm is just a
series of steps we discussed this last
time right so a program is just a
language by which you can describe
series of steps to the computer you can
typically describe it and in this like
last we will be describing it in a high
language in a higher order language that
can then eventually turn into zeros and
ones and run on the processor so we will
be using javascript to tell the computer
what to do
javascript will then at runtime when
it's executing turn into zeros and ones
and run on your computer or your
processor and then you will see the
outcome of your application cool okay
some theory raise your hand if you know
who Alan Turing is all right some of you
know who the father of what you're
majoring is so he's the father of
computer science if your major in
computer science you probably should
know who he is he did lots of really
cool things one of them is he was
thinking about a very simple problem
well intuitively simple he was trying to
understand what is computable if you
think about it's actually not that
simple
what can you compute that is to say if
you had if you built like the most
powerful computer in the world what are
your limits like what can you do with
that and what can you not do with that
no matter if you have 10,000 of the best
computers in the world there has to be a
limit to what it can do what is that
limit how do we determine what is
computable what it can compute and so he
thought about this and he came up with a
conceptual model a conceptual
understanding of this machine he called
it
well I don't know if he called it but
it's it's known as the Turing machine
okay a Turing machine is basically this
it has an infinite tape on both sides
okay so you just have a whole long tape
going that way and all long tape going
that way and you have a head and the
tape can sort of slide underneath the
head
going that way or going that way okay
the head knows how to do a few very
basic operations it knows how to read
what's on the tape or the tape is
divided in two parts so as you go to the
next part go to the next part you kind
of see what I'm saying
okay the head knows how to read what's
on the tape and it knows how to write
something to the tape and it knows how
to go either left or right that is
basically all this machine can do and
what you can do then is give it
instructions like write something go
write write something if that something
is this go left but right very basic
instructions that's it it's the simplest
thing you can imagine and any computer
that you can that has ever been built
the most powerful computers that we have
in the world can't do anything more than
this you we this though the Turing
machine literally says this is if you
can write a program that runs on the
Turing machine then you can build a
computer that does it but if you can't
do it on the Turing machine you cannot
build a computer that can do that
because it's not computable okay now you
can build computers that will do it
faster more efficiently whatever that's
not what I'm talking about
I'm saying can you do it can you compute
the answer or can you not if you can do
it on a Turing machine then only then
can you build a computer if you cannot
do it on Turing machine you cannot we
have a set of programming languages as
we discussed programming languages again
a language through which you communicate
with the computer well what is a
programming language it's a set of
instructions you're telling the computer
what to do right so you're doing
computation all of that turns into zeros
and ones runs on the processor you're
computing it turns out that there are a
set of programming languages that are
known as Turing complete a Turing
complete programming language is a
language that can do everything that you
can do on the Turing machine if you can
programming it on the Turing machine you
can program it using that programming
language there are languages that are
not Turing complete an example HTML
it's a language right hTML is a language
you're describing what you want using
some structure in a file and you're
giving it to a browser which is
rendering it it's a language and you're
programming right you're writing code so
it is a programming language but it's
not Turing complete you can't do cycles
and if statements and and write things
and add things or move like you and seek
you can't do that stuff with HTML you
can with C++ you can with JavaScript you
can with Perl and Python and all these
are languages so there are class of
languages that are known as
turing-complete
which are your programming language and
then there's sort of other languages
that are not CSS HTML or just some
examples cool so if someone tells you I
know how to program
I know HTML you understand okay so some
of the high-level languages that we
discussed again high Langille languages
remember our languages that are
reasonably easy for us to understand
reasonably if you you know study it a
bit that then eventually turn into zeros
and ones they get translated into or
compiled into zeros and ones JavaScript
C C++ C sharp Objective C Python PHP
Perl blah blah blah Papa many of you
have heard of these languages now you
understand kind of where they fit in
computer science in computing in general
yes okay so if you here's JavaScript PHP
but you kind of know what that is it's
just a language that eventually turns
into zeros and ones and you get
computation yeah okay am I going too
fast okay when writing programs
complexity is the enemy
consider the video games that you've
played or the operating system you've
used the tools you've used the arrow
social networks you've been on nobody
sits there and just builds that no one
sits there and builds Facebook or builds
an operating system or builds anything
big instead what they do is they build
pieces small pieces pieces that they can
understand okay
a little bit at a time then they use
those pieces as building blocks to build
the next layer over the top think of it
like Legos right LEGO pieces so you can
build like a little piece with Legos a
bunch of them and then you can use that
as one big Lego block to build something
bigger and then you can use that as a
big Lego block to build something bigger
and so in this way you begin with
something very simple and as you build
up as you build layer upon layer upon
layer you're building up complexity so
you don't begin with complexity you
create complexity complexity emerges
from simple pieces from simple building
blocks this is why I mean imagine if
something breaks on Windows like there's
a bug on Windows like no one is going to
try to understand the entire system
that's just crazy it's no one person can
understand all God knows how many five
millions of lines of code or however
many it is nobody can do that so instead
what they do is they look at individual
modules they test them separately they
combine them they see which one is
misbehaving they drill that and they
only look at that they don't try to
understand the entire thing because it's
just too hard it's too complex so as
programmers one of the things that we
absolutely have to do is try to
componentize our programs componentize
the parts of our system and keep them
separate from the rest just like the
engine is kept set away from you when
you're driving driving is complicated as
this right you have people coming
there's like a ball going a kid might
come after it oh my god it's a red light
no way to just turn green all of that
imagine you also have to worry about the
engine it's too much so the engine is
abstracted away you just get a
and the pedal and you focus on driving
not the engine systems are built exactly
this way they abstract away the
complexity so you can focus on what
you're doing
got it cool okay
get will be using get quite a bit in
this class let me just say what it is
get is just it's a program that allows
engineers or programmers to share their
code okay it allows you to merge your
code so for example suppose we're
working on the same file so I edit it a
little bit and you edit it a little bit
how do we share it how do I give you my
changes or you give me your changes well
one thing we could do is literally take
the file and email it but suppose we
have another map team member well they
also edited who added it first who edit
it last
which parts changed it becomes kind of a
mess right and also if something breaks
we want to be able to go back so we want
some sort of a versioning system right
so that we can role changes back if we
break something all of that kind of
management is done using a system or a
program called git it's a very powerful
tool it's used in industry everywhere
and we'll be using it here to actually
submit our programs we'll be using it
we'll be using it now there is a website
called github github is not the same as
git git is just a program that allows
you to do the various things I mentioned
it allows you to manage your code github
is a website that hosts git so you can
use just like you can share with your
friends you can also share your code
with github but the nice thing about
github is there's a lot of code there
that's free and open-source so other
people can then come and take your code
and use it as well they can also
contribute to it if you give them the
right access so all of our code that we
write will be using git and pushing it
or sending it to github right so your
next assignment when you guys start
writing code you're going to push your
assignment to github
and then in Moodle you're gonna give us
the URL or the hyperlink the reference
to your github project cool questions so
far let's see should I talk about the
internet so what no I'm gonna skip that
part because we're going to talk about
the internet later there's gonna be a
whole class where we talk about IP HTTP
blah blah blah but I do want to talk
about this so let me zoom in just a
little bit so many of you might know
this oh I can't zoom wait I can zoom
right okay can you guys read that okay
so many of you have written things in
here it's important that you understand
what that stuff is okay
the first part this part is the protocol
what is a protocol anytime you hear
protocol it just means rule okay yeah
for example I'm speaking English because
I know you understand English and we
agree that the word yes means and the
word no means right it's an agreement
between us right that's a protocol right
it's an agreement that we're both gonna
understand the same thing right it's a
standard so in this case this is saying
use this protocol to communicate with
something some other computer and we'll
talk about what that is later this is an
address right in this case we're
communicating with a computer that has
the name google.com now in reality this
thing actually gets translated into a
number using this thing called DMS don't
worry about that for now just imagine
this is the name of that other computer
we want to talk to and you won't know
what this is what is a port
okay yes okay so think of it this way on
your computer you have different
applications right so you might have
Skype you might have you might have
Facebook running you might have
messenger you might have all these
different things right and all of them
are potentially communicating with other
systems well when your computer receives
information how does it know which
program to give the information to the
way it knows is by this number so what
happens is when you want to communicate
with the outside world you reserve a
port port literally means like imagine
you have like boats coming in there's a
port right so boats can come in in
different positions so you reserve
report you say this is my port any
information that comes to that port I
want give it to me if that port is used
it gives an error and you have to pick a
different port okay so I'm Skype I'm
saying any messages that come to this
port send them to me I'm Facebook
Messenger
any messages that come send them to me
so this says the computer this says the
specific port in other words the program
that will receive this information that
I'm sending with me okay this right here
is a path actually anything past the
port is just information that the other
the receiver is getting and then they
can decide to do whatever they want this
is typically referred to as path these
are arguments I don't wanna discuss
those it's just additional information
that you're sending to the however is
listening to this port on that computer
using this mechanism this protocol yes
keep going questions Wow okay either you
guys understand everything which is
great or okay or not
alright so typically people don't ask
questions for two reasons right either
they understand nothing or they
understand everything I'm hoping it's
okay server what what time is it
ah we have time okay sorry when I get
excited I lose track of if it if it's
2:45 tell me okay so otherwise I might
keep going what is a server a server is
just a computer it's just a computer
which has an address like you know
google.com has an address again remember
that that address actually is a number
it's not really text but wow it's an
address okay and then you have your
clients now your clients are the things
that you use all the time like your
phones or your computers right your
laptops your whatever these are your
clients when you log on 
to
facebook.com/thebalancingactfans oh it
goes okay and it sends it back and you
get a login page then you type in your
username password you hit submit it
makes another request it sends another
message to the server saying hey the
user tried to login
here's that information it then looks at
it maybe looks up the username and
password in a database perhaps to try to
see is this user actually you know
registered with Facebook and if they are
then maybe sends back their profile
right if not maybe it sends back an
error saying hey you know invalid
username and password logging again
so this is what we call a client-server
architecture so the word architecture
you guys are familiar with like
buildings right so an architect is the
one that designs how the building is
going to fit together and look and feel
well it turns out you can do the same
with software with programs with systems
it's the same idea you're trying to
understand how things fit together in
this example we have a computer that
fits with this computer using a protocol
specifically HTTP okay so in this
architecture we have a server which is
the thing that receives the request and
sends back the response and the clients
which are your devices that you're using
to send requests yeah kallu net by to
mother okay try necking okay we're not
going to learn HTML because I want you
to just just go learn it but just very
quickly okay
HTML basically looks like this remember
data is stored on files right HTML is
also data which is a bunch of bits
that's stored in the file yes okay
it has a name I can give it whatever
name I want dot and then the extension
that stuff at the end the dot txt dot do
see jpg that determines the kind of file
that it is why do we have that extension
so that when you double-click on it
windows for example knows what
application to use to open it that's why
you have that jpg or whatever well one
example it gives us a hint of what's in
there is it a picture is it code what is
it HTML also has an extension the
extension is HTML so if you ever see a
file dot HTML it's an HTML file and when
you double click on it you'll most
likely get a browser because browsers
know how to draw HTML make sense ok so
what does HTML have inside well it has
these things that are elements we call
them elements okay and you can nest an
inside another so you can have
underneath this you can have this one in
that you can have that one and elements
there are different elements I don't
expect you to memorize all of them by
the way but there are some common ones
that you should just know like div span
you know what a body is head is just
memorize its like ten different things
just sit there memorize it you need it
anyway
style means the stuff inside is going to
specify the look and feel of what you're
going to see so in this case it's saying
the tag that that looks like this h1
that would be this guy have the text
color be read so anything inside of
that's that h1 all of this stuff is
going to have red text there's a well
okay you don't need it if it's the last
one you don't need it it's optional you
only need it if you have ones in before
that not bad okay so in this case so we
have Tom rocks this should say Tom rocks
I'll tell you why it's not later and
notice that it's red cool by the way
what is HTML it's basically just stuff
that tells the browser how to drop
something okay so the browser literally
reads this it typically starts here to
draw things so it's saying okay an h1
which is like a block inside of that I
have Tom and rocks I'm gonna draw that
then because it's a block I'm gonna go
to the next line I'm gonna draw a IMG
that's probably an image and look
there's a reference a link to a picture
it's going to go download the picture go
to the server get the picture and then
draw it on itself and so you get Tom
rocks and then the picture but notice it
doesn't say Tom it says to Mon Young why
here we have another tag script a script
tag allows you to write JavaScript
inside of your HTML moving forward this
is you until we get to node which is
later for now all of your assignments
when you write JavaScript you will test
inside of an HTML file
so you will typically store your
JavaScript in a separate file I'll show
you how to do this and then refer to it
just like image refers to an external
file an external jpg similarly from
script you can refer to a separate
JavaScript in this case I wrote the
JavaScript directly inside the script
tag and let's see what it's doing
document refers to this whole thing
right the big thing inside the document
I'm calling this thing function you know
if you don't know don't worry
it's saying get me the thing that has an
ID of name what has an ID with name in
it that guy right this element has an ID
with a name right there right there it
is so it's getting this element here and
then I'm saying inner HTML make the HTML
that is inside of it that to monument so
what's happening this tom is getting
replaced with that stuff with two manya
and so the result of that is two Banyan
rocks not Tom rocks and that's a browser
and that's the address that you can you
can write it goes to the server it makes
the request it pulls down this HTML and
then it draws the HTML in itself simple
yes
illegal okay so it's you're not supposed
to sew IDs are meant to be unique if
what would happen I'm assuming it
depends I don't know you just don't do
it what would happen if I walk in front
of a bus it depends if the guy stops
you'll be okay in other words if the
browser just is nice to you it maybe it
will do what you think you want to do
which is it will go through all the IDs
and make them inner HTML maybe or maybe
you'll just take the first one actually
probably does that one
don't guess just do it right don't do
that okay good
other questions okay so typically when
the question is what happens if I make a
mistake the answer is don't make a
mistake okay
all right so we understand the basics of
HTML right the very basic you guys still
have to go through code Academy and
learn the rest but you got it okay now
so we understood this part which is that
you have your application it talks to a
server the server then sends you back
results something information it might
be files it might be pictures whatever
it turns out though that the server can
then use a database to store information
and to retrieve information so for
example if I want I want to know who are
my friends our requests can go to the
server saying give me a Reubens friends
it then does a query possibly an SQL
query to a database potentially MySQL
which will then return the list of
people that I know and then it returns
back draws the list of people that I
know so a database very often works
together with a server by the way the
database can either be on the same
computer but he can actually be on a
separate computer it doesn't have to be
on the same one with me so far okay
okay suppose you're actually Facebook
you're getting so many requests it's not
just one computer or phone that's
sending and requests like send me this
person's profile like you know all that
crap it's not just one it's watts
thousands maybe even millions right
imagine all of those requests hitting a
computer one computer that computer
would like have smoke coming out of it I
mean there's no way you can possibly do
that much computation that quickly you
can't keep up so what can you do
what kind of scaling what kind of
methods of scaling did we discuss do you
remember horizontal and vertical exactly
so one thing you can do is make this
computer just stronger right add more
memory add more processors just are okay
that's vertical scaling but another
thing you can do is add more computers
and what you do is when the request
comes to this computer it doesn't try to
serve it it doesn't try to compute it
just sends it to another computer and
then when a next request comes it sends
it to this guy then this guy then this
guy then that guy that guy that guy that
guy that guy and in this way
it's distributing the load across
multiple computers it's balancing the
load better balance on it's balancing
the load this is known as a load
balancer it's just a computer
it's factly a program that takes
requests and sends them routes them to
other computers to actually do the
computation did that make sense
yay okay we talked about cloud services
in previous class so cloud services
provided by you know Amazon has it IBM
Google has it there are other providers
they will host these computers for you
so instead of literally having this
computer sitting in your room like you
know keeping it cool provisioning it
backing it up whatever doing all the
work you can just have these guys do it
for you right so you just literally they
give you access to a computer that's
that in their server farm and you just
control it you install what you want on
it ba ba bla and you run it and they
take care of the rest there they take
care of cooling it they take care of
power outages they take care of all of
that you just use their computers and
you just pay them for it like you're
renting a computer cool all right okay
typically when we're talking about
systems specifically the client-server
architecture for database in when you're
talking about databases these are like
the common databases that you see now
right the really common ones it's good
to know them so that if people ask you
you kind of understand what they are and
where they sit what kind of database is
that relational thank you what kind of
database is that no SQL anyone remember
this one craft database exactly that one
yeah if it's got the word SQL in it it's
a relational database that's a simple
way to remember okay cool
so you typically you have your database
which is the part that stores your data
you have your server which is the thing
that's getting information you know
getting requests and sending the
response right common servers include
Apache Microsoft is node which we'll be
using later nginx and you can also do
Tomcat for Java stuff so if you see
these guys you kind of know that this is
roughly where they are right there on
the server typically again on the client
you guys know this I'm sure is you have
your browsers usually you can also have
native applications on your computer
that talk to a server but typically it's
you're using a browser right so you have
your Chrome Firefox blah blah you know
that and then you have your operating
systems for your phones cool ok no
problem
programming languages now a programming
language on its own is just a language
to communicate with a computer but it
turns out that typically languages have
kind of fallen into certain places like
you you you don't typically use PHP to
write clients
applications I'm sure someone could
theoretically do it if they write enough
other code but it's not done right so
typically for your databases you have
SQL which we studied write structured
query language to talk to the database
you can have other languages to
communicate with the database like graph
QL there Sparkle there's MapReduce etc
these are languages that you typically
communicate with us with a database with
the thing that stores your data these
are typically these here are the
languages that you typically find on the
server again these are not absolute just
generalities so typically if you see PHP
Python Ruby Java JavaScript is both
whatever if you see dotnet and Java
typically these guys sit on the server
end
typically and then on the client side if
you have a phone if you have iOS you're
usually using a swift or objective-c
Swift is kind of like a JavaScript
looking thing it's like the new language
from i/o fri OS you can also use
javascript we'll talk about that later
for your computer again if you're just
running in the browser it's JavaScript
but you can also use it in tablets and
you have Java for if you're using help
me
Android thank you so if you're
programming Android it's probably Java
if you're programming iOS it's probably
a objective-c or Swift and everything
else is basically JavaScript seriously
it's taking over and you guys will enjoy
that yeah so far so good
good okay inside the browser we have
lots of code written by other people to
help us write better code okay so a
library for example is code written by
someone else that we can use it has an
API
what's an API application programming
interface some mechanism by which when I
write my code I can talk to the library
the interface the medium through
which I can communicate with the library
okay
there are also frameworks which a lot of
people don't quite understand the
difference one simple way to that I'd
like to think about it is that with a
library when you're writing your code
you call the library do something for me
it does it returns and you keep writing
your code okay so you're controlling
your code the main structure of your
code but you're calling into the library
to do something for you some utility or
whatever with a framework it's the other
way around the framework generally runs
the application the main structure but
then calls your code to do something
when it decides there are trade-offs to
this of course the advantage is that
there's a lot of code that the framework
will just do for you a lot of logic that
you get for free basically the the
trade-off though the opposite is that if
it does something you don't want that's
kind of a problem right and then you end
up what's known as fighting with the
framework you try to modify it hack it
and okay so really understand what
framework you want to use what it does
and what it does not do before you use
it because later on in the project if it
doesn't do what you want you're gonna
have a problem you're gonna have to go
and write the whole thing again which
sucks okay so these are typical
frameworks angular maybe you guys have
heard of it a number or like the really
popular frameworks now as far as
libraries reactant view are the popular
rendering libraries again remember a
library is something you call to do
something react is that you call it you
say draw this here and it does a render
literally I draw something in the HTML
view j/s is kind of similar but it has
some tweaks other libraries whatever I
don't need to go into them but basically
just familiarize yourself with this
general category so that when you see it
you know okay that's the stuff people
use to write web applications okay cool
okay it turns out that a lot of these
things that we talked about come in
groups right so for example you will
often hear mean stack what do you
program I called programming mean the
heck is mean mean basically means that
for the database to use Mongo they use
Express and node for the server part and
they use angular for the client part if
you remember Express we didn't talk
about because it's a framework for node
don't worry but this one remembered that
wasn't a database side this one wasn't a
server side and this one was in the
client side remember that you can do a
similar thing except instead of angular
you can use react this is getting very
popular now this used to actually a
sucker burg wrote Facebook using this
one lamp so lamp is Linux so for the
operating system use Linux on the server
you run the Apache server on it you run
PHP as your server-side scripting
language MySQL for the database and then
wait you didn't use Python forget Python
well this is like you can do this or
that he use this one he used PHP you can
also use Python this is also very
popular now cool okay okay just one
quick word about security its I find
that when engineers first start
programming they know very little about
security and what they do is they write
code the way their intuition tells them
they should write code the problem
though is that a lot of the intuitions
that you have about writing proper code
are actually insecure they're wrong to
write good code you have to do some
things that are actually not intuitive
and you have to explicitly know about it
to not do it so the only piece of advice
I can give you for now is this before
you start writing production-grade code
just read up on writing the kind of code
that you're writing so if you're writing
server code where you're dealing with
let's say your a database and you're
writing queries read up on mistakes
mistakes you can make when writing
queries by the way what's a security I'm
just curious if you know a mistake you
can make when writing a query on the
server anyone know this you guys what do
you mean okay no SQL injections quote
interesting okay so you can try to break
using okay right right it's similar
right you're modifying the query so
either you can just modify the query and
have it run the way you want okay most
of you are looking at with blank faces
you don't know no problem before you
start writing queries on the production
grade application read on how to write
proper secure queries for applications
otherwise you're you're gonna be in
trouble eventually you will get hacked
actually most of you are gonna get
hacked anyway but at least minimize the
probability okay okay that's the word
machine do have time to minutes from
machine learning okay
so artificial intelligence is like
they're really getting really popular
now and it's getting really popular
basically for two reasons one is that we
have incredible amount of data now just
massive amounts of data and the second
is that the hardware has gotten much
better
we have processors now they're really
really good and can process and compute
very well and machine learning I would
say is like the really really popular
branch of artificial intelligence and
let me explain what I mean by that so
machine learning is again kind of a
larger group but within that we have
this notion of supervised learning and
what do I mean by this well imagine you
have like a magic box and you have lots
of data that has inputs and the expected
outputs so for example suppose I said 1
&amp; 1 as the inputs and the output is 2
and then I said 5 &amp; 5 is the input and
the output is 10 9 and 1 is the input
and the output is 10 etc etc
might you think I'm trying to do
addition right okay so this magic thing
basically when you feed the data
properly and you train it it will
basically try to figure out what you're
trying to do so it will magically figure
out that what you're trying to do is add
and in the future when you give it you
know a hundred and a hundred it will try
to guess that what you meant was 200 so
what are the kinds of applications that
are done well for example you give it as
input email and it tells you is the spam
or not Gmail uses this kind of thing
extensively right so they have lots of
emails and they know which ones are junk
or not because you mark them as junk so
they have a big database of email to
junk and they have the rest of the
emails that they assume are not junk so
they train these abstract magic boxes
which we'll talk about in a moment to
basically begin to make these
predictions so that later when you give
it another email that they have not seen
before this magic box try to tries to
guess based on previous information
whether this is junk or not whether it's
spam or not right so typically what you
have with supervised learning you have
these sort of mappings for this sort of
input to output mappings they put might
be audio and the output might be the
text inside the audio like what is the
person saying the actual text the input
might be an image and you're trying to
figure out what is the object inside the
image is it a dog is it a house the
input might be a language it might be
English and the output Spanish right
input/output is trying to translate from
A to B okay so this thing is usually
done through using something called a
neural network so we don't have a lot of
time I'll just just so you guys get an
idea a neural network is basically you
have your input and you have some sort
of a mathematical function and the
mathematical function has an output so
in this case for example this is price
versus size of the house so generally
speaking you see that as the
the house gets bigger the price of the
house also gets bigger right so we need
to determine some sort of a mathematical
function to fit this kind of data so
that later if we find a house that has a
certain size we can give that size and
figure out roughly how much that house
cost okay okay so one of these
mathematical functions is called a
neuron just bear with me now just
knowing the size of the house might not
be enough what if we want to know more
information like the number of bedrooms
the house has the zip code that is to
say the area in which the house is
average income of the people living in a
house assuming you have that kind of a
statistic right each one of these things
can be one of those mathematical
functions one of those neurons that then
have an output that can be eventually
fed into your output neuron that gives
you a price and in this way what you can
do is begin to change things together
what you do is you have for example
let's say you want to do image detection
right so there's a camera and you want
to know who's coming in and out of the
building when you take a picture of a
person you first run it through a set of
neurons that attempt to find little
shapes you then take those shapes and
feed them into another set of neurons
that based on those shapes attempt to
figure out parts of the face the nose
the eyes etc you can then take the eyes
and the nose and so on feed it into
another one that has been trade against
that data to figure out faces and then
those faces can be matched against the
database and now you know who's going in
and out of your building now I did some
hand waving there's a lot of sort of
math that I did not talk about there are
a lot of sort of back propagation and
methods of how you eventually get the
neural net to behave this way training
if you will how do you eventually train
then you're this net to give you the
right output to fit the curve there's
quite a bit of that and maybe once you
guys are done with intro to Comp Sci you
guys know a bit more math and you are
able to program you can begin to dive
into this stuff and it's real
really interesting and I recommend that
you guys start reading up on this right
so what do you need in order to do
machine learning you need math by the
way anyone likes people say you don't
need math to program it depends on what
you're programming if you're just
building a website true but if you're
building something like this it's all
math it's all function functions so you
need math and typically typically the
language of choice for machine learning
is Python and Python by the way is not
too similar dissimilar to JavaScript so
once you guys learn JavaScript here you
can then learn Python very easily okay
so there's as you can imagine and as you
got from today's talk there's a lot more
computer science is awesome and one of
the things that makes it awesome is that
no matter how much you know there's
still so much more you need to know and
new things are constantly coming out new
technologies new concepts you constantly
have to read you constantly have to
learn so welcome to the world of
computer science and I'll see you on
Tuesday
thank you follow us or choke off Karen
John yes Isha Bravo
