@kazitor said in When the reviewer doesn't understand my Javascript it's his fault:
@gleemonk said in When the reviewer doesn't understand my Javascript it's his fault:
Well no, I made the timeout really long, see here? 1.5 seconds!
Problem solved
I'm ashamed to have to admit that just today I fixed a bug by changing the duration of a sleep from 300ms to 2000ms.
Of course the sleep was in a CUnit-hosted unit test(1)(2) rather than the actual production code, but even so...
(1) The codebase is a festering mess(3) designed by two younger developers who have since left the company for other reasons, loosely supervised by a semi-senior who has also left the company. In concept, at least, it's fairly simple, except that they got hold of C++11 and went hog-wild with it. The code is liberally strewn with async-callback lambdas, and in fact, some of them have other async-callback lambdas inside.
(2) For unknown and unjustifiable reasons, the code in question is C++, but tested using CUnit rather than CPPUnit. The CUnit "FATAL" macros, of course, use longjmp
to bail back to the framework, which is prime UB material in C++, and doubly so because my charming colleagues decided to invoke it in worker threads spawned by the main CUnit thread. (Um. The corresponding setjmp
was called in that main thread, duh.)
(3) In concept, at least, the feature is pretty simple, but they had a major brain-fart, and the code resembles the worst excesses of Brooks's "Second System Effect" even though it's a "First System". The design goal was immensely ambitious, much more so than the product can ever use(4), and the feature is heavily burdened with non-deterministic behaviour because it's a messaging layer based on a messaging layer(5) that includes such gems as an object called "socket" whose behaviour is almost entirely unlike BSD sockets.
(4) I've made liberal use of the turbine-powered code-deletion axe(7) I keep in my other back pocket(6), and it's still overly ambitious. It will be put into the next release of the main software set (which enters feature-freeze at the end of next week), and for the release after that, the code-deletion axe will have been busy again, and the CUnit tests I kludged into determinism today will no longer exist and neither will the module that they test.(8)
(5) I shall not name it, but a common way of writing its name might be paraphrased as "null emqueue". For its target use-case, it's not bad, but my ex-colleagues decided to use it for something almost entirely unreleated to that use-case. But yes, you read that right. A messaging layer based on a messaging layer. I am not joking.
(6) The one that doesn't have the GAU-8 in it, duh.
(7) So much so that there is now a standing joke in the team: "What did Steve do this week?" "He deleted some code."
(8) Yes, I've deleted so much code that one part of the system no longer serves any worthwhile purpose, but it does just enough and the feature-freeze date is just soon enough that it's too late to finish the job.
Sorry. This bundle of code has been causing me ... stress ... and I needed to vent.