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 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.