www.BrettDaniel.com

Tips for Purdue Computer Science

After delivering pizzas for the last six months, Jason is returning to Purdue next semester. He's starting over completely with computer science as his new major. I talked to him yesterday, and it got me thinking: what would I have liked to know before going into my first CS course? I came up with the following list. I hope it helps some incoming freshman who may stumble across it.

Install Linux On Your Home Computer

Purdue CS uses nothing but Solaris Unix boxes for project testing and graded labs. They're annoying, but with your own Unix clone you won't have to mess with them very much. I've found three benefits to having a Linux box:

  1. It will get you accustomed to the Unix command line which will make graded labs much, much easier. Linux in a Nutshell can help you get started and will act as a great reference down the road.
  2. Transferring files back and forth between two Unix machines is much easier than between Windows and Unix. This is especially important if you need to check output against a reference program. (See Automate)
  3. You will be able to develop projects at home in an environment similar to the one on which you will be graded. You won't have to worry about subtle Unix/Windows portability issues, nor will you have to mess with the build process.

You can either buy Linux or download it from a bunch of different places.

Emacs and IDEs

With Linux installed you can start playing with Emacs. This is the only text editor you get in labs (aside from vi which blows. Seriously.), and it pays to know the shortcut keys. At first it's hard to remember the combinations, but once muscle memory kicks in, editing goes a lot faster.

For more complex projects, sometimes Emacs just doesn't cut it. Instead, you'll need an IDE. The main benefit of an IDE is that it helps you remember your own code by providing code hints and automated documentation. I used Netbeans all semester and loved it.

Automate with Shell Scripts and Make

Once you get comfortable with Emacs, you can write shell scripts and makefiles. These are powerful timesavers that I wish I had learned sooner. Shell scripts allow you to automate a series of command line tasks. Makefiles are similar, however they are usually used to build large projects. Most class projects will require a makefile.

I only started using shell scripts heavily in my compilers class this year. I was constantly uploading testfiles by hand to run on the server. I soon tired of that and wrote a quick shell script that uploads a test file to the server, runs it, and downloads the result, all with one command. I also had a similar script to create numbered backups. Stuff like that is incredibly easy on Linux and saves an amazing amount of time. A "toolbox" of useful scripts will help you throughout the semester.

Debug Intelligently

I used to fall into the trap of shotgun debugging; that is, I would find a problem and just hack away at my code until it went away. At one point I realized I was spending more time fixing my fixes than fixing the bug. I go about things differently now. First I find the location of the bug using a debugger or print statements. Then I try to understand the bug before modifying any code. This has decreased my total debugging time and indirectly cut down on big blocks of commented code because I'm more confident in my changes. My programs probably work better now, too.

This article gives some good debugging advice as well.

Plan Against Late Nights

I'll admit I haven't always followed this advice, but I'm better than most. I would guess that the majority of CS students have on some occasion stayed up longer than 24 hours coding. I haven't, and I don't like how ridiculously long hours have become part of the culture of programming. Yes, there will be an incredible amount of work, but I believe it is possible to succeed in computer science without resorting to lost sleep and rushed code. Know how fast you code and plan ahead.

The Tests Will Suck

There's nothing more to say about CS tests. They reach a unique plateau of suckage unknown to mere mortals. This is the way of the world, so don't let it get to you. (I could have used this advice many times freshman year.)

Conclusion

This is certainly not an exhaustive list. It is just a small sample of the philosophy I have learned over the past five semesters. If you feel I have forgotten something, please feel free to leave it in the comments.

I hope someone out there finds this useful.

No Comments

Comments are closed.