What is Computer Science [Slide 1] Good morning. This is my first lecture for this course. I thought it would be a good idea if we're going to have a whole semester talking about computer science, computational thinking, all the things that we could do with it, and then try and teach others about it. It would be a good idea to try and figure out if we could agree on a definition of what computer science is, and then all of the things that might follow from that, such as what is computational thinking and what are the different branches of computer science. [Slide 2] I tried to do that. I actually spent a lot of time trying to search for at least two places that would agree on the definition of computer science, and I totally failed in doing that. I did Google searches. I went and looked at college recruitment brochures on the web, where they would say, "Oh, if you're a computer scientist, this is what you'll be studying." I found quickly that no two definitions seemed to agree, so that it really puzzled me. In the end, this lecture probably became a little bit longer, maybe more interesting than I thought it would at first. What I wound up doing after I did those adventures, which I'll describe a little more in a minute, I said, "Well, let's go backwards and let's see if we can take apart computer science and say, if we know what science is and what a computer is, is that gives us a definition of computer science. Well, it turns out that doesn't work particularly well either. At the end, I resorted to say, "Well, let's build up computer science by looking at its components and parts, which is a separate interesting adventure." We'll go through a little of that, then get up to talking just a little bit about computational thinking, mostly to see how it fits in with computer science, how it's not computer science but it's very related to computer science. It comes out of a lot of the core of computer science. I want to finish up with a couple of examples that will show you how, as a computer scientist or someone who's doing computational thinking, how we can take a couple of very, very simple problems and see how we look at them a little bit differently. [Slide 3] My results of all my searching and inability to find a good definition, it brought me back to a very well-known phrase, "It's hard to define but I know it when I see it." That goes back to the Supreme Court in 1964, and it was in a discussion about hard-core pornography, not that there's a relationship, but it does have this difficulty of that most of us know something that's computer science when we see it, but if I ask you, give me a definition of computer science, that's a lot more difficult. [Slide 4] In fact, one of the things I discovered in trying to do this lecture was it's easier to say what computer science is not, rather than to say what it is. For example, it's not physical science because we're dealing with computers. We're What-is-Computer-Science Page 1 of 8 dealing with virtual things, so it's not a physical science like chemistry or physics or geology, but we still want to claim that it's a science. It's certainly not a social science, even though like political science or sociology or economics, although computer science crosses a little bit into those areas at times, as it does cross into areas of physical science. It's not engineering, and those of us who have been in computer science for quite a while will remember back the old days when universities were trying to define what's engineering, what's computer science. In a lot of ways, that was a waste of a lot of time and energy because we didn't come to clear definitions, because a lot of computer science is in fact engineering, and we do a lot of things that our engineering colleagues do, for example design, putting together systems and that, but on the other hand, we do a lot more than that. Certainly, it's not programming. Probably, that's one of the larger misconceptions that's out there, if you say to most people what does a computer scientists do, people will probably say, "Oh, he programs." Well, that's not really what most computer scientists do. A long time ago, when I was Chair of the CS Department, I actually did a survey of some of our graduates a couple of years out and we asked them what they were doing, and one of the things that came out of it is no two of them were doing the same thing and very few of them were employed as programmers. On the other hand, every computer scientist can do programming, and it's certainly a part of everything we do in computer science. Where does that leave us? Well, it's all four parts are part of computer science certainly, but they don't totally define computer science. Let's go back and say, "Okay, what is a science, then following that, what is a computer?" [Slide 5] Let's see if we can agree on that. Well, I went and looked up some definitions of science, and this one from The New Oxford American Dictionary is probably pretty consistent with the others, a lot more agreement about what science is than what computer science is. I've underlined some of the key points in here. It's an intellectual activity and it's also a practical activity. In science, we theorize about certain things, but we also do a lot of practical things. It's certainly systematic. One of the key points of science is that even though we do observation and experiment, we do it in a systematic way. We have the scientific method, where we test the hypothesis by doing some sort of an experiment and observing the results of that experiment to see if they fit the hypothesis. We study structure. We study behavior and science generally is concerned with the physical and the actual world. This is a pretty standard definition of science. [Slide 5] Well, let's look at the computer part of this. This one was pretty good. What-is-Computer-Science Page 2 of 8 There's a lot of them out there, but I thought, "Well okay, this one's close enough." I underlined the words I care about. First of all, on electronic device, well most computer scientists, at least the academic ones would say the electronic is not particularly relevant. We just happen to be working with electronic devices most of the time, but what we do is somewhat independent of what the underlying technology is. If you start to look at the rest of it, it's a device that's storing and processing data, that's not dead. Typically, the numbers are in binary form, but what we do doesn't really require that they be in binary form. We store and process data or sometimes, we say we can think of a computer as a symbol manipulator, where data are symbols, and the crucial part of it being a computer is that we can give it instructions to a program and it's variable in that we're not doing the same thing every time. It's not a hard-wired piece of equipment that just repetitively does one task. It takes a program that we could put in, that we construct, and then that changes how the computer processes the data. It's not too bad a definition. Probably, I should have put in there digital, because we're really talking now about digital computers and not analog computers, where we would have a somewhat different definition, but that's a pretty good definition. Now you say, "Well, computer science, and this is the next definition that came out, computer science is the study of the principles and use of computers." I don't find that a particularly helpful definition. It's not wrong, but it doesn't really illuminate very much. I said okay, let's next look at the parts of computer science. I've been a computer scientist a while and I worked a lot on curriculum, so I can say, "Well, what are the different things we do when we teach people to become computer scientists?" [Slide 6] Well, one is theory. This is the part that came out mathematics, and looks at questions like, "What's possible for the computer? Can we compute anything? What are the limitations on what computers can do?" Often, theory touches on some sort of an intersection between computer science, mathematics and really philosophy in terms of what is logically possible to do. We won't see a lot of that in what we're doing in this course, but it's always lying behind what we do. If there's a really crucial thing that ties together an awful lot of what we do, whether it's under the computer science heading or it's part of what we might do under computational thinking. In another field, it's algorithm. It's that we study algorithms and we use algorithms and we design algorithms and an algorithm is simply a step-by-step process, well-defined process for doing some tasks. It can range certainly from a menu that you might use to bake something or a very complex algorithm for figuring out what's the best way to get from New York to California given the traffic conditions. What-is-Computer-Science Page 3 of 8 All of that is algorithmic step by step kinds of thinking. Programming, as we said, is a major part of computer science, how we program, what the program structures are, but also various languages. Languages have different styles. They have different underlying paradigms for how those languages work. We'll talk a little bit about that later, but it's certainly a key component of computer science. Software engineering is perhaps a little bit fuzzier, partly because it really is, even by its name, somewhere between computer science and engineering, but also the soft in software is important there. In a lot of ways, it's the softer side of what we do in computer science. It includes a whole variety of topics. For example, specifying what we really want to do in a problem, working with clients to see what they need. How do we do testing in computer science? A big part of what we do when we're teaching students software engineering is how do they work in groups, how do they assign tasks, how do we do those kinds of more practical kinds of tasks, and a lot of what's in software engineering really is this whole way of how do what we do in computer science relate to the outside worlds, so things like ethics and get off and get into software engineering, although these certainly apply in other ways. I'm listing simulation separately, just because simulation is really the core of how we're going to do computer science and computational thinking. This course, one can say it's an application area of computer science, but I think I just wanted to put that there separately, first emphasize that the point that it is the core of what we're going to do, but also that it's the new way of doing science and it's really expanding computer science to almost all other fields. Then there's this big one of applications and applications includes just all kinds of things. I was on the applications side. I did graphics and visualization, but other areas in there, artificial intelligence would be an application, virtual worlds. Databases would be another one, machine learning, robotics, network security, you go on and on with the applications that we feel are core to computer science. If we stop there in terms of just trying to come up with a definition, I think that this is not a bad way to look at it and saying, "Well, look at its constituent parts, and now we have maybe a better understanding of what computer science is. [Slide 7] Now, if you want to take a break now, what you might do is then take a little break here and stop the tape and go for a few minutes, and think about for computer science, think about where it impacts you. We don't want to ... Computer science, we feel irrelevant to almost everything you do, so think about it, where it is. For example, does theory play any role in any of your activities? Where does theory come in? You want to be a little more specific, look at it in terms of the internet, where does my CS theory come in as you use the internet. Certainly, the algorithms, think of ways both within a computational framework and elsewhere of where you use algorithms. [Slide 8] Okay, now resuming again, What-is-Computer-Science Page 4 of 8 assuming that you took a little break, here's a very nice definition of computational thinking from a paper by Cuny, Snyder and Wing. There's a little reference to that a little bit later, and it's a very interesting one, both because obviously, the importance of computational thinking, but also this definition says nothing about computer scientists or that computer scientists are carrying it out. In fact, this is a definition that broadens what we have learned in computer science to say that we can now use the techniques that come out of computer science in virtually every other field and every other endeavor. We can argue, and I certainly would argue this that if you want to look at what is the biggest contribution that computer science has made to society, it may well be that it's computational thinking, that this way of going about projects, and we'll talk a little bit more about that on the next slide, is really something that's very different from the way that people have traditionally solved problems, and this is really our contribution to other fields. [Slide 9] Okay, the key elements here and I really hope you look at this web reference, which has a lot of other references in and other much more detailed discussion of what are the elements of computational thinking, but let me just mention briefly. I know there's going to be another, a longer lecture on computational thinking so I don't want to overlap that too much, but the three key elements of that are abstraction, that we build models where we abstract something and look at just the behavior that we're interested in and build a model out of that, and then try and simulate that model. We have an automation using a computer to actually run that model into various circumstances, various types of input, and do that automatically, to do it many, many times, and then at the end, we're going to analyze those results and then use that analysis to improve the model, to say it maybe turned out to be a terrible model and we have to throw it away. It's a repetitive process, where we abstract something, we build a model, we test that model, we analyze the results, and then we go back to the model and do the whole thing again. As I said, we're going to see that lots and lots more as we go through this course. [Slide 10] Let me give you what I think is a very nice example of how computer scientists look at something somewhat differently than you might have looked at it before. I think there's a very, very simple problem, what is the square root of 2? Simplest way to look at that is to just say, "Well, it's just a symbol. It's just a number 2 and I drew this squiggly thing on top and we all agree that that's what the square root of 2 when we read it, but it's really just a symbol." It doesn't have anything about, "What is the square root? What is its value? What is anything else, what properties does it have?" It's just a symbol. What-is-Computer-Science Page 5 of 8 Well, we go one step further and say, "Well, we all know that the square root of 2 is something that satisfies a mathematical equation.", so anything, that when I square it, it gives me 2, is the square root of 2, so that will obviously minus square root of 2, plus square root of 2 give me the same thing. That would be sort of what a mathematician might say is the square root of 2. It's something that satisfies as an equation. Well, if you're working with computers, that really doesn't do you a lot of good, because I need a number. I need something that gives me something I can use when the square root of 2 comes up at something that I'm doing. The third way is to say, "Oh, it's the result of executing a computer program." That's getting down to thinking computationally. Let me give you an example, you don't have to know the mathematics here. [Slide 11] This is a little algorithm, known as Newton's method for computing the square root of 2. It's actually a very interesting algorithm. I actually checked to see if this really came from Newton, and it turned out, Newton rediscovered it, but the more interesting part was this method was known to the Babylonians, and the Greeks actually published it first in the first century. Newton rediscovered this algorithm. It's intuitive algorithm. You start off with some guess, and then you get the next guess by putting the guess you have on the right side, and then computing a new guess and iterating on that, so it's an algorithm. You go on until you get as close as you want to the square root of 2. In this example, we start it off guessing it's 1, then we compute the next one, which came out to be 1.5, and then we computed another one, another guess X2, which is getting pretty close. If you do one more equation on your calculator, you'll see it's really close to square root of 2. If I was thinking in the computational sense, this is one way that if I needed the square root of 2 in my computer because I'm doing something with it, I would actually go and be able to get me an approximate, a very good approximation to the square root of 2. Let's do that once more with another familiar item, [Slide 12] pi. If you want to think about this for a while before going on, go right ahead. Let's say, what is pi? You get there's another symbol, right? It's just a nice, pretty Greek letter. Can I find an equation that it satisfies? Well, you might. If you had trigonometry, you might come up with an equation. What we're doing here is to say, "I want to think about this as a computer scientist. I want to think about an algorithm equally." Can you find the algorithm? You need to go on to the next slide, where we'll think about this for a while, and I'll go on and show you a solution. [Slide 13] Now, the solution that I'm going to show you is based on bringing together these ideas about computational thinking and simulation and modeling, and this is really a very new way of doing science because we could build these computer models. We What-is-Computer-Science Page 6 of 8 could build very complex models and test them on the computer with lots and lots of data. Think about people who run experiments in biology or chemistry, where they do a very complex, expensive experiment but they may only be able to do it once or maybe twice. Here in the computer, we can run our simulation thousands and thousands of time with different data. On the other hand, it is consistent with the scientific method, in that we form a hypothesis, and then we test that hypothesis with data and an experiment, and then we see if that agrees with our hypothesis. This process applies to all fields. Now I'm going to show you this just for finding pi, and this is our cute algorithm that's not one you would necessarily do, but it's fun and I have it up on the web [Slide 14] if you want to play with it. It's very simple. It says, okay what if I just had a square dark board and I inscribe the circle in it, and I just randomly throw darts. I'm not very good. I'm just likely to land at any place in that square as in any other place, so just totally random so I can find random numbers in the computer to simulate this. Let's suppose the square had sides of length 1. Well, the inscribed circle has a radius of 1/2 and therefore, it's are is pi/4. If I throw darts at this thing and just count the ones that land in the circle versus the total number that land inside the square, the fraction that lands inside is a quarter of pi. You're going to think about that for awhile. It's pretty simple, so if I just do this experiment over and over and over again, and count up the number that I get and divide it by the total number of tries, the number that fall inside divided by the total number of tries, and then multiply it by 4, in fact that is going to give me an approximation of pi. If you look at here's what's on the web, it's on my website and there's a pointer to it [Slide 15], you'll see the thing on the right if you'd go to that website. What you do is every time you click your mouse inside of there, you'll get another 10 points, and at the bottom, it will tell you what is present estimate of pi is, and you'll notice that's not a very good estimate there. I do more points, I'll get a better estimate, but it's fun. It's interesting in that we're getting a value by simulation. We're thinking of it computationally. We're seeing the randomness in the results. These are things that you're going to see with netlogo over and over again, that we do the experiment, and then we do it again and we do it again, and every time, it's a little bit different, but in the end, if it's a well-designed experiment, we'll get the result that we want. Try this when you get a chance. Finally, I'll give you one more [Slide 16] definition that Irene showed me the other day, and this comes from something that Microsoft was doing about jobs and the economy in the future, and the importance of STEM, and this is definition of computer science education. It's actually not a bad definition of What-is-Computer-Science Page 7 of 8 computer science itself. It's a study of computers and algorithmic processes. That's what we're going to focus on, their principles, their hardware, certainly we want to consider their impact on society. What-is-Computer-Science Page 8 of 8