Principles of Computer Science

Problem solving with the STAIR technique

Goals

Prerequisite Skills

Discussion

Problem:

Computers and related technology have become an undeniable part of our daily existence. It is barely possible to live without interacting in some way with computing technology. The purpose of this course is to give you some tools you can use to begin mastering technology. We will not be able to make the impact of technology go away, but if we approach it carefully, we can decide whether our lives are controlled or enhanced by the computers that surround us. As the influx of technology grows at unprecedented rates, we quickly find that our accustomed ways of thinking may need refinement. The universal nature of computers makes them much more flexible than the kinds of machines we may be used to learning. Because of this flexibility, we cannot train ourselves to use a computer in the same way we teach ourselves to use a more mechanical machine, such as a car or a sewing machine. We have a well defined pattern for learning to use these typical machines. You figure what the machine is supposed to do, how to make it do that job, and what to do if it isn't working. This process works because it is possible to generalize skills you have learned on previous machines to new machines that do the same job. Once you learn one car or sewing machine, the skill of driving or sewing is relatively easy to transfer to new cars or sewing machines. You can expect any car to do the same basic task, although the cockpit layout may be different, the transmission may require more skill, and so on. The same can be said of the sewing machine. You might need to learn a new way to install thread into the machine, but the process of sewing does not substantially change from machine to machine. In these largely mechanical single- purpose machines, you only have to learn one skill, although that skill may be very complex in nature. You don't expect cars to start flying, and you don't expect a sewing machine to suddenly start acting like a microwave. As we will see, computers are very different from these machines in at least one critical way. While a car or a sewing machine is designed primarily to do a single type of job, the computer is capable of doing many very different kinds of jobs. The same computer could be used as a writing tool, to simulate the visual effects of riding a roller coaster, to play parlor games, to do complex mathematical calculations, and to retrieve stock market quotes from Tokyo. These things could conceivably happen at the same time in the same computer. The skills you would need to control a computer when it is helping you edit documents might be very different than the skills you use to run the roller coaster simulator. (Although the actual tasks deep inside the computer are very similar.) It seems if we approach learning a computer using the same learning model that we use to understand cars and sewing machines, the learning process for using a computer would be a very daunting task. It seems impossible to learn how to use a computer, because each time we have it do some new kind of job, we have to learn how to control it in that particular context. Essentially, a computer becomes a new kind of machine every time a new application is used with it. Some of the applications you will want to use a computer for in the next few years have not yet been invented!

How then, can we hope to teach a class in how to use a computer? Many educators have stuck with the car/sewing machine model, treating each software application package as a new and distinct machine. Using this model, you might learn how to use a specific word processing package, say WordPerfect 6.0 for Windows. You can learn how to use this system essentially the same way you learned how to drive or use a sewing machine. We can feed you a list of commands, take you step by step through a number of typical processes, and guide you carefully through your first few projects. This is a comfortable model of learning, and it works very well for teaching specific programs. If you need to learn exactly how to use WordPerfect 6.0 for Windows, and that's all you'll ever use your computer for, such an approach would be ideal.

Unfortunately, the learning model outlined above has some serious weaknesses when applied to learning computers and technology. The first problem is the universality of computers. If we teach you word processing, you have learned something useful, but you really haven't learned much about computers. They can do so much more than process words. As an educated person, you will be expected to know many other ways to use computers. We would not be doing our job if we taught only one type of application.

Another problem is the pace with which technology changes. It is no exaggeration to say that any software we install in the lab today will probably be out of date by the end of the semester. New releases of major programs come so frequently that memorizing commands and the layout of the program is a futile process. Things will change. You can't count on the menu structure of a program, the control key combinations, or anything else to stay the same.

Anther weakness in the above model is the variety of programs that are available in any one category. If we decide to teach you WordPerfect in our classes, and you end up in an office which uses only Word for Windows, you could be lost. The commands you have dutifully memorized when the computer is running one application could do nothing at all in a different application. It is conceivable that a command you use to save documents in one program could be used to delete documents in another. The potential for confusion is obvious.

The prospects for ever learning how to use and control a computer sound quite gloomy, but it is not nearly as bad as it sounds. If you reflect on your classmates, family, and friends, you can undoubtedly think of a person who can sit down at any computer, run a program she has never seen before, and produce amazing results. How do these people do it? Why is it that some people can run a never - before - seen program and make it do things for them? What is their secret?

After studying the way such people work, we have noticed some important themes:

