News for hackers. Stuff that matters.
Re:Avoid Else, Return Early (2013) by djsumdog on Monday March 26, 2018 @09:42AM (#16678763)
I agree with this. When dealing with a modern programming language, it's just easier to name your functions and variables in such as way that they're readable. It makes sense to document public functions using the language's documentation syntax, if you're writing an API.

I look back at a lot of my old code and even without comments, it's easy to follow the logic because I used sensible names and constructs.

Re:Avoid Else, Return Early (2013) by jochung on Monday March 26, 2018 @10:44AM (#16679239)
I have the exact opposite experience. If you find yourself annotating your variables and methods with extra adjectives and nouns, your code isn't simple enough. Those explanations go in code comments.

Often it means you can refactor it so that there is only one of any "thing" so there is no need to clarify which version or role this "fooBarThing" is serving to disambiguate it from the other "bazBarThing".

Functional composition and well structured data is the key to this. It's basically halfway to point-free style.

Re:Avoid Else, Return Early (2013) by fouc on Monday March 26, 2018 @10:30PM (#16684664)
The variable name can just be fooBar, and bazBar, and organized/namespaced such that you could have Thing.fooBar and Thing.bazBar (assuming you want those exposed to the rest of the application).

Readable variable names doesn't mean wordy names. I would avoid using more than 2 words in a variable name.

Re:Avoid Else, Return Early (2013) by khedoros1 on Monday March 26, 2018 @04:12PM (#16682093)
Good, clear code, with nice names and such shows what the code is doing and how it's doing it. It doesn't tell you anything about why it's being done, or the context of the function within the code.

You're lucky if you're dealing with code that's either small enough or simple enough not to need the added context...or if you only need to read your old code.