Page 1 of 1

About Question enthuware.ocajp.i.v8.2.881 :

Posted: Fri Jan 19, 2018 4:26 am
by Arold Aroldson
is business domain = business logic?

Re: About Question enthuware.ocajp.i.v8.2.881 :

Posted: Fri Jan 19, 2018 4:35 am
by Arold Aroldson
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

Re: About Question enthuware.ocajp.i.v8.2.881 :

Posted: Fri Jan 19, 2018 12:16 pm
by admin
1. I see that this option is indeed marked as correct.
2. I see that this option is indeed marked as incorrect.

Re: About Question enthuware.ocajp.i.v8.2.881 :

Posted: Fri May 17, 2024 3:01 pm
by michaelrfarcasin
"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.

Re: About Question enthuware.ocajp.i.v8.2.881 :

Posted: Sat May 18, 2024 11:17 am
by admin
>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.

Re: About Question enthuware.ocajp.i.v8.2.881 :

Posted: Mon May 20, 2024 10:40 am
by michaelrfarcasin
I wish I could upvote answers, because I'd give you one. Thank you for the reply