Die early, Die Fast, Die Loudly

During my years of programming, I have met so many programmers with different ways of doing things, for example some believe in documentation, some don’t. This is however one of the many little things that programmers do differently. Some of these little things degenerate into big flame wars.

One of these concepts is what I call the DIE concept. Some programmers believe your program should run as long as possible, other believe the program should die as soon as possible before corrupting other data. I am going to explain the DIE paradigm, because….well I want to write something.


Die Early: We believe your programs should die as early as something bad happens. This concept flows down to compiled languages. If a dot, a jot of your incantation is wrong, the code won’t even compile! This I believe is the way things should work. Never allow your exceptions to be swallowed up. PHP is the only culprit that came to mind here. I believe errors and warnings are/should be a core part of programming. When a language turns off errors and warning by default, then I have a problem. There are several/countless hours wasted by programmers debugging php code that wont have been spent if the language just spit out some errors. I give kudos to java in this case. When something goes wrong, just blow up, or at least log a COMPLETE STACK TRACE of what happened and also TELL SOMEONE THAT SOMETHING BAD HAPPENED.


Die Fast: If you are going to die, please just do so. It makes no sense trying to do house cleaning while you are dying, you won’t need it anyway. The longer it takes an application to die, the more prone the whole system is to a complete disaster. When a part of the system experiences big enough turbulence to make it die, let it just die, or make it stop recieving input from other parts of the system, and it should never send out any message except for the next rule.


Die Loudly: When a module/application is dying, let it do so as loudly as possible. Print all the stack trace, or log it. If there are other modules sending message to it or reading message from it, let them know that the module is dead and can no longer recieve data. So many times, it is bad to let these guys find out for themselves that there server or client is dead. Let is be as loud as it can be. In a scenario where you have monitors and/or supervisors, they should make sure that all applications that require this dead module are paused at least. The best is to KILL THEM TOO.


This is how I have learnt to program, and sincerely, it’s always worked for me. I could have named this post “I love Exceptions”. They are a part of the application development process as well as a way to know what is happening to your application even at runtime.



  1. beberlei said

    i cant agree with you on the php error stuff. its the first thing you learn.

    its that easy in php to see all errors, just type error_reporting(E_ALL|E_STRICT); and youre good to go. this is discussed in most of the beginners tutorials i know.

    additionally you can put your own error handler in place and replace all errors and warnings with exceptions, the snippet to do that is 4 lines of code and in the php documentation at php.net/set_error_handler.

    • Thanks for the eye-opener single liner


      . I always do that is the config file php.ini.

      But my argument is that they shouldn’t turn errors off by default. Errors should be turn off only when you are going into production but not before.

  2. How is this article related to NetBeans ? I see it tagged with “netbeans”, it shows up on the netbeans news feed (hence in the NB dashboard), yet nothing in it to do w/ NetBeans … I’m not sure if you intended this, but with this title in the posting prefixed w/ “NetBeans:” it sounds like netbeans sucks big time as it dies early, fast, and loudly

    Good stuff otherwise..

    Cheers !

RSS feed for comments on this post · TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: