to learn more about earning college credits with study hall courses check out go studyhall.com or click the link in the description let's say you're going to go visit your uncle in Sheboygan and you get lost because hey it's Sheboygan and you've never been there what do you do well if you're living in 2023 you'll probably take out your phone open up the map app and figure out why you're staring at a surf shop instead of your uncle's condo and then you call your uncle because you are definitely at the right address probably rewind that about
a century and a half ago and that interaction is even harder because we were reading maps on paper and communicating by Telegraph if we were lucky computers have fundamentally changed all of that thanks to their incredible capacity to access manipulate and share information even this video is brought to you by computers and with all that computers can do it might seem like the incredible power of computers comes from them being smart but actually computers are Mindless aimless uncaring machines at least for now it's humans who breathe the spark of utility into the lifeless silicon of
a computer and the way we do that is with the Art and Science of programming I'm Sabrina Cruz and this is study hall code and programming for beginners foreign before we get too far we should probably be clear about what exactly we're calling a computer sure we might feel like we already know a computer when we see one but what about the digital dashboard in a car or this thing which is never more than three feet from me are they computers broadly speaking a computer is a machine that follows a sequence of instructions the examples
I just mentioned are technically computers because they're machines that follow instructions in order to carry out some function and let's pause because there's an important point there computers are basically just doing what they're told they don't really know anything computers can execute instructions with exact Precision very quickly and reliably that's the source of their power and their Achilles heel like imagine asking your friend Amelia to put the kettle on the stove for a cup of tea and she says of course dear because she's trying a bad British accent for some reason two minutes later you
go to use the hot water and find out the kettle is just sitting there on the stove not heating without even any water in it it sounds ridiculous because obviously we meant to put the kettle on the stove with water inside it because the whole point is to boil water to make tea but technically Amelia literally did what you asked computers are basically that friend computers don't understand intent or context like we do So the instructions we provide are really important because they are what make computers powerful behind the scenes and the specific sequence of
a simple instruction for a particular purpose is called a program as we saw with Amelia and the kettle it takes a certain level of understanding and skill to put together the series of instructions in a program so a computer will do exactly what we expect that's why it's a whole field the practice of writing instructions in just the right way so computers do something useful is called programming there's also a fair amount of theory about what kinds of things are possible with computers in the first place this is where programming intersects with a much broader
discipline called computer science together programming and computer science can push what humans and computers are capable of truly once we become familiar with it and get some experience programming the potential for what we can do with a computer becomes almost Limitless now to start making sense of what programming is and how to how to do it we'll need a lot of key ideas first computers don't understand human language in fact a computer doesn't really read words and symbols the way we do they turn them into numbers which is their native language so because computers are
doing this behind the scenes translating programs have to be communicated in a specific way that allows them to be turned into instructions a computer can follow we do this using what's called a programming language human languages have grammar which are a set of rules for putting words together meaningfully and programming languages have what's called a syntax that determines how Concepts have to be expressed in order to be understood like how an English boil the water means something very different from water the boil gross in this series we'll be using the programming language Java in our
examples because it's widely used in the real world the code runs reliably on lots of computers and it has some really neat features that'll make our lives easier the next key idea is that even though the syntax is important many programming languages are typed out in a way that humans can still read pieces of text written in a programming language are called code and they're the pieces that make up computer programs to see how writing instructions with specific syntax lets us solve problems let's visit red Mila a teacher writing a program that randomly assigns students
into groups of five for classroom projects her students always accuse her of never letting them work with their friends but with a program red Mila can make groups with the Press of a button and show her students that the groups are truly random to write this program she follows a general process of programming first we Define the problem that needs to be solved for rad Mila she wants a computer to take a list of names and randomly group them into lists of five names each The Next Step to design a solution red Mila decides to
have the computer Shuffle the list of names and take the first five as a group then the next five is another group and so on then it's time to write that solution in code which we'll get to in the next few episodes and once she's written her code redmela is all set right no when she tries the code there is a problem if the list of students isn't divisible by five some names won't get put into a group because code has to be written in a very specific way code often doesn't work perfectly the first
time when that happens it's called a bug and we simply review our code to identify and fix any issues then test the code again we call this step testing and debugging it's after that step when radmela is finally ready to deploy her program sometimes you might write code to perform a single task just once in that case you execute your code you get your output other times you might want a program to be a tool you or someone else can use over and over for instance when other teachers hear about redmilla's program they ask her
to share married on the staff computer network so they can assign groups of any size during classroom activities over time red Mila also ensures that the code still works and makes new tweaks to include new features these final steps of releasing and tinkering with code to keep it functioning properly are often called deployment and maintenance and that's the gist of programming it's a process we'll encounter these steps again as we tackle different problems throughout this series and it's important to recognize all the steps of the process since each is critical for getting useful work from
a computer but for now let's zoom in on the writing code part since crafting the instructions or program is crucial to programming to avoid the trouble we encountered with our Kettle boiling friend pieces of code and the programs they build require a very particular logic or set of principles that guide how the code is built one way we use that logic in our programming language is to break up any problem into small tasks that make up the individual piece of code kind of like how sentences make up pieces of text and there are some basic
tasks which make up lots of code we tend to write the first is displaying or printing some piece of data for us to look at another task is storing pieces of data we input into the computer so we can do something with them later computers can also perform basic math operations like adding subtracting dividing and multiplying numbers they can also make simple decisions like only showing a sentence from a piece of text if it contains the phrase Goblin mode and computers can repeat tasks in a simple way like going through a list of addresses and
pulling up the street name for each address that might not sound like an impressive array of activities but these few tasks are some of the core building blocks of programming by weaving together a bunch of tasks like these we can do all kinds of complex things from designing video games to managing online marketplaces another way particular logic shows up in our program is the order we weave the tasks together giving the computer instructions in a particular order or c sequence is essential for getting it to do what we want we can work through this idea
with even a basic task like so many before us our journey to programming Mastery starts with a classic example hello Sheboygan I mean Hello World the goal of this program is pretty simple we just want the computer to display the text hello world we can give an outline of this program in what we call pseudocode it's not a real programming language but it gives the gist of what we want to do in a way that resembles code and is easier to read in this case we want the computer to print the text hello world now
let's see what it looks like in the programming language Java and get our first real look at some code this is the standard template for how to start a Java program skipping some of the details which we'll explore later the basic idea is that this opening code tells the computer start the program here inside these curly brackets we find a bunch of words separated by dots this is the syntax in Java for telling the computer to print on screen in whatever text is in quotes in this case it's just the words hello world when we
run this code hey Presto the program does indeed print the words hello world to dive into the details of how to run Java code you can check out the link in the description admittedly this seems like a lot of work to get a computer to spit out a tiny bit of text but most of this is following Java's particular syntax in order to exactly relay our instructions to the computer to write out the piece of text we want that's because again a computer has no idea what it is we want it to do it's humans
through the act of programming that give the computer a direction in the form of code so our simple hello world program illustrates the general ideas that we will apply to much more complicated programs we're only just getting started it's easy to feel a little frustrated at the amount of work we have to put in to guide computers in carrying out tasks whether they're simple or complicated but once we become familiar with the logic of programming we can write code that gets computers to comb through data for patterns render stunning Graphics land a probe on another
planet and many more things that would be very difficult or even impossible for us to do on our own however there's one crucial thing computers can't do decide the things that are or aren't worth doing that responsibility is ours as incredible as computers are their power makes them a remarkable resource for both good and unfortunately enormous harm if we're not careful over the course of this series we'll gain the knowledge to better understand computers and develop the skills that will Empower each of us to use them for solving important problems if you're enjoying study hall
code and programming for beginners and are interested in taking an online course and earning college credit check out go studyhall.com or click on the button to learn more thanks for watching see you next time