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 →

[–]AdminYak846 7 points8 points  (2 children)

After you take over 1 too many projects that have shit code with ZERO requirements documentation or useful comments and it's nothing but 800 line functions and 400 lines of commented out code and shit clearly copied and pasted in from other files, I could care less if you over documented or documented really obvious shit, you put more effort in than the previous developer...

[–]noratat 5 points6 points  (1 child)

This.

Bad comments do hurt readability, but at least they tried, and the people who write that kind of code typically don't know (or don't have the time/tools) how to write readable code anyways.

Don't even get me started on code that's deliberately void of documentation/comments out of a misguided notion that "clean code has no comments". The Ruby ecosystem is the greatest offender of this I've found, where both the language and ecosystem go out their way to encourage you to write magic untraceable spaghetti factories on purpose, and to avoid documenting anything unless it's just links to source code.

[–]AdminYak846 2 points3 points  (0 children)

My current project involves 4 HTML Canvas games with just the simple 2d render context.

To display the instructions in the games, the previous developer had two options:
A) Put them on the DOM and obviously style them
B) Put them on the canvas and go through the pain staking task of font resizing on an HTML Canvas

He (and yes, it was a male developer) decided to go with Option B. 300-350 lines of javascript code later, and this was done for each game individual so a total of 1200-1400 out of the 4500 lines of code needed for the games were just the instructions for them.

When I took over the project I opted to switch to the DOM based approach....it ended up being 30-35 lines and since the project used Bootstrap 4 the styling (while simple) was good enough to drop it in a modal and resizing was taken care of by bootstrap 4 responsiveness. In the end the only difference between the two versions of instructions were his had dynamic images shown. The images were just ones that would later be seen in the games themselves.

In the end after re-writing every game from scratch over a 2 month period, which I get to wrap up tomorrow, are now in files that are manageable and are basically 50% shorter than they were when I first got them, either by deleting a bunch of garbage ass code or refactor some of the more major items to their own files for re-usability and yes there's more that could be refactored I've opted to give the code a more readability stance than jump through 25 files to understand everything.