Computer Science Teacher

# November, 2011

• #### How Many Sorting Algorithms Do Beginners Need To Learn

Do beginners even need to learn sorting algorithms? Let’s face it most modern programming environments have a sort function built in. In the so-called real world just about the only people who write sorting algorithms have PhDs in math or computer science and have likely published papers in peer reviewed journals on the sorting subject. So why take up time in a first programming course to talk about sorting? Because its good for them! Well sort of.

I was looking through the first textbook I wrote some 11 years ago and finding that it include both the bubble and selections sorts. Now these are terribly performing sorts. No one uses these. Quick sort perhaps. Maybe Insertion sort. Bubble sort? What was I thinking! As best I can recall I was thinking about helping explain how arrays worked with loops. It was more about developing an algorithm and seeing how it worked with real (or realish) data. Oh and if I recall correctly, the publisher asked me to make sure I covered sorting and searching. But maybe that is me trying to blame someone else. In a more advanced course one would use different sorting algorithms to learn about algorithm complexity, performance and probably also discuss Big-O notation. That works as a good excuse to talk about different sorting algorithms for many.

Students understand what sorting is all about. Well they don’t understand all of what it is about but at least if you ask students to sort data by hand they can usually do it. In fact asking students to sort data, perhaps on index cards, and asking them to think through the process they use can be very helpful. This helps them understand the complexity. The value though is really about understanding algorithm creation and translating that into code. Having to involved a number of important concepts like arrays, loops, and decision structures is also a good thing.

I think today I would teach the Quick Sort. It has all the goodness of other sort PLUS it involves recursion. Recursion is still a bit of magic to me. What it has taken me a while to really appreciate recursion I do now. The typical recursion example is really looping – things like calculating the Fibonacci Sequence. That’s not a bad thing but an application that requires recursion is better, my opinion, for getting students to really appreciate its power.

But I wonder if there are better algorithms to use as teaching tools? We, the teaching community, should probably be looking for some. Perhaps some that students are actually likely to have to implement some day. What do you think? Are sort algorithms essential? Why? What sort or sorts do you think students should learn? Or is there a better problem that solves the same issues in learning programming and algorithm development?

• #### Programming for Absolute Beginners from Channel 9

Channel 9 has just launched an absolute beginner series to help people learn to program. There are two versions of the Development for Absolute beginners materials – one for Visual Basic and one for C# Well worth checking out.

There are some additional resources that have been out for a bit longer that you may not know about.

• #### The Perfect Educational Computer Lab

I had the following question via Twitter the other day “Hey Alfred. We got permission to overhaul our computer lab, Have you seen any innovative strategies or configurations?” Now this is a question that comes up pretty regularly among computer science teachers. Or teachers who teach computer applications for that matter. Every time the subject comes up there are a lot of different opinions. These opinions cover things like types of computers, arraignment of desks and computer tables, assorted “must have” teaching aides and more. As far as I can tell there really is no one size fits all answer. I did decide to spend some time thinking about it this week though. As I thought, one conclusion I came to is that the most important item in an educational computer lab is the teacher. A good knowledgeable teacher who cares about the subject and the students and has good classroom management skills can overcome a lot of computer lab design deficiencies. A bad teacher cannot be compensated for by computer lab design though. That being said, a few thoughts to start a discussion (I hope) going.

## Computers

If you are teaching computer science a lab should have solid, modern high performance computers. Laptop or desktop they should have enough memory (a moving target), good graphics cards and good CPUs. I’ve seen schools where administrators get top of the line computers and computer labs get the hand me downs. Totally bas ackwards. Most administrators spend their time doing Office apps and email with some web browsing mixed in. They don’t need the latest and greatest computers. Students who are using the latest software development tools (MSDN AA can help here BTW) are going to be compiling and doing other things that work better on a computer with some energy. You don’t want them frustrated by old hardware with crappy graphics cards and sound cards removed. What leave the sound cards in? Why yes! How else are you going to have them create real multimedia applications? A lot of people are looking at game development as a “hook” that builds interest among students and allows for teaching of some serious CS concepts. You need good computers to do that right. Oh and hopefully you are all buying LCD monitors these days. Less power usage and heat generation plus they take up less valuable desktop space.

## Network

