Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #606
| From | Lew <noone@lewscanon.com> |
|---|---|
| Newsgroups | comp.lang.java.help |
| Subject | Re: Good practice or not to close the file before System.exit(1)? |
| Date | 2011-04-23 09:54 -0400 |
| Organization | albasani.net |
| Message-ID | <iouln5$imi$1@news.albasani.net> (permalink) |
| References | (7 earlier) <S5qdnd_Hy-rGbizQnZ2dnUVZ_j2dnZ2d@earthlink.com> <iot00p$2q0$1@dont-email.me> <c4WdnY5-xd42iy_QnZ2dnUVZ_tqdnZ2d@earthlink.com> <iotcfi$gno$1@news.albasani.net> <-6mdnX7le_QCoC_QnZ2dnUVZ_v6dnZ2d@earthlink.com> |
Patricia Shanahan wrote: > Lew wrote: >> Patricia Shanahan wrote: >>> markspace wrote: >>>> Patricia Shanahan wrote: >>>> >>>>> >>>>> There is no problem using exceptions inside main, as long as you catch >>>>> them, so that they don't get thrown from main. >>>> >>>> During development, throwing exceptions from main is fine because it >>>> gives the developer the most about of useful information. >>> >>> Yes, I was over-simplifying a bit. >> >> I disagree. Throwing exceptions from main() provides no benefit that >> logging doesn't provide better. > The benefit is simplicity. > > I often write short test programs, for example when looking into a > newsgroup question, for which I'm the only user and that will only be > run once. Just sticking "throws Exception" on main is simpler than > catching exceptions and logging them. I repeat the part that you omitted, which changes the sense of the comment you cited, > I'm using "main()" as a catch-all term for the top business layer of an application, > be it a Java application, applet, web app, service or whatever. > The observable behavior must conform to the problem domain being solved by the application. > Emitting implementation-level messages at the business-domain level is inappropriate > unless the business domain *is* the implementation. You speak of the case where the implementation is the domain, which I explicitly called out as a case where I agree that exceptions can be useful in the "main". Thanks for elucidating that point. -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg
Back to comp.lang.java.help | Previous | Next — Previous in thread | Next in thread | Find similar
Good practice or not to close the file before System.exit(1)? Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-22 00:13 +0200
Re: Good practice or not to close the file before System.exit(1)? rossum <rossum48@coldmail.com> - 2011-04-22 00:11 +0100
Re: Good practice or not to close the file before System.exit(1)? rossum <rossum48@coldmail.com> - 2011-04-22 12:39 +0100
Re: Good practice or not to close the file before System.exit(1)? Patricia Shanahan <pats@acm.org> - 2011-04-22 05:09 -0700
Re: Good practice or not to close the file before System.exit(1)? Lew <noone@lewscanon.com> - 2011-04-22 09:39 -0400
Re: Good practice or not to close the file before System.exit(1)? Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-23 13:20 +0200
Re: Good practice or not to close the file before System.exit(1)? Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-22 16:37 +0200
Re: Good practice or not to close the file before System.exit(1)? Patricia Shanahan <pats@acm.org> - 2011-04-22 04:55 -0700
Re: Good practice or not to close the file before System.exit(1)? Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-22 13:56 +0200
Re: Good practice or not to close the file before System.exit(1)? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-04-22 09:36 -0300
Re: Good practice or not to close the file before System.exit(1)? markspace <-@.> - 2011-04-22 08:20 -0700
Re: Good practice or not to close the file before System.exit(1)? Patricia Shanahan <pats@acm.org> - 2011-04-22 09:04 -0700
Re: Good practice or not to close the file before System.exit(1)? markspace <-@.> - 2011-04-22 15:24 -0700
Re: Good practice or not to close the file before System.exit(1)? markspace <-@.> - 2011-04-22 18:11 -0700
Re: Good practice or not to close the file before System.exit(1)? markspace <-@.> - 2011-04-23 08:25 -0700
Re: Good practice or not to close the file before System.exit(1)? Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-22 18:55 +0200
Re: Good practice or not to close the file before System.exit(1)? Lew <noone@lewscanon.com> - 2011-04-22 13:40 -0400
Re: Good practice or not to close the file before System.exit(1)? Patricia Shanahan <pats@acm.org> - 2011-04-22 10:55 -0700
Re: Good practice or not to close the file before System.exit(1)? Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-22 22:58 +0200
Re: Good practice or not to close the file before System.exit(1)? Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-22 23:09 +0200
Re: Good practice or not to close the file before System.exit(1)? Patricia Shanahan <pats@acm.org> - 2011-04-22 14:30 -0700
Re: Good practice or not to close the file before System.exit(1)? markspace <-@.> - 2011-04-22 15:38 -0700
Re: Good practice or not to close the file before System.exit(1)? Patricia Shanahan <pats@acm.org> - 2011-04-22 17:00 -0700
Re: Good practice or not to close the file before System.exit(1)? Lew <noone@lewscanon.com> - 2011-04-22 22:10 -0400
Re: Good practice or not to close the file before System.exit(1)? Patricia Shanahan <pats@acm.org> - 2011-04-22 19:46 -0700
Re: Good practice or not to close the file before System.exit(1)? Lew <noone@lewscanon.com> - 2011-04-23 09:54 -0400
Re: Good practice or not to close the file before System.exit(1)? Roedy Green <see_website@mindprod.com.invalid> - 2011-04-22 12:45 -0700
Re: Good practice or not to close the file before System.exit(1)? Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-22 23:20 +0200
csiph-web