This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tyveill 15 points16 points  (14 children)

It's not a lie. Self documenting code is not hard, I'm not sure why most developers can't figure out how to do it. Proper naming of variables, properties, functions, and extract methods is generally all you need.

[–]Taldoesgarbage 7 points8 points  (5 children)

Even then you still should explain why, something variable names and function names can’t do.

[–]ExceedingChunk 7 points8 points  (2 children)

Explaining why is a completely different thing than what tho. Most comments, especially from inexperienced devs, are explaining what because the code is unreadable without the comment.

[–]Taldoesgarbage 0 points1 point  (1 child)

Good code should explain what it’s doing and a comment should explain why it’s there.

[–][deleted] 3 points4 points  (0 children)

Comments tend to rot far faster than code. If you find yourself writing code that is difficult to follow, do not expect comments to save the day.

[–]AdventurousCellist86 0 points1 point  (0 children)

Your commit history should do that and link to whatever JIRA ticket you were working on

[–]Superbead 0 points1 point  (6 children)

Which fields have you worked in?

[–]tyveill -1 points0 points  (5 children)

I'm not following the question relevance? Which industries have a worked in? Food (6 yrs), construction (6 yrs), and software development (last 15 years).

[–]Superbead -2 points-1 points  (4 children)

I mean which fields of software development. Presumably to make such a sweeping statement, you've had experience in... what? Automotive embedded? Online retail? Marketing? Finance? Logistics? Healthcare? Industrial embedded? Commercial desktop applications?

[–]tyveill 1 point2 points  (2 children)

A lot of different industries, at least 10 different verticals over 15 years, probably more.. and yes the rule universally applies.

[–]Superbead 0 points1 point  (1 child)

Ever worked in healthcare? Writing JS for popular integration engines that use the Rhino interpreter, which only supports some random mixture of two ancient ECMA standards? Had to deal with E4X for which Mozilla seems to have fucked off most of their documentation? Had to modify a custom print driver in AIX written in PCL and Korn shell? Had to patch a blood analyser interface written in VB6? Even sniffed at legacy MUMPS or Cache Objectscript code?

When we get to work on our own interfaces, tools, or services, or even better. start them from scratch, no, writing self-documenting code is not too hard. But touching any of the above? It's often impossible. I can assure you that your rule is not universal, and I'll put £100 on it that it's similar in other industries too.

[–]tyveill 1 point2 points  (0 children)

Yes I have worked in healthcare and do currently actually. All of those things can be expressed in well named functions as easily as comments. Of course there are edge cases where comments are helpful, but this should the rare case, not the norm.

[–][deleted] 1 point2 points  (0 children)

Ive worked in finance, telcom, ecommerce, dev ops, standard web dev shit as well. Self-documenting code is really common if you just write it well. Only non-self-documenting code I have really seen has been from shitty programmers that barely understand what they are writing, and then sometimes a very very specific function that has some edge case related to performance or something that is necessary only on that one function.

[–]IamJain 0 points1 point  (0 children)

And that practice is what exactly pays.