Course Introduction

Read time: 48 minutes (12148 words)

See also

Text: Chapter 1, Sections 1.1, 1.2

Welcome to COSC1336 - Programming Fundamentals I! You are taking a course that will introduce you to the idea that computers can be used to solve problems for us, if only we can figure out how to tell them how to do that.

This course is designed for those students who intend to go deeper into computer programming. We do not assume that you have done any computer programming, although it is not unusual to have students with some experience. Do not worry, we will explain everything as we go.

Human Problems

Humans do silly things sometimes. Recently, I was in Italy and ran into this problem:

../_images/pisa-tower.png

Can we solve this problem with a computer?

Actually computers are helping a lot. They have been analyzing everything about this particular problem for years, using a lot of computer power in the process. They do not want to straighten this up (I tried, it will not budge). Instead, they do not want it to fall over!

What is a computer

Good question! Here is one:

../_images/Cray1.png

This is the first computer I got to work on when I went into the Air Force to start my career - it is a Cray 1 Supercomputer that cost about $8,000,000 back in 1973.

Here is another one:

../_images/Microcontroller.png

This one is something you could put in a thermostat you mount on the wall. It is called a microcontroller, but it is just another computer, only this one costs less than a buck! I teach my students how to program chips like this in my assembly language course, COSC 2325.

Actually a computer is just a simple electronic device capable of manipulating a bunch of switch-like components at incredible speeds, using a set of fairly primitive commands that determine how those switches get changed.

Huh! That does not sound like a good definition of a computer - but it is!

We will look at the internals of a computer in one of our first lectures, but they really are fairly simple machines. We are going to learn how to program these beasts in this course.

What is a program

Here is a program listing that I might have produced when I was working on my first Master’s degree in Aerospace Engineering back in 1970:

../_images/ProgramListing.png

Fortunately, no one produces this kind of program listing anymore!

Simply stated, a program is just a simple (but very precise) list of instructions we want a computer to follow exactly. (Sometimes a very long list as the picture shows!) Contrary to what many people think, computers are just plain dumb - but, boy are they fast! We need to find a way to tell the computer exactly how we want it to solve our problems, then let it go off and do that so we do not need to do all that work.

The computer does not really know how to solve our problems, we need to figure that out. So, we have two important things to deal with here. First, we have to figure out how to solve our problems. Actually we need to learn how to figure out how to solve problems - which is something else entirely! Then we will apply those methods to real problems and figure out how to solve them. Second, we need to figure out how to explain to the computer what we want it to do to solve our problem.

Why do I want to learn that?

Well, actually, many people think that learning about computer programming is just a waste of their time! They would rather just buy a commercial computer program that does the work they need done and be done with it. That is fine for a lot of the problems we want computers to work on for us. But there comes a time when no readily available computer program will do what you want done - so you are stuck! You (or someone you can convince to do this for you - usually after a transfer of cash) need to create a new computer program that will do your new job. You are the person needing the work done, you are the domain expert (we hope), and we hope you can figure out how to solve your problem clearly enough to either create the program yourself, or explain the process to the person who will. Learning how to do all of this is what this course is all about. The skills you will learn will help you in your future career - even if you never program a computer again. You will be a better thinker, and have a better idea of the place computers have in your life and career.

Learning how to solve problems

We will learn how to be very precise in how we explain things - especially those things we will eventually ask a computer to do for us. This takes patience and practice. Humans are notorious for leaving things out, and equally notorious for filling in blanks (many times wrongly) when we deal with missing information. We cannot let these things happen when we work on problems we want the computer to solve.

Learning how to program

Once we have a clear idea as to how we want to proceed to solve our problem, we need to express the solution technique to the computer using a programming language of some sort. Unfortunately, that language you will need to use to create the program will not be English! We will need to learn to use one of many available languages designed to explain things to computers. This can be fun, but it is new, and learning new languages can be difficult for some of you. Others will pick things up quickly. Do not worry about this, we will go slowly and you should find yourself controlling a computer’s actions in no time!

My own path to programming

I never started off to be a programmer, I wanted to be an aeronautical engineer. Heck, back when I first started college, computers were hidden away in large buildings and only the chosen few were allowed to go near them. Today, you cannot get farther than a few feet from a computer wherever you go!

I had to work my way through college, since my parents could not afford to send me to school. I entered a ‘’Cooperative Engineering Program’’ where a student could work in the industry they wanted to work in when they graduated- learning about that area and earning money to pay for college. We would go to school one term, then work the next term all through college. It ended up taking five years to complete a four year program, but I was able to earn enough to pay my own way through school.

