DEV Community

Discussion on: Code Smell 72 - Return Codes

Collapse
yoursunny profile image
Junxiao Shi

Tell the designers of Go programming language.
There's no exception.
Error checking everywhere.

Collapse
mcsee profile image
Maxi Contieri Author

if you read this sentence on the article above you will find your own answer

Avoid immature and premature optimized languages favoring return codes

Collapse
dakujem profile image
Andrej Rypo

That's exactly the same thing that occured to me, at first. Except, in Go they call "them" Errors and they are the mechanism that serves the same purpose, implemented different way. In the same manner you probably shouldn't return error codes in Go, but return Error objects as the second return value.

Collapse
mcsee profile image
Maxi Contieri Author

Yes. That is why I would chose a more mature language and not one based on the 60s.

But if performance is the ONLY concern I think we can tolerate lots of code smells . It is a price to pay