Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2011
    Posts
    2
    Rep Power
    0

    Default Needless Difficulty with Streeam

    Hey guys,

    First I want to say that I do not mean to insult Java as a language or any of the Java programmers here. I'm having a problem getting accustomed to the way certain things are done in Java, because they seem needless to me. One thing that irritates me and turns me away from Java is the fact that I have to use so many try/catch blocks just to handle simple reading from a stream and proper closing in the event of an error. Maybe I am missing something, but in such a case preemptive error handling seems appropriate. There should be a way of knowing whether a stream is closed or not, rather than finding it out after an error occurs while handling an additional error. I don't think I've had this issue in .NET, but maybe I've been getting by and doing things wrong. My awareness is however alert on this matter when looking at Java.

    Does anyone have anything to suggest or correct me about? It is really not my intention is insult anyone, as I was hoping to learn much of the Java APIs.

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default Re: Needless Difficulty with Streeam

    Mainly I have two question for you.

    1. Java reports all the possible exceptions and reports (specially with IDEs) clearly. So we can easily identify what kind of issue could arise and we can take relevant precautions. Why you really feel that it is bad?

    2. Do you think that .Net not complain like that, or VC++, etc?

  3. #3
    Join Date
    Dec 2011
    Posts
    2
    Rep Power
    0

    Default Re: Needless Difficulty with Streeam

    Look, I don't have any problem with taking precautions. But exception handling is all about recovering from an error after the fact. I shouldn't have to nest several levels of try/catch blocks just to handle something that could have more efficiently and elegantly been avoided if only the API for it were available.

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default Re: Needless Difficulty with Streeam

    However, you can handle errors in different (try/catch) in different levels. For example within a method using single try/catch block you can still workaround. You got what I mean? So it is not that much difficult mate.

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default Re: Needless Difficulty with Streeam

    Quote Originally Posted by waitingforzion View Post
    Look, I don't have any problem with taking precautions. But exception handling is all about recovering from an error after the fact.

    Then what is the different between the precautions and recovering from an error?

Similar Threads

  1. difficulty understanding writing classes
    By elecleoalune in forum New To Java
    Replies: 11
    Last Post: 04-18-2011, 03:06 PM
  2. Difficulty with loading custom files
    By DrKilljoy in forum New To Java
    Replies: 3
    Last Post: 03-20-2011, 06:29 AM
  3. Applications in different difficulty
    By bubbless in forum New To Java
    Replies: 2
    Last Post: 03-11-2009, 12:31 AM
  4. difficulty
    By Daniela_v in forum New To Java
    Replies: 2
    Last Post: 03-04-2009, 05:36 PM
  5. Difficulty in finding the right algorithm
    By SolidCobra in forum New To Java
    Replies: 3
    Last Post: 10-05-2008, 11:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •