code review based on what I learned from D

Bogdan via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jul 6 01:49:16 PDT 2015


On Sunday, 5 July 2015 at 09:46:19 UTC, ketmar wrote:
> On Sun, 05 Jul 2015 21:39:23 +1200, Rikki Cattermole wrote:
>
>> Of course of course.
>> Valid options in failing gracefully include resetting the data 
>> and
>> informing the user. Also giving them an option to send a bug 
>> report to
>> the devs.
>> Point being, having it just fail on start each time is not a 
>> valid end
>> result or something else awful.
>
> ah, i see and i fully agree.

I think that if you really are scared if your installed app will 
crash because of some assert that you wrote, it means that you 
are not confident enough with your coding skills. I use asserts 
to remember me something that I am not allowed to do.

As a developer sometimes I say that I will do "this" and I will 
remember to use it like "that" and this is almost never happens. 
When you work in a big team, this NEVER happens and not because 
people are evil, because we forget things, and it's easy to make 
mistakes.

I use asserts to fail quick, during development. If you are 
afraid to make a program that not crashes you should not be a 
programmer. I bet that everyone would prefer to  have a program 
that crash for known reasons instead from some unknown, strange, 
science-fiction bug.

And if you are really afraid of asserts in your code you can 
disable them for the release build, but I personally would not do 
that.

Bogdan


More information about the Digitalmars-d-learn mailing list