4 ms·
none of my coworkers use it This sounds like the root of your problem. If you want to do FP, and none of your coworkers want to do FP, then your problem isn't
by stickfigure 8y ago
none of my coworkers use it
This sounds like the root of your problem. If you want to do FP, and none of your coworkers want to do FP, then your problem isn't really the language.
If you're in a Java shop, maybe start by evangelizing FP rather than a totally different language/platform? It's possible to do FP in Java, and (IMO) it ends up pretty reasonable. But it's not the default habit for J Random Java Programmer, so they need training.
- tombert 8y agoSure, but as John Carmack has said, if the compiler allows something, it will end up in the codebase once it gets sufficiently large. I work for a brand-name big company (I won't mention it here but I'll tell you if you email me) that hires incredibly talented engineers that are a lot smarter than me. The codebase I work on is around ~20 million lines of Java, and I've seen stuff in there that is so incredibly gross that a compsci professor would write "see me after class" if you submitted it. Example: I once saw a piece of code doing this: do { // doing stuff } while (false) It took me about 10 minutes of digging into the code to realize that the person who wrote this was doing this so that they could add a `break` in there as sort of a makeshift `goto` so they could early-exit and skip all the rest of the stuff in the block. Needless to say, I was horrified. Why is it that incredibly talented engineers are writing awful code like that? It's certainly not incompetence; what almost certainly happened was that there was some kind of time-crunch, and the dev (understandably) felt the need to cheat. This is a direct consequence of the compiler allowing a bad design.
- Const-me 8y agoThat loop is totally fine. I wrote it many times in C#, C and C++, and I saw it many more times in other people’s code. Microsoft DDK sample: https://github.com/Microsoft/Windows-driver-samples/blob/master/avstream/samplemft0/Mft0.cpp https://github.com/Microsoft/Windows-driver-samples/blob/mas... Microsoft MediaFoundation sample: https://github.com/Microsoft/Windows-classic-samples/blob/master/Samples/DX11VideoRenderer/cpp/MediaSink.cpp https://github.com/Microsoft/Windows-classic-samples/blob/ma... OpenSSL: https://github.com/openssl/openssl/blob/master/crypto/sha/sha256.c https://github.com/openssl/openssl/blob/master/crypto/sha/sh... And many others. Just because code looks unfamiliar doesn’t mean it’s something wrong with the code.