This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
In all of my code (amateur learner code) I never used assert, because I was thinking that I don't need an assert when I am using a debugger. But in the industry does your boss expect you to use assert even if we have a debugger? (OR no one cares as long as you can debug?)
Assertions and debugging are tools which are used for different purposes. Approximately speaking, assertions are used to ensure that code is doing what it is supposed to do. One normally assumes (hopes) that assertions will not be triggered, except during the testing phase. In that way they are a support tool for testing.
But debugging is used to find out why a program is not doing what you think it should be doing. Debugging only helps you to find out what happened on one particular run of your code. You aren't going to debug every single line of your code for every single test case and verify on a checklist that the right thing is happening.
So don't be surprised if you find both assertions and debugging being used.
Originally posted by Paul Clapham: But debugging is used to find out why a program is not doing what you think it should be doing.
This certainly is a common use for the debugger, but is not the only one.
It is often productive to use the debugger to step through your new code, even when you do not have a specific bug to find. By doing so, you verify that variables really do have the values you think they should, and that the path through the code is what you expect.
You can't do this for every piece of code, but when you have written something short, but complicated, it can be invaluable.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.