Our goal is to help you become the skilled computer user we have described above. We will teach you a framework for problem solving with computers, (or any other type of problems!) and help you apply that framework to various types of application programs. We will introduce you to what computers can do, the types of problems you may be able to solve with specific software applications, and many opportunities to practice with real applications on real computers.

We will not focus on individual software packages, although we will certainly use them for examples and exercises. We are less interested in actual commands and methods for doing things, because there are so many possible paths to a correct answer. We are more interested in the process you can use to learn how to do these things in whatever applications you use in the future. Our goal is to teach you the skills you will need to learn computing applications that have not even been imagined yet!

Our most powerful tool - The STAIR steps for solving problems

Problem - solving can be seen as more of an art than a science. Each person has different ways of approaching problems. Our intention is not to limit your problem solving processes to our way of thinking, but to give you a framework you can fall back on when you are stuck. We have developed a method called STAIR which has proven to be a helpful problem - solving tool.

STAIR is an acronym. (Get used to it... computer scientists LOVE acronyms!!) Each letter in the word STAIR represents part of a general problem solving strategy.

S - State the problem
This step seems obvious enough, but it is often the one people skip. We frequently start solving problems before we really think carefully about what problem we are trying to solve. The result is confusion and wasted time. Take the time to carefully describe to yourself what you are trying to accomplish. Avoid the temptation to couch this problem description in technical terms. At this stage of the process, all your thoughts should be in ENGLISH (or, of course whatever other human language you think most comfortably in) Some problems are best described with sketches or other tools (like flowcharts and data diagrams) that we will discuss later. Use whatever you need to make sure you have a firm understanding of what you want to accomplish. It's best to write this down on paper so you can check it later if you start to get confused. If you don't know where you are trying to go, how will you know when you are there?

T - Tools for the job
Once we know what kind of a job we want to accomplish, we can begin to explore which tools we might use to solve the job. We are using the term 'tool' in a very general sense. A tool might be a command, a button on a toolbar, a selection on a drop - down menu, a strategy, a program, or something else, depending on the kind of job we are trying to do and the context within which we are working. Knowing the capabilities of a certain program, and the kinds of things different types of computer applications can do are the main ways you add new tools to your toolbox of computing skills. As you gain experience, you will constantly be adding new tools of all kinds to your repertoire. Even the STAIR strategy itself can be considered a tool. Most of the time, there is more than one tool available to do a job. At this point, just list the tools available. Later on, we will decide which one to use. You might need to come back to this list if it turns out you chose an inappropriate tool the first time through the process.

A - Algorithm development
An algorithm is a computer science term for a strategy or plan of action. Part of developing an algorithm is choosing an appropriate tool or set of tools from the previous step. The other component is determining how those tools will be used to solve the problem. As with the other steps, the algorithm can vary widely in the type and complexity of the strategy you will use. In simple problems, your algorithm may be as simple as saying "I'm going to try pressing this particular button on the menu bar." A more complex problem will probably require a more complex algorithm. As before, it is a good practice to write down your algorithm on paper.

I - Implementation of the algorithm
It is interesting to note that none of the steps above require the use of a computer. The implementation step is the actual process of translating all this human thought we have been doing into something the computer can understand. In simple problems, this step comes down to actually doing a command or two. Implementation can mean "just do it" when we are dealing with these simple problems. Programmers think of the implementation step as translating the algorithm into some type of computer programming language. The process is the same regardless of the complexity of the problem.

R - Refinement
We like to think that if we learn a skill and prepare ourselves properly, we can solve a problem on the first attempt. Experience shows us that this is usually not the case. It is normal for a computer user to attempt a solution several times before the problem is solved. The first attempt at solving a problem is rarely successful. A skilled problem solver will analyze what happened, review the other steps, and try again. Each unsuccessful attempt should bring you closer to an understanding of the problem and its solution. Refinement usually means going back and looking at the previous steps critically. Ask yourself if you really defined the problem properly. If so, have you used all the possible tools at your disposal? Are you sure there is not a tool available that you have overlooked? Did you choose the best algorithm for the job? Did you implement the solution properly? (You would be amazed at the number of computer errors that are the result of simple typing or spelling errors!) Again you will find that practice will make you much more confident at this critical stage of the process.

Implementation of the STAIR process

As you can see, the STAIR process does provide some guidelines for thinking about a problem, but it is not a rigid technique. You will have to find your own variations that work well with the way you visualize and think. Many times you will find yourself not needing the entire process. The STAIR convention is meant as a tool to bring out when your natural problem solving process does not prove sufficient. It can also be used to help you organize this natural problem solving process.

Example One: Storing the boat

The STAIR process can be applied to situations that have nothing to do with computing. As an example, imagine the following situation: A man named Tom came home one day to be confronted by his wife about the small sailboat that was filling space in the garage. She suggested that he find a more efficient way to store the boat than leaving it where she normally parked her car. (Her suggestion was couched in somewhat stronger terms than this!..) Being quite a good problem solver, he decided to apply the STAIR methodology to this problem.

Statement of the Problem
Tom thinks to himself: "I need to get this boat out of the way. It needs to go someplace where it won't be in my wife's way, but I can still get at it easily when I want to go sailing. I don't want to spend a lot of money or effort on this problem, but I want a long term solution so I don't have to deal with this again"

Notice that Tom started with as simple a statement of the problem as possible: "I need to get this boat out of the way." He also listed some of the relevant constraints. He didn't worry about exactly what the solution might be yet. This may not be the finished statement of the problem. Tom may find that he needs to come back and refine his problem statement a little more before he can find a solution.

Tools Available
Tom thinks: "This job might require actual physical hand tools, and I've got a pretty good set of the standard tools. Besides the obvious definition of the word tool, I might think of some of the main approaches to solving the problem as tools. I could hang the boat from the ceiling of the garage, attach it to the walls, put it in the yard, or rent some storage space."

