 So now to begin the semester we start to talk a little bit of a refresher on Java For our textbook at least in this lecture. We'll start to talk about Chapters one and two the introduction to a computer what it means to program and then start getting into some elementary Programming with that so the first thing if we start to take a look at a program when we start to think about what it means to Have a computer We boil everything down into binary data if we think about it We start to look at the ones and zeros and really all the ones and zeros are is whether or not I have electricity so Do a little exercise here. This is What I would call a switch Let's even expand this out. So I've got myself a Little switch going on here right now that switch has no electricity right here I've got electricity. There's power on this end, but there's none over here because they don't Connect now if you've taken any type of engineering course before as soon as I make kind of these two metal pieces connect Suddenly that electricity is transferring from one side of my hand to the next side of my hand So why do I talk about this? Well? That's actually where we get the idea of Working with data working with ones and zeros because the computer is just a Component all it does is that it handles electricity if you take a look at the motherboard you take a look at the processor the memory all it is is handling electricity and When I have electricity I get What we call a one and so as we start to build these things up we can start to build out our binary data So let's think about it Let's think about it like this, you know If we have an LED light bulb by itself with no electricity it is in the off state Well, what else can it do it can turn? Off So that it's got the zero we can classify that as a zero But it can also be on now when it's on that suddenly means that I have power and that's a different state So suddenly I get a zero and a one. I have two possible states So what happens if we add another LED light to the equation? Well suddenly my first state is I have a zero and a zero But as I look through all the different possible combinations of how electricity can flow through these two LED light bulbs What I get is suddenly one will have power The other would have power or finally my fourth state They both have power so I actually have what we classify as two to the power of two Possible states we have two to the number of variables going on there This is where we get that idea of taking a single bit one bit one one or zero and Expanding that out into what we call a bite eight bits That's actually you can think of it is if what happens if I had eight LED light bulbs Well suddenly instead of it being two to the second power. I now go two to the eighth power I got two I have eight different LED lights that can be on and off So I have two to the eight power possible combinations of all of those So why does that matter? Well when we think about binary again when we look at the computer all it does is it handles Electricity if we take a look at that Processor on the bottom of the screen, you know, I know it's a little vector image But those little prongs sticking out of it if we take a look at a real life one You'll see that it's got a bunch of those prongs sticking out on the back and if you count them out They probably have 64 prongs. Well, why because it's a 64 bit processor It's expecting two to the 64 possible combinations of electronic signals So instead of our LEDs that we had before we now are dealing with straight electricity So how does this start to fall into play well? Memory memories memory it is there to store data But the processor starts to break down into two separate quadrants It's actually sort of the the brain of the computer. The first portion is we get what's known as the control logic and What that does is that acts as sort of the counter the step-by-step instructional set think of it this way Hopefully, you know, you know how to cook or if at the best, you know how to boil water and cook ramen Or at least use a microwave, but there's a step-by-step instructional set that goes into cooking Let's just think about you know boiling an egg for a second You fill the pot full of water you bring the water to a boil you set the egg inside there and then you wait and then you wait and hopefully Eventually enough time goes by you take the egg out of the boiling water It cooled off you peel it and you now have a lovely soft or hard-boiled egg But it's a sequential step. You have to go order by order You don't try and take the egg out of the water before the waiting process is done Otherwise you undercook your egg or it never gets cooked to begin with the same thing happens with the control logic It basically is telling my computer my CPU where to go next That's actually where the ALU picks up the ALU. That's actually the brains. That's this that's the the brains of the operation That's what's telling us, you know to do the addition between our binary digits the do the multiplication move our data from One memory location to another memory location. That's where that stuff starts to come into play It takes that and if you can see you know on the slides, I know I'm covering it up a little bit But we have things like add or and Exor in the MV stands for move again. That's exactly what it does is it takes our data It moves it to another spot Well, that's spot when we start to look at memory. I said all it did was store data And if we took a look at memory, that's exactly what it does is it looks If we take a look each one of those little blocks that we see on the memory stick Basically, they start at zero memory address zero and they continue going on and another word for that is memory offset both work they're synonymous with each other but that memory address well as our computers load up as we start to kind of put more and more stuff onto the computer That needs to get loaded up in somewhere. So the fact that I have screen recording software going on right now and that's being buffered into My computer that's actually being stored in memory right now and then slowly but surely being written to my hard drive well Something as simplistic as the word hello Hello is just that and you know we take each one of those letters each one of those letters has a binary Notation, so hopefully you've brushed up on your ASCII, but each one of those letters has a binary notation 0 to 256 or 0 to 255 that then has to get stored into memory somewhere Well just Putting these things in the memory how does how do we start to do that because obviously I don't want to have to do in V Let's think about for example The idea of just simple addition or simple multiplication simple multiplication is just Repeated addition. So if I were to load up notepad plus plus And I were to say something like two times 64 What I'm really looking at here is Zero zero zero zero zero zero one zero I'm looking at the binary notation of two if you were to remember from binary conversion in CIS 110 This is you can convert this out and you'll get two Now instead of just doing 64. I can't just do this This is how to represent 64 in binary, but the CPU doesn't know how to do that We have to teach it. We have to build it and what happens is I would have to do Repeated Edition I would have to continuously add to this and eventually I Get something like this I would get now four and then I'd add another two and I'd add another two and I'd add another two That would be literally my program multiplication Again, that's what we classify as more of a low-level language But we want to go ahead and expand on that. We want to design Languages that are a little bit more complex We start to look into different styles of programming languages Doesn't matter which one you learn one of the idioms one of the little things that Advanced programmers are advanced developers sort of laugh at is beginners always saying how many languages do you know and Truth is it doesn't matter how many languages, you know, for example, I don't know Mandarin, you know I don't know Spanish. I don't know French. I know that sucks. I'm sorry. I'm trying to work on my Duolingo, but I'm able to get by in the environment I live in by using simply one language and using that language very well That might not always be the case the same thing goes on with programming languages Really, if you know one language, you know them all the logic is still there making variables making Conditional statements loops the rest is extra fluff Well, we take that information and we start to build upon it and what we do is we develop what's known as source code What we do with that source code is we actually convert that into Machine code via the compiler now the compiler all it is is it acts as a translator for us It basically comes in and it says alright. This is what the source code means to the computer So again, I don't have to do that two times 64 multiplication into addition I don't have to make the repeated addition happen I just have to say to asterisk 64 So now that we've started to build upon this idea we break down into something called computational thinking what does it mean to actually Have knowledge and that breaks down it we have different kinds of knowledge. We have declarative and Imperative and this kind of breaks down in the idea of you give a man a fish you feed him for a day You teach a man to fish you feed him for a lifetime that idiom is right in place here because Declarative knowledge is exactly that. It's just statements of fact. It's a very cut-and-dry Example pi is three point one four one five nine two, you know what it says on there Our classroom that we go into is in B 243 my name is Adam. Go ahead. My hair is brown. I'm wearing blue with white stripes That's factual declarative information Teach a man to fish and you feed him for a lifetime. That is imperative knowledge. That's that how to it's the Algorithms of programming. It's how we design out the code For example, how do I fish? I don't actually know how to fish and what happens if I didn't have someone who could teach me What if I couldn't call up my dad or my my uncle and say teach me how to fish? Well and say the internet doesn't exist so I can't go on the YouTubes and figure it out How do I figure it out? Well, that's actually where we as computer programmers start to pick up is we start to go and we start to pick that out And we start to figure out how to make our recipes Again those recipes, you know if we think about it in that food analogy again instead of boiling an egg think of something more complex Like chicken cordon blue. There's a lot of set-by-set instructions that go into chicken cordon blue First we have to get the ingredients and I don't mix those ingredients all together at once Because if I do I get this weird slop and that's just not what I want What I have to do is I suddenly I mix my dry ingredients and I send them to the side and I mix my Wet ingredients and I set them to a side then you know then I don't just immediately try and bread the chicken I have to split the chicken in half I have to flatten it out so that when I lay my cheese and my ham inside it I can roll it up Bread it and then cook it as need be so there is that step-by-step process I have to follow it otherwise I ruin my chicken I get sound vanilla and No more class Not that bad So how do we build our own languages? Well, we start by looking at something what we call primitive constructs primitive operators Every language has these be it a programming language or English and all they do is as we Continue to we start with the basics but as we continue to build upon them. We make more and more complex Statements think about the word bathroom Bathroom bathroom by itself All right If a five-year-old were to come up to you and say bathroom, you know, you probably understand get an infern so okay Well, you mean use the bathroom or where is the bathroom and point them on their way But at what point do you kind of look at someone and go use your words? You know say a ten-year-old walked up to you and said bathroom. Are you suddenly like what are you asking? Bathroom by itself is just a noun. It's a primitive operation. It's a primitive word But we can start to build upon it if we start to add in more context if we start to go where is the bathroom all these primitive words Stringed together we now get a comprehensive complex sentence Well, we can even make that even more. That's just a question But if I were to say where is the bathroom said little Billy doing the PP dance I've taken my question and I've now turned it into an actual story I made it more complex as I continued to build on that idea The same thing happens inside of programming languages The first thing we talk about are those primitive constructs in English its words its punctuation In Java we have a little bit of something different. We have numbers strings operators now I'll take a second to just think about Strings for a bit because strings are not the same as text And that's always something that throws people off in the beginning, but when we think about strings This is text Hello world if I want to represent that Senate if I want to actually have my computer program say hello world I Have to include quotations double quotes on both sides of it hello world that allows me now to Store that as a primitive construct as a piece of information So we can continue to build on this idea again bathroom by itself not Proper English syntax, you know the words right, but it's not how we would use that That's where we start to get into static semantics How things are being built up? Synthetically is it a valid meaning for example? I am Spartacus. My name is Adam. Govita. Where is the bathroom? Can I use the bathroom? Donde está el baño? Those are all valid syntax for Okay, all but the baño one are valid for English that one's for Spanish the same thing actually happens with programming Something like 1.8 divided by 1.8 that's syntactically Valid that's semantically valid 1.8 divided by cat not so much You know, I don't even understand kind of the concept and how would it go on there that seems like animal cruelty of my opinion We're dividing cats all of a sudden. I don't like that. I like cats That's where that stuff comes into play and then finally we get just simple semantics You know, what does it mean for example in English the reason why I mentioned this is English can be Interpretive so suddenly something like Java is so awesome That sentence by itself can have a number of different meanings. I can be sarcastic with that. I can be truthful I can say Java is so awesome Freaking out and wigging out over here and I have okay. You can tell I have a passion about Java Or you could look at maybe some of the students and they're like Java is so awesome Well, but aside from the the cross-eyedness, you know, what did I do? I gave you the verbal cues that I was actually not 100% saying I was saying the same thing But I was not saying it the same way Programming is a little different suddenly There is only one meaning for anything if I say for example, Java equals Awesome as a string what I'm saying is I now have stored in memory something called Java a variable and I have it being stored as the ones and zeros that represent the character notation of the word the string Awesome, so a w e all lowercase still all that matters, but there is no there's no hidden context It all means one thing So we'll stop there