1
1
111ilya1112021-07-08 15:05:52
Java
111ilya111, 2021-07-08 15:05:52

How to correctly implement the answer in the directories?

Hello.
Let's say there is a currency reference, getByCode method. What is the best practice for answers?
Should I use optional? I just met different implementations, including the use of exceptions, in the case of an entity not found.
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2021-07-08
@sergey-gornostaev

Depends on the chosen programming paradigm and design approaches.

D
Dmitry Roo, 2021-07-08
@xez

I am for Optional or @SneakyThrows.
There is no right or wrong - this is a matter of agreements on the project, as Sergey Gornostaev wrote

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question