Placeholder Image

字幕列表 影片播放

  • creating these classes requires equipment and service.

  • Is that cost money?

  • If you appreciate this education, please think about going to Eli the computer guy dot com and offering a one time or monthly recurring donation.

  • Welcome back.

  • As you know, I am Eli, the computer guy in it, that today's class we're going to be doing an introduction to pseudo code.

  • So to be clear, pseudo code is not a a really programming language.

  • Pseudo code is simply where you write out in a human readable fashion.

  • How you expect your programmed operate.

  • It's a bit like a verbal version of wire frame.

  • So I did a class on wire framing before.

  • And basically all you're doing with wire framing is you're taking a pen and paper or maybe a more sophisticated piece of software, and you're simply drawing out what you think your application should look like, and more or less how your application should work so that before you get into actually right in the code before you get into actually building the infrastructure, you can see if it makes sense.

  • If what you're doing make sense the way you think it does, you can then also have discussion was with any of the interested parties and make sure everybody is on board.

  • Well, basically, with pseudo code, all we're doing is we're basically doing a type out version of this.

  • So instead of actually writing out our program in Java script Ph.

  • B.

  • C.

  • Sharp, whatever else we're going to do is in a human readable fashion.

  • We're going to type out how we expect our software to work.

  • So basically, what we're going to say is these these are the variables that should be declared.

  • These are how the variables should be set.

  • We should connect to X, Y or Z database.

  • We should insert into that database these particular variables.

  • After that is done, something else should happen.

  • So on and so forth.

  • And so what this does is before, before you get elbow deep and actually making sure the DL emitters air right?

  • And you're using the right functions and everything else.

  • This allows you to sit there, right everything out a logically and just be able to sit there and make sure that it makes sense.

  • Okay, Does this make sense?

  • Does this make sense?

  • Does this make sense again?

  • I talked about that in the wire frame in class.

  • Ah, the whole question of where the time stamp should be added.

  • So should the time stand be added from a real time clock on the Arduino, or should time stand be added from the PHP?

  • Scripts are basically here.

  • The Arduino takes a temperature reading.

  • It takes a humidity reading.

  • It sends that information to a PHP script.

  • And so we could have the timestamp creed created from the Arduino itself.

  • Or we could have the time stamp created on the pH be script.

  • Or after I did that video right after I did that video, it showed all this.

  • You know, some people were saying, Well, depending what database they're using, possibly the my sequel database or the database itself that could automatically add the time stamp.

  • Right?

  • So the thing is, this is why drawing this stuff out is valuable because we need a time stamp, right?

  • In order to do some kind of temperature recording system, we just simply need a time stamp but doesn't get at it at the end, you know, doesn't get out of the PCP.

  • Scripture doesn't get at it at the data.

  • He's my drawing things out, then you can have an argument about where it should be added.

  • The same is true by doing the pseudo code, right?

  • When you're doing the pseudo code, when you're writing everything out, you could be right in everything out.

  • And so you may go down again to connecting to the database is getting into the database.

  • And so you're thinking Okay, well, we already have.

  • Ah, whatever.

  • Database server without her infrastructure.

  • So I'm going to connect to that database.

  • We're just gonna create a tip, right?

  • And so you're just drawing all this out?

  • Well, then, if you're sitting down and down, you're talking to somebody else.

  • They may say, Well, you know, has the database administrator So I'm the person responsible for the database server.

  • I don't feel comfortable with an Arduino device.

  • Being able to connect to the same server are other systems are connected to, So I don't want you connecting to our server.

  • You're gonna have to find another solution.

  • Well, then you can sit there and go.

  • Okay.

  • Well, maybe I should use a roar.

  • Or maybe I should spin up my own, sir.

  • Right.

  • But that's just simply illogical block.

  • It's sitting there basically says, I know I need to connect to a database server.

  • Then once you have all the discussions, then you can sit there and write the code to actually connect to the most appropriate database, sir.

  • The other thing is valuable with pseudo code is there is his idea.

  • Nubes have you know that?

  • You know, coders, riel coders know everything, right?

  • They just sit down.

  • They just tippy tap type out all of the code perfectly the first time.

  • Well, the reality is, is there's a lot of water called frameworks out there.

  • They're just 1000 different functions out there.

  • There is a lot of ways to write code for the to be the best in the particular situation for the thing that you're trying to create.

  • So one of things that you can do is been pseudo code.

  • Basically, you're just simply writing out in human readable fashion What, you what to happen in your code.

  • And then what that allows you to dio is that basically paint by numbers, go through and then fill in those blocks?

  • Okay, I know howto I know how to declare variables, so I just type out the variables I want declare within its possibly setting variables from something like the yard.

  • We know you may not be sure exactly about how you want to do with that.

  • So then you can go do the research.

  • You can figure out the best way that you want to set those variables and then then you can go back.

  • And you can feel that in with how you want to set the variables and basically what you could D'oh is with the pseudo code.

  • This gives you a paint by numbers format for going back and replacing the human readable code that you read that you've written with the actual programming language that will will actually do the the application that you want.

  • So this is the basic idea of what we're talking about with pseudo code.

  • So I've written up a little bit of pseudo code for the project that I was talking about in the wire framing class.

  • So first, before we get to the pseudo code, let's actually go over the table.

  • Let me explain to you what we wire framed out up until this point so that the pseudo code will make sense when I'm showing it to you.

  • So this is a basic wire frame diagram of how our little system that I want to create will operate.

  • So basically, what I want is I want to create a little temperature humidity sensor and that is going to submit data to a my sequel database.

  • And then I'm going to get an administration dashboard where I can see what the current temperature is, whether humanity is, and then ch are for the last 24 hours and see a chart for the last week.

  • So again, this is a very, very basic system that were created.

  • And so within this particular wire frame, a diagram, a TTE.

  • First, we have the Arduino see yard we know is actually going to have a temperature sensor on the humidity sensor connected to it.

  • It will then send the data to a PHP script.

  • PHP script will parse the values from the humidity and temperature sensor.

  • It will then create the variable values for temperature and humidity.

  • It will then add a time stamp.

  • So for here I'm actually at the time stamp on the pH be script.

  • It will then insert the data into the my sequel database temperature, humidity and that time stamp that we've created from there.

  • The add meds on HD Male, whether PHP on dashboard that will pull the values from the my sequel database.

  • This will give us a current temperature.

  • You're a current humidity, a chart for the last 24 hours for temperature and humidity on a chart for the last week for temperature and humidity.

  • So this is basically just a little wire frame diagram explaining Maur or less logically, how this system should operate.

  • So the pseudo code that I created today is create a little bit of pseudo code from the Arduino and upgrade the pseudo code for PHP script on.

  • That's what we're gonna be looking at today.

  • So here's the pseudo code that I created.

  • If you notice I am literally just using pages for this s o again, you could write this out with a pen and paper.

  • To be clear, you could you type this in note pad?

  • You could type this and more sophisticated software literally.

  • All we're doing, though, right now is we're simply typing out normal text words so you can use any kind of text editor word processor.

  • Whatever.

  • In order to do this for here, I have the code a pseudo code for the yard.

  • We know, and I have a pseudo code for the temp dot PHP is basically the PHP script that will take the values from the Arduino and pumped them into my secret database.

  • Eso with this.

  • Let's take a look at what biologically plan to dio with the artery?

  • No code s O.

  • Since I'm doing dealing with an Arduino and I'm dealing with sensors, I know that I'm going to need to import libraries for those particular sensors.

  • Now, to be clear here, I'm not sure which libraries again.

  • If you deal with Arduino, there could be 10 different libraries for the same stupid ass sensor.

  • Right?

  • So I'm not sure exactly which libraries I'm going to import, but I just need to remember that I do need to import some libraries in order to make those sensors function for appropriately.

  • So when import libraries one import a library for the temperature sensor and want to import a library for the humidity sensor Now, to be clear here, these maybe two entirely different sensors, so they may need two entirely different libraries.

  • Or if I'm using a digital temperature, humidity sensor, it maybe one library that deals with both of those sensors.

  • At this point, I haven't done the research.

  • I haven't looked into it.

  • So I simply need to know that I need to import libraries for those sensors.

  • And so basically, I'm just saying, Okay, I'm going to need to import libraries.

  • Not sure which ones, but I'm going need to import them.

  • Then again, in the Arduino world, we need to connect the sensors to pens.

  • And so simply all I'm going to say, say, here is connect two pens, the temperature sensor and the humidity sensor.

  • So I'm not even sure which, since I'm going to be using right now, we're gonna be using analog sensor.

  • I'm going to use a digital sensor.

  • I'm not sure you've dealt with the Arduino world.

  • You know, there's analog pins and there's digital pets.

  • So a digital pen sensor need to be connected to the digital pen analog sense.

  • We need to be connected to an analog pen.

  • Not really even sure what sensor I'm using.

  • So all I'm putting here is that I just need to connect whatever sensors I have, I need to connect them to the appropriate pens, whatever those are then from here.

  • Since we got a temperature sensor, I need to get the value from the temperature sensor.

  • Eso again.

  • Whenever you deal with the Arduino world and sensors, you get a value that comes in.

  • But that value is not the final number that you need, and so that I'm simply going to say, turn a temperature value into Fahrenheit.

  • So this could be important with sensors in the Arduino world is different.

  • Sensors use different equations to get you to that final number that you need.

  • So again, right now, I'm not sure if it's digital.

  • Not sure if it's analog, I just I just know I need to get the value from a temperature sensor and then you turn that value into something usable for me.

  • I need Fahrenheit.

  • Then I'm going to get the value from the humidity sensor again.

  • And then I'm going to turn that value into variable for percent humidity.

  • So I know that's there.

  • Then what?

  • I'm going to dio I'm going to use a post.

  • So basically posts not quite sure how to do it yet.

  • I need to go and do my research, but I'm going to post to tempt dot PHP script Fahrenheit and percent humidity.

  • So what you can see here is I have I have written out in a human readable fashion.

  • Basically, how this software, how this application is supposed to operate on the yard wayto what is useful about this is that I can then take this to an executive to a manager to a non technical person and say, OK, this is the information I plan to get from the yard.

  • We know.

  • Does this make sense to you again?

  • This is something a 12 year old should be able to understand on.

  • Then you can have a discussion like, Oh, you're only getting information for the temperature and humidity.

  • What about light or what about water, right?

  • Oh, you know, this is going to go into a server room.

  • I thought this Arduino device was also going to be able to tell if there's any water leakage in the server room.

  • We really should have something that will tell us if there's any water in the server room and then from here before you get to the coding and writing everything out.

  • Then you can simply say OK, import library.

  • You know, you simply say water sensor and then you can go down here and I'm gonna connect water sensor pen.

  • You go down here and get the value from the water sensor into something that's actually useful for you, and then you can post water, right?

  • But that's the nice part about this.

  • If I actually wrote this out in Arduino Co.

  • People look at it and they were just all right there, like it's code I don't understand that would give up by writing it out this way.

  • This is something everybody can get around the table, and they understand what's going on because again, it's breaking out simply and this human readable fashion.

  • And then all you do from here and again, it's just simply paint by numbers.

  • At this point, when I figure out what sensors that I want to use, I'll then import those libraries.

  • What, since I figured out what sensors I want to use, then I'll know what pens I need to connect them to.

  • Once I figured out the sensors I need to use, I don't know how to get the values from them.

  • I don't know what equation that's required in order to turn those values into something useful.

  • Once I have all that kind of stuff, they don't know how to post to the pH.

  • The script.

  • I don't that in there.

  • Then we go down to the temple dot PHP and again, I've rented it out in much the same way.

  • But you'll notice here again one of the things to understand when you're writing out the pseudo code is you can put in Maur and less actual coding language that you prefer again.

  • If you're going to be having other people reading your pseudo code, you want to make it as readable as possible.

  • It's just simply for you.

  • You can actually dump in code as you're writing this out because you know what's going on again.

  • The important thing to understand about pseudo code is not that you do it quote unquote right.

  • The important thing about pseudo code is that what you're doing here is you're creating a blueprint so that you're able to write the Finnish code the best way possible.

  • So for here, what I'm gonna do again, I get a little bit, Maura and actual coding language itself.

  • So we're gonna create variables.

  • So my creative arable declare a variable basically for dollar sign, temp, dollar sign, humidity, dollar sign, time stamp, right.

  • Those the three values that we're going to send into the my sequel table.

  • Then we're gonna convert the post values to the variables for dollar sign, temp dollar sign humanity.

  • Then we're gonna come down here.

  • We're gonna set dollar sign, Time stamp.

  • So right, That's the time stamp variable.

  • And again, this is where I just want to show you.

  • I can actually just put in the code if I know what the code is.

  • And again, this is just for me myself.

  • And I just put in what code?

  • I'm gonna use the time stamp equals time, you know, open parentheses, close parentheses.

  • What a cynical.

  • So, basically, this is the time function within PHP.

  • So since I already know how that operates instead of instead of typing out, you know, something to be human readable, even if nobody else is gonna read it.

  • I just put in, put in the code there.

  • Then I'm gonna come down here.

  • Maybe I don't really know how to connect to the database, and we're not really sure what I'm doing.

  • I can simply say connect to database on here.

  • I can just plug in the database that I think I'm going to connecting into.

  • So I think I'm gonna be connecting to a local host.

  • I think it's gonna be in there under the temperature data days.

  • The user.

  • I'm going to use his temp input user in the past, but I'm gonna use this.

  • 123456 Right.

  • So I can plug all this, information it here again before I've gone into the code or anything else, actually start writing things out.

  • Then I can go.

  • I can talk with the interested parties, verify I can connect to the server that I think I could connect Teoh so on and so forth.

  • Then, from there, I just simply say I'm gonna insert into the temperature table attempt table in the temp TB and one insert temp, humidity and time stamp.

  • And again, this is this is another place where if you're showing this to other people, that may be saying, Oh, that's all we're inserting into the database again.

  • I thought we're gonna insert, you know, a water water alarm.

  • Or I thought we're gonna insert, like right that we're gonna insert some other readings here on again before you actually coated anything out.

  • This allows you to create that blueprint.

  • Have everybody being discussed what's going on and then paint by numbers from there.

  • So this is all that pseudo code is all pseudo code is writing out in a human readable fashion.

  • How you expect your code to operate so that you could get buy in from the interested parties and so that then you could just simply do a paint by numbers and add in the actual code as you go.

  • So that's a brief overview of pseudo code, and that's how I personally you pseudo code.

  • Now it is important to understand the difference between doing pseudo code for yourself and your own projects and possibly a small team versus doing this in the enterprise world.

  • Just like wire frame me just like wire framing.

  • You can simply wire frame on a piece of paper.

  • But if you're working in a large company with multiple different people, all working on the same project wire framing a piece of paper probably doesn't make the best sense for you.

  • And so you should go out and most likely purchased some wire frame.

  • It's something we're out there so you could do sharing, editing, communication, collaboration, all that kind of stuff, right?

  • The same is true with pseudo code.

  • So if you were just typing this up for yourself, you can make it is pretty or as ugly as you like.

  • As long as you understand what's going on a cz.

  • Long as you can follow your logic, that's fine.

  • But to be clear, if you're working on a larger team or if you're working in a larger enterprise environment, they may have their own way of doing pseudo code again, one of one of the funny things in the technical world of some.

  • Sometimes we come up with these ideas on how to do something so that it's easy.

  • You know anybody could do it, but that, you know, cos get involved in higher ups, get involved.

  • All of a sudden, the pseudo code that you're writing can have as much syntax and everything else has regular PHP received sharp coat.

  • So it is important.

  • Understand that if you go into the enterprise world.

  • They may have their own way of doing sudoku.

  • Oh, they may have their own syntax that they use.

  • Basically, if you're if you're going to be writing out that a function is to be created or functioning because needs to be called, they may have a way that's written in their particular pseudo code again.

  • So everybody's on board how the formatting is done when he used has use spaces where you bullet points, what gets bolted, right?

  • So that's just a important thing to understand.

  • Like you're sitting there looking at this and you go, Oh, okay, I know pseudo co now and then you get hired some major company.

  • And but let's face it, you show them what I just showed you.

  • They may laugh.

  • A.

  • The reason being is again because that the level of pseudo coma that they're going to writing is much, much higher than what I just showed you.

  • I'm just showing you something for a little small project.

  • So again, that's that's something that's important, understand?

  • You know the difference between the pseudo code that you would write for something that's gonna be 100 lines or less of code is going to look different than something again.

  • Imagine imagine software out there, you've got 10,000 lines of code or 100,000 lines of code you're looking at basically being a create modules or things you're using multiple, different people in order to create those modules.

  • Then you want everybody to be on board, right?

  • So if you if you type out pseudo code.

  • But other people don't understand what that code means right again.

  • If it's paint by numbers but the person doesn't understand, they may then right, full fledged code.

  • That doesn't do what you needed to dio because they didn't understand what was written in your pseudo code.

  • So this is just an important thing to understand when you're looking at something like pseudo code or you're looking at weir framing or anything else.

  • What you're gonna be using for yourself in a couple of person shop is going to be different than what you're using.

  • The enterprise world just again, like any of this kind of stuff.

  • I just realized it gets more sophisticated.

  • The software things that you used does get more complicated, so just be ready for that.

  • So that's really all there is to say This is a basic introduction at the pseudo code again.

  • I know for a lot of the new people out there, they're like, Oh, I don't want to waste my time wire frame And I don't want to waste my time with pseudo code.

  • I'm just gonna dive right in.

  • But as I say, it's just like it's just like a carpenter building a bookshelf.

  • Write a book.

  • South is a really easy thing to build for a carpenter, but they're still going to draw out at least basic schematics.

  • So as they're putting everything together, they have something to reference so that they know what they're building is what they think they're building, right.

  • It's very It's very easy in the heat of the moment.

  • Or when you get tired or something like that to start forgetting things or making mistakes, having something that you can fall back on and go Oh yeah, yeah, I do need to do this.

  • This is how it needs to get done, that make sure that the product that you put out there actually does what you plan for it to do in the beginning.

  • So as always.

  • I enjoy doing this video on Forrester on the next one.

  • Apparently, the type of content you just saw is not what Susan W.

  • Wants for the future of YouTube.

  • This means that recommendations by YouTube to this channel have dropped massively, and views are becoming a comically small I hate to ask.

  • I used to say I would never ask, but if you could subscribe like common and most importantly, share the videos that you appreciate, that may help slow the death of this channel.

  • Do you remember that if anything at all happens to this channel, you can go to Eli, the computer guy dot com, to view the content and access information not available on YouTube.

creating these classes requires equipment and service.

字幕與單字

單字即點即查 點擊單字可以查詢單字解釋

B1 中級

編程介紹 - 偽代碼介紹 (Programming Intro - Pseudocode Intro)

  • 7 0
    林宜悉 發佈於 2021 年 01 月 14 日
影片單字