What's the worst coding practices you have seen(or done!)?

View other answers to this thread

Learn Something New Everyday,
Connect With The Best Developers!

Sign Up Now!

& 500k+ others use Hashnode actively.

Ehsan Fazeli's photo

I wrote a module couple of months ago that was the literal meaning of overhead.

We have a support center and it's running by a handful of trusted, experienced supporters that work with our platform and resolve the issues created by customers. The task was pretty straightforward, disable the skip button for one hour when an operator skips more than three issues.

What I did was to create an entity to store logs of when an operator has exceeded their skip threshold, cache the prohibition timestamp, create a job on queue and set its delay to one hour, create a worker to listen to the queue, create an endpoint to respond to the client current timestamp of the server, a boolean containing that he/she is prohibited or not, the future timestamp that their penalty would be dismissed and an interval that evaluates every single second to increment the time retrieved from server and compare it to the threshold to inform the user whenever they can skip the issues again.

All of which could be done with a simple local storage variable containing these simple info to handle it completely on client-side. I'm wondering why the hell I chose the first approach. Maybe I was bored at work at the moment. :D

Want to read more?

Browse featured discussions

Β© 2020 Β·Β Hashnode