About Question enthuware.ocajp.i.v8.2.881 :
Moderator: admin
-
- Posts: 21
- Joined: Mon Nov 20, 2017 8:00 am
- Contact:
About Question enthuware.ocajp.i.v8.2.881 :
is business domain = business logic?
-
- Posts: 21
- Joined: Mon Nov 20, 2017 8:00 am
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.881 :
1. Why "It allows creation of new exceptions that are custom to a particular application domain." is false?
The question is : "Java's Exception mechanism helps in which of the following ways?". Ability of creating custom exceptions is a part of Java's Exception mechanism and it definitely helps us, right?
2. Why "It provides a vast set of standard exceptions that covers all possible exceptions." is true?
we agreed that Java's standard exceptions cannot cover ALL scenarios
The question is : "Java's Exception mechanism helps in which of the following ways?". Ability of creating custom exceptions is a part of Java's Exception mechanism and it definitely helps us, right?
2. Why "It provides a vast set of standard exceptions that covers all possible exceptions." is true?
we agreed that Java's standard exceptions cannot cover ALL scenarios
-
- Site Admin
- Posts: 10386
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.881 :
1. I see that this option is indeed marked as correct.
2. I see that this option is indeed marked as incorrect.
2. I see that this option is indeed marked as incorrect.
-
- Posts: 13
- Joined: Thu May 16, 2024 5:30 pm
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.881 :
"It improves code because error handling code is clearly separated from the main program logic."
This is far from true. Having try/catch blocks in the middle of a function is the opposite of clear separation, and typically makes code harder to read. Bob Martin's Clean Code warns against this exact practice. Is this an answer that's actually appeared on the exam? If so, Oracle is full of it (and I'm extra-grateful for enthuware's exam prep).
At the same time, "It provides a vast set of standard exceptions that covers all possible exceptions." seems like a technically correct answer because the Exception class covers all possible exceptions.
This is far from true. Having try/catch blocks in the middle of a function is the opposite of clear separation, and typically makes code harder to read. Bob Martin's Clean Code warns against this exact practice. Is this an answer that's actually appeared on the exam? If so, Oracle is full of it (and I'm extra-grateful for enthuware's exam prep).
At the same time, "It provides a vast set of standard exceptions that covers all possible exceptions." seems like a technically correct answer because the Exception class covers all possible exceptions.
-
- Site Admin
- Posts: 10386
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.881 :
>Having try/catch blocks in the middle of a function is the opposite of clear separation, and typically makes code harder to read. Bob Martin's Clean Code warns against this exact practice.
Can't really comment on what others say in what context and in comparison to which other approach. But exception handling using try/catch does separate error handling code from the main business logic. The main business logic is in the try block, while the error handling code is in the catch blocks. So, I don't see any issue with this statement. One can write unreadable code using any approach.
Yes, exam tests you on these points. You may go through Oracle's Exception handling lesson. Specially where it explains the advantages. The exam has questions based on the contents of this lesson.
>At the same time, "It provides a vast set of standard exceptions that covers all possible exceptions."
This is wrong because no matter how many standard exception classes the library provides it cannot cover all possibilities. No, the fact that all exceptions extent from Throwable and that means Throwable covers all possibilities is not relevant here. It is talking about specific exception classes for specific exceptional situations. e.g. FileNotFoundException for file not found and so on.
Can't really comment on what others say in what context and in comparison to which other approach. But exception handling using try/catch does separate error handling code from the main business logic. The main business logic is in the try block, while the error handling code is in the catch blocks. So, I don't see any issue with this statement. One can write unreadable code using any approach.
Yes, exam tests you on these points. You may go through Oracle's Exception handling lesson. Specially where it explains the advantages. The exam has questions based on the contents of this lesson.
>At the same time, "It provides a vast set of standard exceptions that covers all possible exceptions."
This is wrong because no matter how many standard exception classes the library provides it cannot cover all possibilities. No, the fact that all exceptions extent from Throwable and that means Throwable covers all possibilities is not relevant here. It is talking about specific exception classes for specific exceptional situations. e.g. FileNotFoundException for file not found and so on.
-
- Posts: 13
- Joined: Thu May 16, 2024 5:30 pm
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.881 :
I wish I could upvote answers, because I'd give you one. Thank you for the reply
Who is online
Users browsing this forum: No registered users and 10 guests