Introduction to Programming
Transcript
Hey, everyone. Uh, we are going to cover chapter one of the textbook this week, and chapter one essentially is an introduction to what programming actually is, and you get a pretty small taste of programming in Visual Basic. So, with all that being said, what I want to talk about is what programming actually is, and, in order to talk about that, we're going to go into a little bit of a discussion about computers and programming languages and all that very fun stuff.
There's a lot of, I think, pretty interesting context, but I could be pretty biased given my computer science background. Regardless, um, let's get into it. So this video covers material from F1.1, F1.2, and F1.3 in the textbook. I don't cover all of F1.3. I kind of talk a little bit about some of that material there, but I… I do cover some of the stuff from F1.3. However, 1.1 and 1.2, I do cover a good amount of all of that.
So, first off, let's talk about what makes computers kind of special as a machine. Most machines can only perform one task. If you think about, like, an old-fashioned car or something like that, the engine inside of that car only performs one task, which is taking in some of the fuel, igniting it, and then using that fuel to move the pistons, which then, uh, is able to power the car. Uh, an old-fashioned sewing machine is, uh, built to perform the task of based on sort of the settings that you give it and all that kind of stuff.
Um, it will perform the task of actually moving the needle and directing the fabric, all that kind of stuff. It'll move the needle to do certain stitches, it will move the fabric forward and backwards in order to make those stitches work, and it's controlled by a foot pedal, of course. You can actually set those settings, but, once those settings are set, it's only really doing one thing, which is actually sewing.
Computers, on the other hand, are machines that can actually be given instructions to do many different types of tasks. Uh, your computer right now, the computer that you're watching this video on, was doing the task of browsing the web in order to actually, um, get to this video, or you might have been using the Canvas app in order to get this video. That's also a task that that particular computer could possibly do.
Um, and then, once you actually start playing the video, the new task is streaming the video, so sending out the request for this video to be played, and then receiving the different data packets for this video so that it's actually able to project the video onto your screen and project my voice as audio, all that kind of stuff. Now, there's a lot of different computers out there. For example, your smartphone is a computer. You can install different apps on it,
and that app… those apps give your smartphone new functionality. Of course, a laptop and a desktop are also computers. You can install applications on them, you can use them to do many things. There's also computers in modern cars, in modern sewing machines, and modern pipe organs even. There's computers controlling all kinds of stuff nowadays. Um, instead of building machines that are have a custom purpose to do one particular thing,
sometimes it's a lot easier to just stick a computer in there, put the instructions on how to run that thing on the computer, and then use the computer to control that device. Even if that device has only one purpose, a computer might still be controlling it just because it's a lot simpler to use a computer rather than build some complicated electronic or electromechanical circuit or device or something like that in order to accomplish a certain task. But computers are pretty much everywhere.
So I talked briefly about this idea of giving a computer new functionality by, say, installing a new application or app or program or whatever. Um, that is essentially what makes a computer a computer is that ability to give it new functionality. Programming is the act of creating a set of instructions so that a computer can get a new functionality, so that the computer running those instructions can actually follow a new task. So all of the applications that you might be using, whether it's your web browser, Firefox, Chrome, whatever, or the Canvas app on your phone or anything like that, has been programmed.
Some people have actually written instructions that whatever computer that program is going to be run on, uh, you know, that computer can actually follow those instructions and accomplish whatever task needs to be accomplished. Um, this actually goes all the way down to the operating system, even. So Microsoft Windows or iOS or Android or anything like that, those are actually, you know, sets of instructions that the computer follows in order to actually let us interact with our computer,
um, which, you know, if… if you, uh, took CBIS 101, you would recognize that as an operating system, which is, in and of itself, a piece of software. There's a little bit of overlap of ideas right here. You might find some of this familiar if you were in CBIS 101, especially if you took my CBIS 101. But, regardless, yeah. Programming, uh, programming is the act of creating instructions that a computer can then use in order to accomplish a task.
A program then is a set of instructions that can the computer can follow. So you can do some programming and create a program, and the computer can actually follow those instructions. It will… it can run the program. The computer follows those instructions, and you can complete the task. So, Firefox or Chrome or whatever other web browser is a program. Uh, the Canvas app itself is a program, or even, um, you know, whatever app that you have installed on your phone is a program.
Any application installed on your computer, whether that's, say, File Explorer, which is a Windows program, or some video game that you might have installed, all of that is a program. Uh, we also call it software, um, which is a very, very broad term for all kinds of different programs. But program… you know, we tend to specifically say program when we're referring to smaller things that people have created. Um, more on that in a little bit. But program broadly refers to any set of instructions that a computer can follow, and programs may actually allow user interactions. So, when you pull up a website that has, say, some kind of form that you fill out, maybe you're trying to schedule an appointment, uh, at the doctor's office or something like that,
and they have an online application, uh, the user interaction is you, uh, typing in details in the form or clicking buttons or anything like that. Firefox will look at the words that you're typing in the form, it will look at the buttons you're clicking, and pass that along to the actual, um, uh, you know, web server once you submit that form. It's very complicated, uh, I don't need to super get into it, but we'll actually look at user interaction quite a bit throughout this entire class, uh, because the programs we will be making through Visual Basic are very heavily focused on user interaction, which is super neat.
And, of course, you have the programmer, which is one who programs. A programmer programs a program, uh, in order to make a computer do some kind of task. Now, this is a little bit of an aside, but, if you were in CBIS 101, uh, you might remember the, uh, discussion on computer data and how computers only really understand binary. Um, that's not real understanding because, you know, they're just a machine, but we pass in information to computers by using electrical signals. Either those signals are on or off, and that on or off state gives us binary digits, and we can assemble those binary digits together into
full on binary numbers in order to actually get meaning out of those electrical signals. Um, it's not the most relevant to this class, but, if you do want to learn more, I would be happy to share that, because there's actually some really cool stuff that goes into that. Regardless, computers only understand binary, so, when we were trying to program computers, it used to be that we had to write in binary. Not… not really binary, I don't think a lot of people spent a
lot of time writing in ones and zeros, in binary. Um, maybe there was a little bit of time where that happened, but then, quickly, people, uh, created assembly languages, which essentially is writing in slightly more human readable text that then can get translated directly to binary. So you write a program in some assembly language, you translate it to binary, and then you feed it into the computer, and the computer is able to directly understand all of that.
Now, let's look at the pros and cons of writing programs in binary. Um, the nice thing about writing in binary is, when you actually are typing out the ones and zeros and all that kind of stuff, you know exactly what the computer is doing because you are manually typing out every single action. You know, every single instruction one by one is exactly what the computer is doing. So you can go and optimize the program all you want. You can do a lot of work to make sure that the program is,
uh, running fast and the computer is doing exactly what you want it to, and that can be a benefit. And, actually, people still write in, uh, binary via assembly language to this day if they have, uh, certain problems that need a very specific optimization or something like that. Uh, so it still used these days. However there's a lot of problems with writing in binary. It's, uh, kind of a pain in the butt to actually do it because, in order to actually do anything useful in binary, you have to write a lot of stuff.
Um, for example, if you're trying to write a program that actually has something on the screen, it puts a window on the screen that has stuff that the user can actually work with, they can click the buttons and they can actually, like, see images that you put up there and all that kind of stuff, that would be a pain to write in binary because you would have to write these, um, pieces of code that allow you to display an image, and you'd have to write these pieces of
code that allow you to, um, understand when the mouse is clicked, and then, from there, see, “Okay, well, was it clicked in a meaningful place?” and all that kind of stuff. It's really hard to do, and you're spending all this time because you have to write so much code when you're writing in binary or when you're using an assembly language. So, eventually, um, you know, you might end up with hand strain or eye strain or whatever. It's really hard to catch any sort of mistakes when you're writing like this because there's so much going on, and it can kind of be a little bit obfuscated, all kinds of stuff. So most people don't actually program in binary or use an assembly language anymore. And that takes us to programming languages, which actually help translate between human language and binary. Programming languages are designed to be somewhat human readable.
It's not as easy as just writing out a sentence that says, “Hey, this is what I want the computer to do.” It's not as easy as saying, “When this button is clicked, show the user the funny picture of, uh, the gnome that I have saved on my computer,” or something like that. It's not quite that easy, but it uses words that are familiar and a lot easier to remember. When it comes to working with binary or working in assembly language,
you actually often have to keep these massive, uh, reference documents, which could be, like, hundreds of pages that show you in detail exactly how to use each instruction in order to tell the computer what to do in the most optimized possible way or something like that. But, with programming languages, it's a lot easier to remember, “Okay, this is what I need to do in order to make this button clickable,” or something like that, so that is super nice.
Often it's consolidating many binary instructions into one easy command for you to remember. So you don't have to type out hundreds and hundreds and hundreds of instructions; you can just type out something really easy, and then the programming language actually helps do the translation between programming language and actual binary. So it will take what you've written and then substitute it with the appropriate binary commands based on how it's able to parse what you actually said.
So programming languages make things a lot easier for us. It makes programming a much much easier job. Some people find it a little bit less fun. I do actually really enjoy programming in assembly. However, it actually allows us to do some really, really advanced things, which is really nice. It actually has probably boosted our ability to actually, you know, create complicated programs that have a lot of really complicated functionality that have been extremely useful for us, like web browsing. You know, anything regarding the internet is absolutely a nightmare to work with, but it would be, I would imagine, even harder to work with if we had to work in assembly still. So programming langauges are great.
The way programming languages work is programmers write instructions in a human-readable programming language, um, and you might have heard of some programming languages by name. You might have heard of C or C++, Java, Javascript, Node.js, um, Python… If any of those names sound familiar, that would be… all of those would be a programming language. Um… but yeah. You write instructions in a human-readable language, and then the program is translated into binary instructions.
Um, this is a little bit out of scope for the class, but it might be a compiler program that translates the text that you wrote into an executable program that you can actually run. That's actually the case with Visual Basic, we'll talk about that in a little bit. Or it might have an interpreter program that, live, reads your code and actually performs everything, uh, without actually doing all that compiling work ahead of time. Regardless, um, the program is translated into binary instructions one way or another, and the computer runs those binary instructions in order to accomplish the task. Now I talked about how the use of programming languages actually lets us do some really complicated things, and one of those more complicated things is the idea of programming language paradigms. They're sort of styles of programming they're ways that we can think about how programming
languages work in order to actually accomplish certain tasks a lot easier. One of those paradigms is known as object-oriented programming, where we think about everything as an object. So our program… we have an application object that has all these kind of button objects, and everything is actually able to interact with each other. So, um, the application object can get, you know, can actually place the button object at a certain
position, and then, when the user clicks that button object, that button could tell the, um, actual application object, like, “Hey, you need to do this task now,” or something like that. It's this idea that everything is an object that is able to do things. Rather than listing out a set of instructions for the computer to do, you know, “Step one: do this; step two: do this; step three: do this,” it's more, “Here's all these objects. Tell the objects to interact with each other in this way.” Now, with objects, objects are anything that can be seen or quote-unquote “touched” or used within the program. You don't have any… you know, for the most part, you don't really have that many actions being taken outside of an object. Usually, it's an object doing certain things. All objects have properties. Objects are able to do things, they're able to perform certain
functions based on the instructions that you give them, and they can interact with other objects. Now, we also have an idea of a class. So, a class is a pattern used to create objects. The class is actually what you write when you're programming in an object-oriented programming language. Um, you you define a class, and then you create, uh, instances of that class, which are objects. Objects are of a specific class. I'll try to get into some examples in just a moment. But yeah, a class is a pattern used to create objects. You define the properties that the objects… every single object of this class has. You define what every single object of this class can do, and you define how objects of this class
can be interacted with, whether they're able… you know, anybody outside of that object can tell that object to do, uh, procedure A or procedure B or something like that, or if maybe procedure A is locked off and nobody can tell that object to do procedure A, only the object itself can decide to do procedure A. Um, all of that is defined within the class, and an object created from a class is known as an instance of that class. It is one single instance of that class out of possibly many. And we say that we instantiate an object when we've actually created that object from a class. We, uh, tell the… in this case, Visual Basic. We'll tell Visual Basic, “Hey, um, can you create an object from this type of class? Can you use this class's pattern in order to create an object for me?”
That would be instantiating the object from the class. So here's an example of some class, uh, definitions. All of these are classes that I have created. And, within those classes, I have defined certain properties or things that they are able to do. So, the properties here are under “Has.” For example, every teacher created from this teacher class will have a name, and they will have, maybe, like, a list of all the classes that they are teaching.
Every student also has a name and all the classes that they are taking. All that would probably be a list of classes as well. And we also have assignments, and I… I say class which is a little… a little bit unfortunate, since we're talking about classes in terms of object-oriented programming. This is class, as in, like, the CBIS 112 class that you're currently in or something like that. But we see that there are some objects that only have properties, and there are some objects that have properties and also, um, things that they are able to do. And, I believe in Visual Basic, the way they set things up, every object has at least one property, which is the Name property, but more on that in a future video.
So, when I got hired by Allan Hancock, Allan Hancock instantiated me from the teacher class, so now I have a name within the Allan Hancock system. That would probably be my employee ID, since that is unique, and the name Iris Kohler may not be as unique. And then, when they assign me classes, they stick those classes within the list of classes that I am teaching for a particular semester, and that list of classes might get updated when I am, uh, actually teaching the class.
I can teach students. So that might involve, you know, figuring out what course I'm designing this particular lecture, for what material I need to actually teach, creating the notes that I need to use to teach with, and then actually delivering the lecture for my students, whether that's online or offline. Grading assignment. I might take in the class and the assignment, I say, “Okay”… Oh, and also all of the students submitted work. And, based on all of that information, I will be able to give students point values for those particular assignments. Um, and, of course, that involves taking a instance of assignment that happens to reflect a particular assignment for that class, let's say the chapter one programming assignment.
It also involves taking an instance of the class, in this case, CBIS 112. CBIS 112 might have the name of whatever the CRN happens to be for the particular section you're watching this in. Uh, class number might actually be CBIS 112. Um, and the students list of all the students there. Teacher; I would actually be sort of held in this teacher property. So you'll actually see that I hold CBIS 112 as one of my classes, but also CBIS 112 holds me as a teacher, this, uh, circular reference going on. And also, it has a list of assignments, which would be instantiated here. So, chapter one programming assignment, chapter two programming assignment, chapter one quiz, chapter 2 quiz, all that kind of stuff.
So all of that is the basic idea of object-oriented programming is that everything is objects, and all of those objects are interacting with each other. When I'm grading an assignment, I'm looking at the particular class that I'm teaching, looking at the assignments for that class, and then finding the correct assignment that I need to grade, so I'm interacting with that, um, assign- with that class’s properties, and those properties hold assignments that I'm also interacting with, and all of you are also interacting with those assignments. You have probably access to this class object, the CBIS 112 object right here, and you are going through the different assignments and completing assignments by, you know, interacting with that assignment object.
That's a very, um, abstract example, I would say, of object-oriented programming, but that's the mindset that we're working with is there are objects, those objects are interacting with each other based on certain things happening. Alright, so a few more programming terms, uh, the integrated development environment is a a program that allows you to create a program, run the program, test the program, and actually, like, you know, build your final, uh, application that you'll be giving out to your users or something like that. It used to be back in the day that, um, programmers would use a text editor
that didn't have a lot of very fancy features. They would use the text editor to actually write the program, and then they would run the program using the programming languages, either compiler executable or the interpreter executable, but they would manually run that, uh, program to run their own program that they use and then actually run the application manually for there. And you might have external test- testing programs because that's not integrated into your basic text editor. You might have external test programs that you need to run through and see, you know, where are all these issues coming from. So the IDE kind of brings all of that into one enclosed piece of software, and it makes it a lot easier to develop stuff and actually make sure that your code is working properly.
Uh, the GUI, the graphical user interface, allows users to see and interact with the program using the monitor, the mouse, and the keyboard, or whatever other input devices you might have. So you are used to working with a GUI because you are using a phone or laptop or something like that. You're using your mouse to actually click on applications and interact with applications in that way, or, when it comes to your phone, the GUI gives you things that you can tap in order to run programs or interact with those programs. And we will actually be building GUIs within our, um, within the programs that we are running. Visual Basic actually makes it super easy to make a GUI. But a GUI is a component of a program that you're running, so you write a program and you actually give instructions to create the graphical user interface so that the
user can interact with your stuff, but it is all part of the program that you're running. Now, we typically call an application a program with a graphical user interface. So an application, uh, is going to be one where you can interact with it using the mouse and the keyboard. You can look and see all these icons and images and stuff, and things are clickable, and you can interact with it that way. That would be as opposed to something that is entirely text based running on one of those old fashioned, uh, terminals or shells or whatever
Now, a programmer's job, because, you know, we talked about a programmer actually being someone who writes programs, but you can have a job as a programmer, and that is typically to create computer solutions for company, uh, problems. Um, you might get hired on a full-time or as a contract worker or something like that to build a solution so that the company can use that as part of their big, uh, workflow or something like that.
Or, if you've taken CBIS 101, information system might be the keyword that… uh, the… the keyword here. Um, a programmer will create a tool that a company can use as part of their information system or as part of their workflow. Uh, you might also be hired on by a company where they employ a lot of different programmers, and all those programmers are working on a piece of software together that then gets shipped, and, uh, other companies can use that software as part of their own solutions. But, um, regardless, like, in the end, you are developing computer solutions.
You are problem solving, and, not only are you solving just one particular problem, you're trying to, uh, capture every possible instance of a specific problem. And that might become more clear as we go on throughout the course, but it's a very abstract kind of way of solving problems, where you're not just saying, “Okay, given this one particular, um, this… this one particular problem with these specific values… numerical values, or this specific person or something like that, how do I do that?” You would want to solve a problem for all possible numerical values or all possible people with whatever details they have. So that is what the programmer does. The programming workflow is: you first off meet with the people who will use the program. Um, you know, if you're hired by a company to solve a problem or something like that,
you want to make sure that the people who are using the tool that you're creating, uh, actually have a say in what you do in order to solve the problem. You need to understand the problem completely and understand what the missing pieces are and how to actually fill those pieces using the software that you're making. And then you plan a solution to the problem before writing code. This is actually very important, is that you think about how everything should work before you actually go in and start writing stuff. It's very easy to lose your way if you just start cowboy coding, is the the term that people use if you just go out into the wild west and you, um, try to rough it and figure it out from there. No you want to actually plan out what you're doing, plan out, “Okay, what should this program do, what, you know, it needs to do this task and then this task and then this task and this task.”
And then, from there, you figure, “Okay, for each task that identified, how do I solve that task?” All that kind of stuff. Um, this again… like, this might become a little more apparent as we go on into the class, but I really want to get it… um, emphasize ahead of time that it's so important to plan a solution to the problem before you start writing code. Once you actually know how the program should work, then you can actually code the program and then test it make sure that everything works and make sure users like it. Um, in CBIS 101, we talked about sort of alpha testing and beta testing. Alpha testing would be make sure it works internally, so make sure nothing crashes or anything like that, make sure you've actually written the program correctly. And the beta testing, make sure that the users like it, make sure that
it is actually solving the problems that they need solved, all that kind of stuff. And then, sometimes, you repeat. It depends on the, um, workflow that you're using. Again, with CBIS 101, you might recognize the terms Software Development Life Cycle, uh, where you kind of try to do this all at once with minimal repeating, as opposed to Agile, where you do a short burst, you test it, you see what the users think about it, and then you repeat, you do a short burst, you test it, you see what the users think about it, etc etc. Um, that all comes down to what works best for you and what works best for the people that you're working with. You might not be able to get potential users to test things all the time. But, regardless, that's the idea of what the programmer actually does in the workplace, is you create solutions, you test them, and make sure that the user actually likes what you've done, and then you deliver that final product.
So that's the idea of what programming really is, with computers being devices that are actually, you know, able to do tasks based on instructions that are passed to them without having to actually build in that capability into the design of the computer. You can actually just write a program and the computer is able to access it. Programming actually lets you use a computer at an entirely new level. So, before, you know, you're limited to what you can do through other people's applications or programs or whatever operating system you're running or all that kind of stuff. But programming is the first step into actually making your computer into a useful tool that can solve problems. So it's a really, really cool idea, to me, at least, um.
So I hope that, you know, this gives you a picture of what this class is going to look like as we sort of go through and do all the… um, you know, learn more about Visual Basic and all that kind of stuff. That's what we're working towards is being able to make our own solutions and being able to use our computer as a tool to solve our problems. So, yeah, I hope this was helpful for defining what this class is all about.
Um, see you in the next video.

Ask anything
We've read this whole study set, so questions about it get the best answers.