Placeholder Image

Subtitles section Play video

  • Hi, I'm chris peach.

  • I'm a professor of computer science at stanford University.

  • Today, I'll be answering your questions from twitter.

  • This is coding support.

  • First up from M.

  • T.

  • X.

  • T.

  • How many coding languages are there?

  • Well there's a lot of coding languages.

  • Some of the most popular ones include python.

  • That's great.

  • If you're doing data science or if you're writing scripts for your computer, there's java script.

  • That's great if you're writing a website and there's a whole bunch of other ones like C.

  • C.

  • Plus plus java and that's just five of the top most common ones.

  • My friend from university even made a coding language of their own just for fun.

  • Eugene Daniel asked encoding being self taught.

  • Absolutely.

  • Coding is such a special what matters is that you have the skills.

  • It doesn't matter so much if you have a credential saying you can do it, what matters is that you can pick up a computer and you can code it and make it do wonderful things.

  • There's a lot of incredible resources out there stanford myself, we offer free programming class if you're interested.

  • I know a lot of self taught success for you When I worked at Pixar.

  • I knew a lot of programmers there who had never even studied computer science in university or anything like that.

  • They just taught themselves and now we're working at one of the coolest programming companies?

  • Okay.

  • Next glacial icon.

  • I always wondered apocalyptic and action movies.

  • How do coders managed to save the day without ever using stack overflow and glacial icon.

  • I'm gonna say that's a fantastic question realistically when we're coding, we're using stack overflow stack overflow is a website where you can go ask questions and see answers and you can see code snippets that other people use to solve problems.

  • Every serious coder I know use a stack overflow to build better answers.

  • And so it's pretty unrealistic that in an action movie they're not using stack overflow.

  • So I guess if you only have a few minutes to save the world, maybe you have to code without getting any help.

  • The origin of the term stack overflow is actually an interesting story.

  • It comes from one of the problems that you could have while programming, your program has a certain amount of memory.

  • Part of it's called the stack.

  • And that stack uses too much memory.

  • It throws a stack overflow air and this often happens when there's something going really wrong with your program is just consuming memory wildly.

  • But the stack overflow website isn't just about that problem.

  • It's a whole cow community where people come together and help each other and I love that community of all of us coming together and making each other better are 40.

  • 40 asks what does front and and back and mean?

  • I love this question and you know what to show you.

  • I'd like to explain a little bit about how the internet works when you use a mobile application.

  • Let's say you're using google maps and google maps is telling you how to get from point A to point B.

  • There's a computer program that's running on your phone and that's called the front end, but not all the work is done on your phone.

  • In fact a lot of the work might be done on a different computer.

  • So what your phone does is it connects over the internet to another computer that we call a server and that computer can do calculations and send the answer back to your phone.

  • And you know, this is basically the idea of the internet.

  • We have all these devices and they're talking to other computers on different parts of the world and programs that run on this computer, we call those the back end.

  • So you have the front end running on things that you interface with and back and running on things that are doing some work behind the scenes that you never see.

  • You know, maybe it's a little bit like a car.

  • The front end might be the steering wheel, that's what humans interact with.

  • There's a whole bunch of technology there, the back end is the technology you don't see maybe it's like the engine, it's doing really important stuff.

  • But when everything is working smoothly, you just interact with that steering wheel.

  • Some people only specialized in writing programs for the front end.

  • Some people only specialize in writing programs for the back end or you might hear this term full stack engineer and those are programmers who can do both.

  • The front end and the back end.

  • And that's a good thing to be next question from Vegas Gasper.

  • What is the shortest piece of code that changed the world?

  • That's a good question.

  • And over a drink we could have a great conversation and debate this.

  • I'm going to say back propagation for artificial intelligence.

  • Back propagation is the few lines of code that tells an artificial intelligence algorithm.

  • If I see data, how can I become smarter based off of that data?

  • It's a very simple piece of code based off some cool calculus and that's where most ai gets its intelligence from say your ai algorithms trying to learn what a cat is and it sees a picture of a cat.

  • It can put it through its own little ai brain.

  • Back propagation will tell it how to change its ai brain so that it is better able to understand cats in the future.

  • To our but doesn't really have a question but a cute little rhyme.

  • How much could a C.

  • Plus plus if a C.

  • Plus could plus plus C.

  • Plus plus is one of the most popular programming languages.

  • In fact, it's the one that I first learned on.

  • That's how old I am.

  • And C.

  • Plus plus is it's what you want to use if you're writing a really intense program like a three D computer game or if you're writing the program to animate a Pixar movie C Plus plus is what you'd use C.

  • Plus plus is actually a descendant of another programming language called C.

  • And C.

  • Is like the grandfather of all languages like the latin equivalent from which may any different language to extend C.

  • Plus plus is one of those and you can see where it got its name from its C.

  • And then Plus plus this program speech for one better.

  • So it's like I'm like see but I'm a little bit better.

  • And there's other descendants you might have heard of like java and python.

  • And the fact that all these three languages descend from C.

  • Tells you how similar that they are to one another.

  • Why is C.

  • Or C.

  • Plus plus?

  • So good for video game programming because it's so computational e intense you have to render an entire three D.

  • World with trees in the distance and things animating in the front and that.

  • Just ask so much of your computer, C.

  • And C.

  • Plus plus.

  • They're like your bare bones programming languages.

  • They're the most efficient so they can run the fastest and they can do the most computations per second python and java they're easier to read so it's easier to write the program but the computer can't run them as quickly.

  • Loss mary angus 14 asks my computer science teacher asked what is python and I replied a very dangerous snake.

  • Uh And he beat me up.

  • I feel like we have to have a different conversation about corporal punishment.

  • Here, did you know the name python?

  • The name for this programming language actually comes from monty.

  • Python's flying circus.

  • The person who invented the programming language called python.

  • I'm a big fan of the Tv show.

  • So I gave it that name.

  • It's a general purpose programming language.

  • So you could write a google maps back end on it.

  • You could write data science, you could just write a script that does something fun.

  • Or you could write a chatbot even.

  • Do you want to see what python looks like?

  • I can tell you a really basic intro to python program Hello World.

  • And print 10 numbers.

  • Here's an example of a very simple python program.

  • This says when you run this program, so somebody goes to the computer and they click on, click on your program.

  • It's going to open up a console and it's going to say hello world.

  • That's the greeting we use when we're trying to show that we can write our first program.

  • It's like your program saying hi, I'm new to this world.

  • Tell me all about it.

  • And then your program in very cool faction says I'm going to print the numbers.

  • The 1st 10 numbers.

  • So it'll print zero, then one, then two, then three, then four, then five and six and seven and eight and nine main is what happens when somebody starts your program.

  • So death main says when someone starts your program, I'm going to execute all of these commands and then I write the commands one by one.

  • The first command I wrote is print.

  • Hello world Print doesn't mean like print through your printer it means show up on the screen.

  • The next line says for I in range.

  • One of the great things about computers is that they can do lots of repetitive tasks without being coming frustrated humans not so much.

  • This is one of those basic commands you need to know to make a computer repeated task.

  • It says I want to repeat something 10 times and 10 times.

  • I would like to print out a value.

  • This is a value that's going to change numbers from zero up til nine.

  • So when you run this program it'll print zero and one and two and three and four and five and six and seven and eight and nine.

  • Next question from esquire what is the meaning of error?

  • Four oh four oh four oh four is what you see when you go to a website and that website doesn't exist.

  • And the web pages saying I don't know what website you're looking for more broadly when programs don't know what to do or when they break they often throw a thing called an error.

  • And as a human you're given these errors errors always have codes they tell the human and they tell somebody who's trying to diagnose what went wrong exactly what the problem was.

  • So when you 044 that's a specific message saying exactly what went wrong was that I wasn't able to find the particular U.

  • R.

  • L.

  • You were looking for.

  • Web error codes were actually defined by the guy who invented the web tim Berner lee as I understand it.

  • He was just coming up with sequential codes.

  • I think the first four means that there was a problem with your web page for a 1424344.

  • Or just different problems that could come up when you're trying to load a webpage.

  • Okay next question.

  • Formula.

  • Our programming coding the same thing.

  • Yes coding is the process of opening up an application on your computer and writing a sequence of commands that look a lot like english but are in a specific language that your computer can understand.

  • You can code in something like python or javascript.

  • These are the languages of coding and that's how you tell a computer.

  • I want you to perform all these actions when somebody hits a button or when somebody opens this application, programming is exact same thing.

  • You're making a program when you're coding future, Lear what is raspberry pi and what can be used for future.

  • Earlier.

  • This is a raspberry pi and this is one of the world's cheapest computers.

  • What are we looking at here?

  • We're looking at a small version of a motherboard and on it it has things that you can plug in like a USB has a place for audio and a place for internet connection and on the chip, it has a thing called a CPU so it's central processing unit, so it can process programs and it has some space for memory, so it can store some data, it can connect to a power source, it could connect to a monitor and it can connect to lots of sensors.

  • And why is it soak?

  • Let's say you want to write a program but you wanted to make it physical and interact in the real world?

  • Maybe you wanted to make a robot or maybe you wanted to make a smart doorbell or something like that.

  • You could use this super cheap programmable computer and maybe you put a sensor in it and maybe you make another actuator and then you make something happen in the real world.

  • Next question from T J jesse TJ.

  • How do you code?

  • AI, wow, what a deep deep question.

  • In so few words, people might be wondering what a I means a I stand artificial intelligence and artificial intelligence is a very broad term.

  • It literally means any algorithm which is acting in an intelligent way.

  • The most common type of artificial intelligence is a type called machine learning and that's when an algorithm gets smarter when it looks at data or when it gets experiences of its own the most common way to code ai is in python using something like pytorch or tensorflow, you say here is the structure of my artificial intelligence network and once I have that struck, I'm going to write some code that can take in data and I'll tell my artificial intelligence to get smarter using data and that's all done in python.

  • But in 2022 the way people right, aI could be changing.

  • There are these really large artificial intelligence networks which have been published and sometimes writing AI is figure out how to talk to these really billion parameter neural networks.

  • So you can put in prompts that would give you interesting answers.

  • Elka must ask.

  • Do you practice algorithms frequently?

  • If yes, why I do practice algorithms frequently.

  • I practice algorithms frequently for lots of reasons.

  • One, because they're neat one because I teach them one because they keep me becoming a great programmer, but also because we invent algorithms.

  • But what's an algorithm?

  • An algorithm is basically any piece of code that does an interesting task.

  • So maybe it solves a problem that would take a lot of thought.

  • One example of something we worked on recently is we made an algorithm that can do a day.

  • Well I test and it's always being thoughtful about what size letter to show somebody next one algorithm you might hear a lot about is like the Tiktok algorithm.

  • What that does is it decides what video you should see next.

  • How does it work?

  • That's in fact a bit of a mystery.

  • I don't think they tell the world.

  • This is how our algorithm works.

  • But when people say the Tiktok algorithm, what they're talking about is how Tiktok chooses that next video Antam Get hub.

  • What the hell is get hub?

  • It sounds rude.

  • Get hubs not rude.

  • Is your friend.

  • Get hub is a website where a lot of us host our code.

  • So when I write a program often I'm working with other people and we use GIT hub to store our code.

  • A lot.

  • Like using google docs for when you're working on a word document together.

  • Get hubs are place for code.

  • It's also a place where you can go and see other people's code.

  • Some people choose to put their code up publicly, which means that when I'm working on a project, I can see what other people have done.

  • That's one of the cool things about computer science.

  • We're always building on top of each other's ideas.

  • So if somebody is built a really cool program, I don't have to start from scratch often.

  • I can build on top of their really cool program.

  • Next up from nana Simon, which coding language is the easiest one.

  • That's a good question.

  • What we teach intro.

  • Computer science at stanford, we use python because we think it's the most gentle introduction to programming.

  • But in the very first week we use an even simpler programming language called this is carol carol is a simple robot.

  • Carol can only move turn left, Put down a beeper or pick up a beeper.

  • But when you add in some of the basic control flow of programming, carol can do anything that we can do in python, which is incredible.

  • We use as a gentle introduction just to show you the basics and it's a great way to learn.

  • If you're curious, diners asks, do you have to be good at math to code?

  • I low key want to learn, but I'm terrible at math.

  • Do it learn to code?

  • You don't need to be great at math to code.

  • This is a car common misconception.

  • I think it has its historical roots in the fact that when programming was first invented, they didn't know where to put it inside the university and they happen to put in the math department.

  • So people think you have to be great at math.

  • But in reality I've seen so many amazing programmers who don't feel that confident in math and you know what I learned to program.

  • It will probably help your math out because it helps you do lots of things that use logic.

  • And math is one example of something that could use some logic.

  • I'd say.

  • What Do you really want to have if you want to learn how to program the desire to build things because programming is all about making stuff and patience because sometimes when you're making things, it won't work out the way you expected.

  • And if you're patient, you're willing to work through step by step you'll figure it out in cash.

  • 1401.

  • I have always been curious about the origin of coding computer software, artificial intelligence.

  • My questions were like how scientists could have bridged hardware and software for the first time.

  • What was their mean to do that?

  • And when did they realize that such a thing could be possible?

  • The history is so interesting in it.

  • It plays into so many important parts of human history.

  • Certainly one of the turning points was World War Two.

  • When alan turning and a group of other people in the U.

  • K.

  • Came up with what some people would consider the first computer.

  • Why?

  • So that they could decrypt german messages that they were sending between each other.

  • And you need to try a whole bunch of Secret keys.

  • If you want to decrypt it.

  • They built what I would consider some of one of the first computers and would try lots and lots of different keys until it could decrypt the German messages.

  • You could think of this as one of the first pieces of artificial intelligence because cracking someone else's code.

  • That sounds a lot like intelligence.

  • But the history of software goes way before that people were theorizing that you could have something like a computer back back in the day in the 1800s at a loveless and another Professor Charles Babbage.

  • They were saying I think we could have computers that work on digital ones and zeroes and actually these things could solve problems and add a Loveless without even having a computer started writing all these different algorithms and programs when computers didn't exist and they kind of showed the world this is going to be cool once we have the electronics for it.

  • Ni har D M asks is coding required for web design.

  • What's web design?

  • Web design is when you make a website and that can often involve coding.

  • It turns out a lot of the websites you interact with their running a lot of interesting code underneath the hood.

  • What happens when you click this button when I fill in this form, what's supposed to occur next and people write that in a coding language?

  • Having said that a big part of a web design team is also artists.

  • People just thinking how can I make this a beautiful website or how can I make this a beautiful user experience and it's a really valuable skill to learn how to become that artist or that user x experience designer.

  • You don't necessarily need coding for that.

  • Pretty hat hacker.

  • Ask the real question is do you need to know how to code in order to hack?

  • Why or why not?

  • We should break down what hack means because it means different things to different people.

  • To some people hacking means breaking into someone's website or something like that.

  • Maybe getting into a database stealing some passwords in my field, we actually call that cracking and that's quite illegal and I wouldn't recommend people do that.

  • Hacking in the world of computer science, sometimes is a shorthand for writing really impressive, regardless of which version you're doing the illegal version or the less illegal version.

  • If you want to be doing really interesting things with computers that maybe go against the grain.

  • Certainly knowing how to code is important.

  • Don't do anything illegal at home, jerry bandito.

  • Why is coding important?

  • Coding is how you get computers to do things for you.

  • So the ability to communicate with computers is just such a powerful tool to have.

  • Whether you're not, you're doing data science or you're in policy or your art, no matter what you're doing, there's probably a time when your career would benefit from being able to speak the language of computers.

  • But I also think coding isn't just useful.

  • It's also beautiful.

  • It is a really beautiful process of how you speak to the computer, how you create things out of nothing.

  • When I'm coding, I take ideas in my mind and I make them into reality.

  • Sometimes that's useful and sometimes it's just a beautiful process.

  • Okay, that's all the questions.

Hi, I'm chris peach.

Subtitles and vocabulary

Click the word to look it up Click the word to find further inforamtion about it