6 ms·
Shorter is easier to read and understand at first glance. Writing a paragraph kills any formatting in vi/vim. Why not write a comment if a paragraph is requir
by wolco2 6y ago
Shorter is easier to read and understand at first glance.
Writing a paragraph kills any formatting in vi/vim.
Why not write a comment if a paragraph is required to understand what you are doing.
This sounds like Hungarian notion taken to the extreme.
- Geminidog 6y ago>This sounds like Hungarian notion taken to the extreme. No it's sanity taken to the extreme. Have you ever noticed that all things written to communicate things to people in the United States outside of programming is written in a very verbose manner using a language called English? It's used for technical manuals, text books, and stories. Is English "hungarian notation taken to the extreme?" No dude. People actually find verbose English stuff easier to read. You don't have English writers abbreviating words and coming up with elegant acronyms in a physics text book. >Why not write a comment if a paragraph is required to understand what you are doing. I didn't say name your function after a paragraph. A functions English language analog is a word and at most a sentence. A paragraph would be several functions chained together. If you name your functions well, composed procedures will read close to an actual English paragraph. That being said there's nothing wrong with comments, comment away but don't call your function doXYZ and put the entire description in the comment. Your comment doesn't follow the a function call. Here's an example: list_of_profiles = get_list_of_profiles_from_file("profiles.txt") list_of_profiles_named_bob = filter_profiles_by_name("Bob", list_of_profiles) list_of_profiles_named_jane = filter_profiles_by_name("Jane", list_of_profiles) list_of_profiles_named_bob_and_jane = concatenate_profile_lists(list_of_profiles_named_bob, list_of_profiles_named_jane) list_of_pairs_with_a_married bob_and_jane = merge_married_profiles_into_list_of_pairs( list_of_profiles_named_bob_and_jane) Trust me, you may think your eyes are bleeding but they are not. The above is actually closer to the English language then 90% of code out there. What you don't realize is that there wasn't a need for a single comment and there wasn't a need to dive into any of these functions to read the definition. You just read the variable and function names and you know exactly what's going on. If you recompose these functions to do something else it's like recomposing sentences and words in the english language. The end result is still readable without the need for new comments. When you read a recipe or follow directions to build something does the writer give you those directions in some coded nomenclature? No the writer writes verbose English with clear grammar. The point is clarity in naming in these entities, it makes zero sense why we don't do the same in programming. >Writing a paragraph kills any formatting in vi/vim. You know this might be a really different chain of thought that goes against the grain... But maybe due to this lack of formatting in vi/vim makes vi/vim an extremely bad editor for programming? Seriously, humans are weird (Japan for example still uses fax machines). If it's so bad why do so many people use it? Maybe to look smart or maybe for the same nonsensical irrationality as to why we have to come up with some unreadable but "elegant" name for every programming primitive but at the same time we have to be extremely verbose for ALL other forms of written communication with English. Programmers like to think they're smart and original. Most aren't... they follow the same tropes as every other programmer trying to come up with elegant names for no reason whatsoever and strangely unable to see the purposelessness behind this whole naming thing. If you can't come up with a good "name" for it, make the name an entire sentence, it's that simple... it's the reason why sentences exist.
- spion 6y agoThey are in fact bleeding. Clear writing is about structure, not verbosity or repetition. Concise-and-clear is preferred over verbose-and-clear.
- Geminidog 6y ago>They are in fact bleeding. >Clear writing is about structure, not verbosity or repetition. Concise-and-clear is preferred over verbose-and-clear. Except this is where the contradiction lies. In both well written literature and great text books... clarity trumps all even when conciseness is sacrificed. English is one of the most verbose languages out there. I can take your sentence and make it concise: >My eye bleed. >Writing about struct. No verbose or repeat. Short n' Clear beter den wordy n' Clear. Is that better? Your misguided logic paints my concise version of your comment as "preferred" even though it has the exact same clarity. The stark reality is, for purely human reasons, people prefer the former example over the later and there is no real rationality behind it. Try to think a bit outside of the box here. You share the biased and delusional opinion of a typical average programmer. The real logic is, that the conciseness or verbosity is inconsequential. Our human nature allows us to prefer contradictory approaches in code vs. english because verbosity and conciseness doesn't actually matter that much. Clarity is king by a long shot hence the reason why most humans prefer reading literature over code. My code displays the ultimate clarity. You insultingly claim that your eyes may be bleeding, but I guarantee you that unless you're mentally deficient, no part of my code was unclear. It was 100% obvious and crystal clear what my intentions are. The best part is, you only need to read it one time. When is the last time in your life you've read a similar snippet of unfamiliar production code at first glance and left with the exact same level of clarity? Most similar production code needs a good number of guesses and hypothesis and a couple of reads and code following to develop the same level of clarity and confidence of understanding that my code can produce on a SINGLE reading. I would wager we can agree on that point and if your claim otherwise I would wager that you are lying.
- amatecha 6y agoYeah, I don't need conciseness or brevity. The processor or the network connection needs conciseness. Programmers need specificity and clarity. Verbosity is fine too, IMO :)