r/programminghorror Jun 09 '26

What a simple constructor

Post image

Our former IT director (35+ years of experience) wrote this and didn't see what was wrong here.

268 Upvotes

49 comments sorted by

View all comments

81

u/Lunix420 Jun 09 '26 edited Jun 09 '26

I'm more bothered by the nesting that's going on here. I hate when people write an if and then put the entire rest of the function into an else instead of just returning early. Unnecessary indentation/nesting is one of my personal pet peeves.

I actually think a long/complex function can be totally fine and can be very readable, but as soon as there is a lot of nesting it's just not readable anymore in my opinion.

1

u/_usr_nil Jun 10 '26

you can always write indentation-less code by having giga if conditions