Computer Science Field Guide Teacher Version V2.8.1
Total Page:16
File Type:pdf, Size:1020Kb
Computer Science Field Guide Teacher Version v2.8.1 Print Edition Sponsors Funding for this guide has been generously provided by these sponsors Produced by the CS Education Research Group, University of Canterbury, New Zealand, and by many others. The Computer Science Field Guide uses a Creative Commons (CC BY-NC-SA 4.0) license. 2 of 590 Computer Science Field Guide - v2.8.1 1. Introduction 1. Introduction Teacher Note: Introduction for teachers This guide is an online interactive textbook to support teaching computer science in high schools. It was initially developed to support the new achievement standards in Computer Science that are being rolled out in New Zealand from 2011 to 2013, but eventually will be expanded to support other curricula. The version that you are reading now is the teachers' version, in which chapters are interspersed with information for teachers, like this box. It will include answers and hints, so this version shouldn't be released to students (although because the material is open-source, a resourceful student may well find the teachers' version). Because the guide is constantly under revision, we welcome feedback so that we can improve, clarify, and correct the material. The best way to provide feedback is through the "Give us feedback" link (this can range from a typo to a broad suggestion). You can also contact us about more general matters by emailing [email protected], or [email protected] . Watch the video online at https://www.youtube.com/embed/v5yeq5u2RMI?rel=0 1.1. What's the big picture? Why is it that people have a love-hate relationship with computers? Why are some people so fanatical about particular types of computers, while others have been so angry at digital devices that they have been physically violent with them? And what does this have to do with computer science? And what is computer science anyway? I'm glad you asked! Put simply, computer science is about tools and techniques for designing and building applications that are very fast, have great interfaces, are reliable, secure, helpful --- even fun. A lot of people confuse computer science with programming. It has been said that "computer science is no more about programming than astronomy is about telescopes" ( www.csfieldguide.org.nz/en/ 3 of 590 1. Introduction Mike Fellows). Programming is the tool that computer scientists use to bring great ideas to life, but just knowing how to give programmed instructions to a computer isn't enough to create software that delights and empowers people. For example, computers can perform billions of operations every second, and yet people often complain that they are too slow. Humans can perceive delays of about one tenth of a second, and if your program takes longer than that to respond it will be regarded as sluggish, jerky or frustrating. You've got well under a second to delight the user! If you are searching millions of items of data, or displaying millions of pixels (megapixels), you can't afford to do things the wrong way, and you can't just tell your users that they should buy a faster computer ... they'll probably just buy someone else's faster software instead! Here's some advice from Fred Wilson, who has invested in many high profile tech companies: First and foremost, we believe that speed is more than a feature. Speed is the most important feature. If your application is slow, people won't use it. I see this more with mainstream users than I do with power users. I think that power users sometimes have a bit of sympathetic eye to the challenges of building really fast web apps, and maybe they're willing to live with it, but when I look at my wife and kids, they're my mainstream view of the world. If something is slow, they're just gone. ... speed is more than a feature. It's a requirement. -- Fred Wilson (Source) A key theme in computer science is working out how to make things run fast, especially if you want to be able to sell your software to the large market of people using old-generation smartphones, or run it in a data centre where you pay by the minute for computing time. You can't just tell your customers to buy a faster device --- you need to deliver efficient software. 1.2. Beyond speed Computer science isn't just about speed. Try using the following two calculators to make a simple calculation. They both have the same functionality (they can do the same calculations), but which is nicer to use? Why? (This book has many interactives like this. If the calculators don't work properly, you may need to use a more recent browser. The interactive material in this book works in most recent browsers; Google Chrome is a particularly safe bet.) Use the interactive online at http://www.csfieldguide.org.nz/en/interactives/awful-calculator/index.html 4 of 590 Computer Science Field Guide - v2.8.1 1. Introduction The second calculator above is slower, and that can be frustrating. But it has a fancier interface --- buttons expand when you point to them to highlight what you're doing. Does this make it easier to use? Did you have problems because the "C" and "=" keys are so close? How interfaces work is a core part of computer science. The aesthetics --- images and layout --- are important, but what's much more crucial is the psychology of how people interact. For example, suppose the "OK" and "Cancel" buttons in dialogue boxes were occasionally reversed. You would always need to check carefully before clicking on one of them, instead of using the instinctive moves you've made countless times before. There are some very simple principles based on how people think and behave that you can take advantage of to design systems that people love. Making software that can scale up is another important theme. Imagine you've built a web interface and have attracted thousands of customers. Everything goes well until your site goes viral overnight, and you suddenly have millions of customers. If the system becomes bogged down, people will become frustrated waiting for a response, and tomorrow you will have no customers --- they’ll all have moved on to someone else's system. But if your programs are designed so they can scale up to work with such large amounts of data your main problem will be dealing with offers to buy your company! Some of these problems can be solved by buying more equipment, but that can be an expensive and wasteful option (not just for cost, but because of the impact on the environment, including the wasted power used to do the processing inefficiently). With mobile computing it's even more important to keep things lean and efficient --- heavy duty programs chew up valuable battery life, and processing and memory must be used sparingly as these affect the size, weight and even heat dissipation of devices. If your system is successful and becomes really popular, pretty soon people will be trying to hack into it to steal valuable customer data or passwords. How can you design systems so that you know they are secure from such attacks and your customers can trust you with their personal information or business transactions? All these questions and more are addressed by the field of computer science. The purpose of this guide is to introduce you to those ideas so that you have a better idea of whether this field is for you. It is aimed at high-school level, and is intended to bring you to the point where you have a good overview of the field, and are well prepared for further in-depth study to become an expert. We've broken computer science up into a whole lot of topics that you'll often find in curricula around the world, such as algorithms, human-computer interaction, compression, www.csfieldguide.org.nz/en/ 5 of 590 1. Introduction cryptography, computer graphics, and artificial intelligence. The reality is that all these topics interact, so be on the lookout for the connections. This guide isn't a list of facts for you to memorise, or to copy and paste into projects! It is mainly a guide to things you can do --- experiences that will engage you with the topics. In fact, we won't go through all the topics in great detail, but will give you references to websites and books that explain things thoroughly. The idea of this guide is to give you enough background to understand the topics, and to do something meaningful with them. 1.3. Programming And what about programming? You can get through this whole guide without doing any programming, although we'll suggest exercises. Ultimately, however, all the concepts here are reflected in programs that people write. If you want to learn programming there are many excellent courses available. It takes time and practice, and is well worth doing in parallel with working through the topics in this guide. There are a number of free online systems and books that you can use to teach yourself programming. A list of options for all ages learning to program is available at www.code.org, where there is also a popular video of some well-known high-fliers in computing that is good to show classes. Programming is just one of the skills you'll need to be a computer scientist. In this book you'll be exercising many other skills --- maths, psychology, and communication are important ones.