marcoallanda01 / IS23AM15

4 stars 2 forks source link

Optional NOT as attribute #12

Closed GiuseppeBocci closed 1 year ago

GiuseppeBocci commented 1 year ago

Use an Optional as an attribute of a class is a bad practice https://stackoverflow.com/questions/29033518/is-it-a-good-practice-to-use-optional-as-an-attribute-in-a-class

ingconti commented 1 year ago

to say all, the post suggested all the opposite.. anyway

GiuseppeBocci commented 1 year ago

Doesn't the answer say that Optional was intended for methods' return? Optional doesn't implement serializable and we are implementing the persistence, so is it better to not use Optional as a attribute?

ingconti commented 1 year ago

it says that can be very good to use, even in different cases from history of java. to answer about persistence pls send mew a snippet of code with a Sample class you want to persist, with optional, so we can discussion in little the problem outside IS project.