Please have a good reliable network with all student work saved in a network location. The last thing you want is students having work spread out over a half a dozen computers and not being able to get to them because a computer is down or occupied or “borrowed” by someone. This will also let you backup everyone’s work which you really want to do. This is a general thing these days and, hopefully, not just a computer lab deal. A good network is essential in a 21st century school. Some people like to be able to cut off the Internet to the lab at various times. This is not usually that hard to do but I tend to see some good to letting students do research on the Internet even while I am lecturing. Let them “fact check” me if they way. Having students do things “bad” on the Internet is a classroom management issue just like them reading a novel under the desk is. My opinion – your mileage may vary.

## Room Layout

One of the few things that most people seem to agree on is that you want a good, ceiling mounted LCD projector. Get a good one with as high a resolution as you can afford. If you can get a network (wi-fi) enabled projector so much the better. That will allow you to set up the demo system anywhere in the room and even switch systems as needed. Maybe a good way to get students to show their work without a lot of reconfiguration fuss.

How do you layout the computers? For many this depends completely on the room available and how many computers you have to stick in it. I’ve worked in some really weird configurations. If you have space though I have seen three main organizations – all with pros and cons.

### Rows and rows

The traditional classroom but with computers on the desks. Variations include monitors under a glass desktop and desks with power and network connection for students to plug in their own laptops. The monitors under a glass desktop seem like a great idea but as with so many things the practice does not live up to the theory from what people tell me. This sort of arrangement is beloved by people who like neat rows and order. It can maximize the available space. I’ve taught in a number of rooms like this but it has some disadvantages. One is that you can’t see what students are doing very easily. Oh sure you can set up monitoring software and keep an eye out this way but I find that less appealing because it means you can look at their screens or their body language but generally not both. It also means that while you are talking and not able to look at a monitor they can be doing anything. You can teach from the back of the room and see what they are doing but then you can’t see faces and I like faces. Also with setups like this it can be very hard to get to students to help them out when they run into the inevitable problems.

### Up against the wall

The other common arraignment is to set up the computers around the outside of the room facing the walls. Advantages are several. One is that you can have the students turn around (i.e. away from the computer) while you are talking. It also means the center of the room is free for group work which can be really handy. And of course while students are working you can keep an eye on screens. Also you can get to students easily if they are having issues.  I haven’t taught using this configuration much myself but I know a number of teachers who I respect who seem to be using it to good effect. The one down side is that you may not have room for all the computers you want/need unless you have a big room. A big room is a good thing though.

### Rounds

I’ve worked in a number of labs with a bunch of round tables with computers set up on them. These sorts of labs are better for students to work on projects than for teaching. As a teacher you can see some faces and some screens but not all. Some students are going to be quite hidden in fact. But you can move around to help pretty easily assuming someone did a good job wiring and you are not always tripping on wires. These labs seem to lend themselves towards pair programming BTW. Placing books and papers can be an issue but that is true of most cases where the computer takes up most of the desk surface. The circles make it worse though in my observations.

### What else?

My very first computer lab had 12 Apple IIe computers in carrels – yeah that was a while ago.  I set them up in staggered lines sort of like \/ \/ \/ It let everyone see me and I could see them and their computers. It was pretty easy to get to students to help out as well. Felt weird though. I’m sure there are other innovative setups but I can’t think of any off hand. Suggestions of things that work for you?

## Other Resources

Do you need a printer in the room? I’m old school and I like to look at listings for sticky problems. So I vote yes. Put it out of the way so it is not everyone’s first choice but still easy to get to. If you are one of those people who has people hand things in on paper make sure you get a fast reliable printer. There are few things worse than waiting 10 minutes after class for all the last minute printouts to show up.

How about a scanner or two? We used to set those up as a station with a dedicated computer. This is hard to justify these days with limited budgets though. I have two printer/scanner/fax systems at home that are network enabled. Setting one of those up so students can use them from any computer in the lab may be an option to try.

Miscellaneous small stuff? Xbox controllers for creating games using XNA or teaching using Kodu. Headphones for use in multimedia applications. Speaking of headphones. I’m ok with students listening to music while programming as long as they use headphones and I can’t hear it. I know an awful lot of professional programmers who program to music. Your school’s rules may or may not allow it of course. Robots? Use them if you have them. Kinect? If you have room for one they are not that expensive and you may be amazed by what students create if you have one available. The Kinect for Windows SDK is a free download. (BTW Check out the XNA, Kodu and Kinect keywords for other resources on those items that I have blogged about )

What else? Let’s get some ideas out here. What works for you? What doesn’t work for you? What would your ideal teaching/learning computer lab look like?