-
February 15th, 2022, 04:54 AM
#1
Is it ok to use null checks?
What are your thoughts about explicitly checking for null in Java or other language that allows nulls? There are some alternatives but I don't know what think of it. I read an article recently(linked below), that suggests to throw exceptions, using Optional and other ...
Is there any case that would justify the usage of null checks? I feel like checking for null is bad design but if so, why Java allows it in first place? Please let me know your thoughts.
This article I read says that doing null checks is bad design and I kind of agree with it, I see where is coming from. But so many other devs just say that is BS.
I did work in a company where they had methods with almost 10 parameters and full of null checks, I think that was definitely bad design butt everybody was so obsessed with checking for nulls that I didn't know how to argue against them.
Please let me know your thoughts, I personally like some of the alternatives mentioned in that text.
https://medium.com/javarevisited/avo...s-b3f11afbfcc9
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|