Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #600

Re: Good practice or not to close the file before System.exit(1)?

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-22 22:10 -0400
Organization albasani.net
Message-ID <iotcfi$gno$1@news.albasani.net> (permalink)
References (5 earlier) <871v0u6m0y.fsf@merciadriluca-station.MERCIADRILUCA> <8739laf0xz.fsf@merciadriluca-station.MERCIADRILUCA> <S5qdnd_Hy-rGbizQnZ2dnUVZ_j2dnZ2d@earthlink.com> <iot00p$2q0$1@dont-email.me> <c4WdnY5-xd42iy_QnZ2dnUVZ_tqdnZ2d@earthlink.com>

Show all headers | View raw


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.

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. 
Even there, there is a conceptual difference between the business domain and 
the implementation domain.

Design your business logic to be business logic.  DO NOT make the mistake of 
"temporarily" inserting inappropriate code thinking, "We can pull this out 
later for production."  Later doesn't come around enough to count on that.

Design it right from day one and do not stray from being good.

-- 
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg

Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

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