I got a job with McDonnell Aircraft in St. Louis while they were building the Gemini space capsules for NASA, and Phantom-II jets for the military. I got to work at a number of exciting jobs over the years I worked there. It was an amazing place to spend time, and it kept my interest level up so I did pretty well in college.

../_images/Factory1.jpg

During one term, I was working in the Flight Test Division where they tested the Phantom jets before delivering them to the Air Force and Navy. My job that term was to analyze data collected during a test flight. The data was recorded on a paper tape by an instrument driven pen (remember, computers were new back then), and on magnetic tape. I was given a choice - spend the term measuring squiggles on the paper tape with a ruler, record the data, then calculate a bunch of numbers with a mechanical calculator, or learn how to program a computer to just process the magnetic tape. Since the first process sounded way too boring, I decided to try the second one - and my career working with computers was off and running.

I had a ball that term, actually getting to place my hands on a real computer for the first time, and working on problems that seemed very important at the time. I was way ahead of my class mates in learning all this stuff, and I found it a lot of fun. I want your first exposure to programming to be just as much fun.

What do you need to know to start?

Not much! This course does not assume you know much about computers, but you want to learn more. We do expect that you know the basics of working with the machine - you know, starting it up, running programs, entering information using the keyboard and mouse, printing things out, and all that. We will need to install a few new programs along the way, but I will explain how to do that in enough detail to get you through.

What are we going to do?

We have a lot of material to cover in exploring this area. This is a fundamentals course, so we are going to look inside the computer a bit and get a better idea how it works. We will look at how humans have figured out how to represent their world in a way the computer can work with, and explore those languages we spoke of earlier. We will practice our problem solving skills and hopefully work on some problems that are fun - not just boring add-up-a-bunch-of-numbers stuff!

Since we live in the interactive video game era, I know a lot of you expect to see glossy game-like stuff happen in your programs. Unfortunately, that level of programming is very hard, and far beyond a beginning course like this. However, I have decided to base a lot of your work this term on projects that involve graphical displays and animation - the heart of game programming. That way you will get a feel for some aspects of game programming, but we will really be focusing on the core concepts of programming in general. I am trying to keep you interested in the material by keeping the projects more fun than they might be if all we could do is print a bunch of stuff out on the screen!

Programming Tools

We will be writing programs in this course. The official language we will be studying is Python, a modern and pretty fun language. (This one is my current favorite programming language!) We will explore how a computer really works with this language and build a few simple programs. At the end of the course, I will give you a quick introduction to the next programming language you will learn, C++.

Why learn more than one language?

I did a survey of all the languages I have used in the last 50 or so years, and the list had over 45 languages - yikes! Languages are developed by teams of folks working on common problems. They may be tuned to the needs of those folks, or they many be written as “general purpose” languages, useful in many areas. You learn more languages like you buy more tools to work on cars, motorcycles, bicycles, washing machines, etc.

Note

Wait - if you listen closely, you might hear some folks yelling that Python is the wrong language to learn, language XYZ is much better. These arguments can get pretty intense in the world of programming. There is no one “best” language. As we shall see, each has its strengths and weaknesses.

Python is probably already installed on your machine, unless it is running Windows! (Will Bill ever learn?) Never fear, we can easily install Python on any platform, and we will go over doing that in our first lab.

Warning

We will be using the latest version of Python (version 3.7). It is possible that you already have a different version installed, in which case, we will need to add a second copy of Python for the course. This will not harm your current installation.

Course Resources

You will have access to three sources of information for this course (at least!). The official text we have chosen gives a good overview of programming using Python. That book is the primary source for most of the material we need to cover.

However, I like to tell my own stories and give examples that might be a bit more fun, so I will be presenting a set of lecture notes that also cover the same material (but not necessarily in the same order as the text). I have found that seeing a concept explained in a number of different ways can help you understand that concept more fully.

The last set of resources is a tutorial aimed at beginners to Python. I will not go over this material, but you might find it useful:

Have fun

All during my career I have checked with the folks I worked with, or who worked for me, to make sure they were having fun in what they did. If you do not truly enjoy the work you do, you will not find satisfaction in that one thing that you will spend a great deal of your waking hours working on. It better be fun! My job is to try to make this course fun, and teach you something very useful in the process. I would appreciate your help in tuning the course materials so we succeed in learning and having fun at the same time!

Note

I cannot help you if you do not talk to me. In this course, email will be our primary means of communication outside of class. Please let me know if you are getting stuck on anything - either because you are having problems understanding the material, or because you are having problems outside the class. My goal is to get you through this course, and be better prepared for those courses you will take next!