Goslingin ajatuksia poikkeusten käsittelystä

Heinäkuu 7th, 2007

Viime aikoina on kohkattu paljon Javan checked exceptioneista ja muutama kaveri on jopa intoutunut ehdottamaan niiden poistamista Java-kielestä kokonaan. Tämän vuoksi ajattelinkin blogata mainiosta haastattelusta, johon törmäsin joku aika sitten. Haastattelussa Java-kielen kehittäjä kertoo omia ajatuksiaan poikkeusten käsittelystä:

http://www.artima.com/intv/solid.html

” Lots of newbie’s coming in from the C world complain about exceptions and the fact that they have to put exception handling all over the place—they want to just write their code. But that’s stupid: most C code never checks return codes and so it tends to be very fragile. If you want to build something really robust, you need to pay attention to things that can go wrong “

” A programming language can’t solve all the problems. A language can’t guarantee that no matter how screwed up the environment gets the program will survive. But anything the language can do to increase the probability that programs will be reasonably graceful under fire is a good thing. For example, just making people at least willfully ignore return codes helps. In Java you can ignore exceptions, but you have to willfully do it. You can’t accidentally say, “I don’t care.” You have to explicitly say, “I don’t care.” “

” Having one big catch clause on the outside really only works if your exception handling philosophy is simply to die. ”

Artikkeli on luettu 1207 kertaa. Kuuluu luokkiin: Ajatuksia, Ohjelmointi, Vastaantullutta, Java

Jätä kommentti

(ei näy sivuilla)

(kirjoita kuvassa näkyvät merkit, pakollinen)

Sallitut HTML-elementit:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Kalenteri

Heinäkuu 2007
M T K T P L S
« Kes   Syy »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Uusimmat kirjoitukset

Sivusto

You can think I'm wrong, but that's no reason to quit thinking.
- Gregory House