6 ms·
Doesn't look too bad to be honest, considering when it was written. There are some oddities like the functions "returnTrue" and "returnFalse". Other than that,
by RedShift1 6y ago
Doesn't look too bad to be honest, considering when it was written. There are some oddities like the functions "returnTrue" and "returnFalse". Other than that, don't fix what ain't broken?
- keanebean86 6y agoI wonder if stuff like this is taught in India schools? I work with multiple India devs and they do this all the time. Our code has stuff like below that drives me nuts. public static boolean TRUE = true; I've directly asked if they think TRUE will some day need to be set to false but they just ignore me.
- durnygbur 6y ago> TRUE will some day need to be set to false It will happen one day, it will go into production, and the app will work surprisingly well with some subtle glitches. After revealing all contractor devs will make poker face and things will continue as before.
- patrickthebold 6y agoOne time we had a big launch of an important feature (for one noisy customer), we ended up with like 4 feature flags that we needed to flip once it was time to go live. Anyway the big day comes, we turn it on, everything looks good, everyone is happy. A few weeks later I noticed we forgot to turn one of the flags on. So I asked a teammate what he thought. He shrugged, we figured it would be slightly better to turn it on.
- rocknor 6y ago"They do this all the time"? The ignorance of generalizing a large country with a big population is astonishing. The problem is your employer paying peanuts as developer salaries. You'd get the same bad code if you paid peanuts to hire shitty developers in the US or EU.
- keanebean86 6y agoSo now you generalize that these devs are terrible? They do this one thing I don't like. That doesn't say anything about the quality of their work overall.
- rocknor 6y agoYes. If you hire someone for an excessively cheap rate, it is likely that they might not perform well. For example, assume the salary of a graduate salary in bay area is $100K. You can usually hire an equally skilled graduate in India at like 1/5th price. But if you instead hire ones that are OK with 1/10 or less, you are just asking for trouble. India has a surplus of engineering graduates, even people who have no business studying engineering get an engineering degree (because let's face it, not everyone is interested in STEM) - so they perform badly as expected. But that shouldn't discount the good ones (even if 10% are good, in absolute terms that's still a big number because of the population).
- jakub_g 6y agoDeclaring functions like 'returnTrue' was a way to prevent memory leak in old IE (~IE6/IE7) (instead of creating a new inline function each time a method is called). It was especially important when a function is a closure and has a ton of variables visible in outer scope (in particular, refs to DOM nodes) and is called many times. Otherwise you end up with circular references between the objects and nothing can be garbage collected (GC implementation in old IE was very bad).
- petepete 6y agoI remember replacing some functions like this in a codebase I used to work on about twenty years ago. The senior dev at the time had to add them back a day or two later whe the site totally broke for IE users after a couple of minutes. Fun times.
- bryanrasmussen 6y agoI hope he added in a comment /* don't remove or refactor this, IE6 will break */
- uncledave 6y agoOh god there’s so much of that I’ve written over the years. It’s still in there now. Fortunately minification eats my shame publicly. Think the worst one was we had some code that would add a pad in somewhere after the page was rendered that would cause IE6 to redraw the page correctly.