Hacker News new | past | comments | ask | show | jobs | submit login

I'm in my final year of CS undergrad, and I've learned a couple of things outside of class that help me, all stuff I wish they would teach (well) in class:

* Learn how to write a Makefile, your builds should be one button/command away

* Learn how to test your code using assert.h, JUnit, whatever, just test all the fucking time.

* Learn GDB, stop using printf to debug.

* Use source control for everything, but especially group work. The groups in your classes emailing code around are doing it wrong, and by the time they'll find out, it will be to late.

* Spend some time in a functional language, and apply what you've learned to your Java/C/C++ class work. Minimizing side effects will minimize errors

Most of all though, get involved with your faculty or department, and try to affect some positive change. The connections you will make with other students and faculty could change your programming career more than anything else you do in school.




- Learn how to write a Makefile, your builds should be one button/command away

- Learn how to test your code using assert.h, JUnit, whatever, just test all the fucking time.

- Learn GDB, stop using printf to debug.

One of these things is not like the other. The first two pieces of advice suggest that doing things automatically is better than doing them manually. Then, you throw all that away for debugging? Instead of having your program just print the results of intermediate steps, you want to load the program inside another program, set breakpoints, and type "continue" as you hit them all, requiring your constant attention to perform a tedious task?

Debugging with printf is fine.


I think he should amend his statement to be learn how to use your debugger of choice.

I think printf is a fine tool for some things. GDB others, the IDE's version of a debugger as well for some tasks, re-looking at the code in question another time is another way. It should not be a holy war and there is never a completely correct way to do multifaceted tasks such as debugging. Knowing the strengths and weaknesses of the tool at hand is the best way to increase your effectiveness.

I am hacking on a kernel driver right now and printf(well IOLog) is the easiest way to debug but if I was running in userspace I would probably use the xcode interface to GDB because it lets you zero in on what you want to look at with state but sometimes printf is all I need.


What says you can't use GDB on the kernel? You'll need two machines to use it, but there's support in Darwin for debugging over FireWire.


I never said you couldn't. I said the easiest(least amount of hassle) way is to use IOLog and my brain for debugging purposes.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: