DEV Community

Discussion on: Are you using Void correctly?

Collapse
 
zyzmoz profile image
Daniel Cunha (he/him)

I got your point. I do agree that we (developers) should think exactly what the function will perform to assign the right return. Although, I also think it's a kind of extremism say that void isn't recommended at all! I came from a Java background, so there are principles I learned that justify the use of void functions like simple setters! Mostly if we don't get the right idea of some structure or practice, it lead us to a misconception of it!

Btw, well-elaborated article!

Collapse
 
chris_bertrand profile image
Chris Bertrand • Edited

Setters are also valid. I'd lump that with global config/state. The exceptions to the rule (there are no rules) πŸ˜…are minimal and the ability to misuse void are much higher in my experience. Thanks for adding to the discussion.