Notice how flexible he was with the term `tool.' This approach allows Tom to think of the IDEAS he will choose from, as well as the physical entities. In fact, the actual mechanical tools that will be used will be decided much later in the problem solving process. It's way too early to worry about whether he will use a hammer or a screwdriver. Eventually, however, Tom will have identified a smaller part of the job (How do I attach this hook to the ceiling?) that will require its own tool selection process. He may have a hook ready to go and wonder how he will attach it to the ceiling. This is where he might look at his physical tools and choose one from the box.

Algorithm
Tom thinks: "I'll try hanging the boat from the ceiling. This seems like the best approach, because the boat will be ugly in the yard, I can't afford rental space, and the walls are already full. I think the boat is light enough to be suspended from the ceiling safely with some ropes "

In this instance, the algorithm step involved choosing the best alternative from the tools step. At this point, he had made a decision about how he was going to tackle the problem. Notice that he also started thinking about which physical tools (in this case a rope) he would use to help solve the problem.

Implementation
Tom says to himself: "When the time came to actually suspend the boat, I quickly realized I had more to think about. I measured the ceiling and found a perfect spot, and I moved the boat to the floor directly under the spot, but I didn't know how exactly to attach the boat to the ceiling. The ceiling has wooden rafters in it. I obviously need to attach some sort of hooks to the rafters. I also noticed that the rope I planned to use was kind of slippery and might not hold a knot very well. "

The implementation step so far has been unsuccessful in the obvious sense; the boat is still sitting on the garage floor. Rather than being discouraged by this, Tom will use the experience as an information gathering stage for the next step:

R Refinement
Tom thinks: "The ceiling idea is still a good one, but I don't have everything I need. I don't trust this rope, and I need some hooks or something. Digging through the toolbox, I found one bicycle hook that will work fine for the bow of the boat. I can attach that to a rafter easily, but I still need to hold up the back end of the boat. I noticed the straps I use to carry the boat on top of my car. They are plenty strong enough, but the ends of the straps are designed to fit in the rain gutter of my car. I need to find something that will allow me to attach the straps securely to the rafters. I went to the hardware store and found screen door handles! They will attach to the rafters and they are the perfect size to attach the straps to! I went back home, attached the handles, hoisted the boat up in the straps, and the problem is solved!"

During the refinement step, Tom made some visits back to many of the other parts of the problem solving process. He had to adjust his perception of the problem. Attaching the boat to the ceiling was a good idea, but Tom's first statement of the problem did not specify how he was going to do this. Finding a way to solve this part of the problem involved combining algorithm development and tool selection. The implementation happened in segments as he found more of the right ideas and tools to solve the problem. The process does not always flow in a set order, but because he used a systematic approach, he always knew how to think about solving the problem. Tom knew, for example, that his algorithm was good, but that he would need to rethink his tool selection. Obviously, plenty of people solve this kind of problem without ever taking a computer science class. Tom may not even know that he was using an organized problem solving technique. The reason that we start with this problem is to illustrate that our problem solving process is really just a somewhat formalized summary of the techniques we already recognize as problem solving techniques in many settings.

Example Two - Drawing a map

Statement of the Problem
Nancy has moved to a new town. Her aunt wants to come visit her. Nancy wants to use her new computer to draw a map from her aunt's home to her new house. She decided to use the computer so she can easily make copies to send to other friends later.

Tools available
Nancy thinks carefully about the tools she needs. She knows her computer has a drawing program already installed, but she has never used the program. She does know how to get to the program and start it up

Algorithm
Nancy starts by sketching out the map with a pencil on paper. Now she knows the image she wants to create. She will use lines to note streets, squares for specific landmarks, and text to label the streets and landmarks. When she has finished with the picture, she will save it to her disk in case she needs it again, and print it out to include in her next letter.

Implementation
Nancy stares at the blank screen. She doesn't know what to do next. She knows by examining her algorithm that she has a number of new smaller problems:
Nancy has a dim recollection of the STAIR process from a computer class in her past. She wonders if she should apply that process to one of the littler problems now. She decides to start with the rectangles
R - Refinement
Nancy repeats the process to learn the other tools she might need. Most of the things she needed relate directly to buttons on the toolbar. She does not see a button that might represent printing. She looks in the on- line help and finds that Print is an option in the File menu. She then looks at the menu and finds the command. She uses it and the picture shows up in her printer. Problem solved!

Analysis of Nancy's experience

Notice that the problem solving process actually had to occur at two distinct levels in this project. First, Nancy had to think about the big picture of how to draw the map. As a part of this big problem, she discovered a number of smaller problems along the way. She applied the same kind of process to the smaller problems and was able to learn many new skills as part of solving the larger problem. The next time she needs to use this graphics program, she will already know how to use these particular tools without having to relearn them. In fact, if she tries ANY graphics program, she will have a head start, because she already knows to expect some kind of line drawing tool, rectangle tool, and other tools that she learned to use in this program.

Laboratory Assignment

Today in lab you will use special computer program designed to introduce you to the most basic computer skills. You will practice using the keyboard, editing text, locating special keys, using the mouse, using drop down menus, and accessing on - line help. After you finish the program, you will get to play some games. The lab instructor will NOT tell you how to play the games. It is up to you to figure out how the games work and how to play them. Use the STAIR technique to figure out how each game works. The lab instructor will demonstrate how to start the program.

Vocabulary / Main Concepts

  1. Computers are universal machines - the same machine can do many different kinds of tasks
  2. A computer is most effectively thought of as a problem solving tool rather than as a traditional machine
  3. Learning to use computers effectively requires problem solving ability
  4. The STAIR method is one way of organizing the problem solving process
  5. Statement of Problem: defining with words, sketches, or other means what you want to accomplish
  6. Tools: Concepts, Commands, Menu items, Toolbar buttons, programs, or ideas that can help you solve a problem
  7. Algorithm: A strategy for solving a problem
  8. Refinement: The process of studying an unsuccessful attempt at problem solving and looking back at earlier steps to approach a solution

Summary

The way we learn about using most machines is not adequate when we are trying to learn how to use a computer. Problem solving ability is a major factor in success with computers. The STAIR technique for problem solving is a good way to summarize the problem solving process. Problem solving is a fluid process. It may be necessary to apply the process to a large problem, to break that problem into many smaller problems, and apply the same process to the smaller problems.

Review Questions

  1. Why is the way we learn to use typical machines insufficient when we are learning to use computers?
  2. What thinking skill best summarizes skilled computer users?
  3. Write out the steps for the STAIR method.
  4. Write a one sentence summary of each step of the STAIR method.
  5. Thnk of the way you already solve non - computing problems:
    1. Do you have some type of systematic technique for solving problems?
    2. What do you do when you are stuck?
    3. Can you see some relationship between your current technique and the STAIR method?
  6. Imagine that your friend calls you and tells you a skunk has gotten into his basement. Use the STAIR method to summarize how you will 'de-skunk' the basement.
  7. Think of a problem you solved recently. Describe how you solved the problem in terms of the STAIR method. Write down how your thinking fit with the STAIR steps.
  8. As you learn one of the games in today's lab, try to apply the STAIR technique to learning how to play the game. Write down the steps of the STAIR method, and how you used each part of the process to learn the game.

Module Effectiveness Assessment / questions for the committee


(c)1996, Andy Harris,
IU System-wide Course A/B Development Committee
Indiana University.