10 ms·
OK... I usually don't involve myself in drama, but I looked at the code: https://github.com/harthur/replace/blob/master/replace.js https://github.com/harthur/re
by chubot 14y ago
OK... I usually don't involve myself in drama, but I looked at the code: https://github.com/harthur/replace/blob/master/replace.js https://github.com/harthur/replace/blob/master/replace.js
Out of all the code could say "eyes bleeding" that doesn't even come close? Only thing that stands out is the naming of "replacize".
I can understand if you hate JavaScript syntax and love sed, but I fail to see why anyone would pick on this out of all the other code out there. There's no shortage of crappy code in the world! (not that you should make fun of any of it on twitter)
- dmix 14y agoThis may have to do with rubyist who have a distaste for Node (and Javascript) in general (which is actually quite common) more than the JS itself.
- codewright 14y agoI'm a Pythonista that loves JavaScript and thinks Node.js is a waste of effort on the part of humanity.
- jmspring 14y agoI'm mostly ambivalent. Node, to me, feels like an attempt to bring twisted to server side JS.
- fourstar 14y agoHow much have you used it?
- scriptproof 14y agoI fear that few programmers understand the perspectives brought by Node and JS.
- codewright 14y agoNode.js didn't bring anything new to the table. We've had event loops and non-blocking code for almost half a century. Don't lump JS into this.
- nkohari 14y agoHyperbolic much?
- bodegajed 14y agoThat's an unfair presumption. That's just a coming from a few twitter users and it doesn't really represent the whole rubyist community.
- GraemeLion 14y agoI've found the whole rubyist community to be somewhat hateful towards any other languages. It makes it hard to want to use the language when the suggestions I get on my "gems" are "that's not ruby-enough of a name" or "You need to break out of your python mode, your name isn't clever enough" :P
- kyro 14y agoBecause acting like a childish asshole is how you maintain your web presence in the startup world.
- gruseom 14y agoI must stick up for "replacize"! I think it's the very best thing in the script. Yes, "replace" is better English, but that would make "replaceFile" misleading — it's not the file that's being replaced at all, but regex matches within the file. To get clarity you'd need something like "replaceMatchesInFile", and that is quite a bit longer. Moreover, it's generic. When your program has a specific and unique technical concept, it's better to give that concept a specific and unique name and use that name consistently everywhere. (Best of all is when the name is lexically unique so you can grep it to obtain every single instance of the concept in your program. That property is so valuable that it deserves to have an essay written about it.) Generic English words are not always an advantage in code. As a program grows, they're likely to appear in more and more (unrelated) places, which makes them less and less valuable for conveying the program's key semantics. "Replacize" is one of a zillion ways to get the desired effect, but it does it well and with style, and I like it. More than that, it's the one thing in the script that gives it conceptual unity. If you highlight "replacize" in your browser and jump between the various occurrences, the structure of the program immediately leaps out. This kind of terminological pidgin, unique to a given program, can be very helpful in making code clear without making it verbose. The trick is to make sure that each such term has exactly one well-defined meaning and that it's used consistently everywhere that it applies. Eric Evans has called this the "ubiquitous language" of a program. The current script is tiny, of course, but if I see a programmer taking that degree of care with their writing anywhere, it's a stroke in their favor. The thing in there that makes my eyes water, if not bleed, is the unfortunate duplication between the async and sync versions of the logic. But that is hardly the script's fault. It would have to be rectified at the level of the language and/or platform; little can be done about it in a program like this. Error handling too.
- Domenic_S 14y agoI'm going to tread as carefully as I can into this hornet's nest; keep in mind I'm not defending anyone: I think the 'eyes bleeding'-type comments come from the author's rewriting sed in javascript. It seems almost like an exercise designed to provoke: rewriting one of the cornerstone nix utils (loved by many nerds everywhere) into a node.js package (despised by many nerds everywhere). Like any good conversation starter, replace.js comes with a bit of incorrect information: It's similar to sed but there are a few differences: 1. Modifies files when matches are found Easy enough to do with sed: -i 2. Recursive search on directories with -r find . -exec sed [...] does the same. -- In my estimation, that's the reason for the vitriol. I am intentionally leaving out any analysis on the morality of the reactions to it, but the above should explain why some reactions were less than great. It wasn't about the code itself.
- barrkel 14y agoNo, that's not enough for vitriol; there has to be an emotional drive. If this code was written for you, and you were offended by the over-engineering, then you might feel slighted for being ripped off. But that's not the case here. The reason these people were sneering was because the code was written in Javascript, running on Node.js, and Node.js is perceived to be a threat to their own community, Ruby on Rails. They mock and belittle what they fear so they can feel better.
- tlear 14y agoThe crazyness of it all is that comparing Node to RoR is like comparing C++ to Cocoa it is just nuts and I do not get why people get up all in arms about it. I like and use both.
- calibraxis 14y ago> rewriting one of the cornerstone nix utils (loved by many nerds everywhere) But also hated by some nerds. I don't like to bring up my critiques of unix, because people seem conditioned to love it and couldn't do much about it anyway. People ignore (or get defensive about) things they feel they can't change. But there's lots of Unix-Haters out there. Kinda like Fight Club, except slightly more gender-inclusive. "Remember this. The people you're trying to dismiss, we're everyone you depend on. We're the people who write your embedded devices which cook your food. We make your toy Scheme implementations. We're monitoring your systems while you're asleep. Our systems route the ambulances. Our Erlang processes direct your call. We are Googlers and Facebook coders and we know everything about you. We process your insurance claims and credit card charges. We control every part of your life. So don't condescendingly quote man pages at us." (http://homes.cs.washington.edu/~weise/unix-haters.html http://homes.cs.washington.edu/~weise/unix-haters.html)
- asveikau 14y agoHmm, reading it I think I see where criticism comes from; my impression is that I, personally, will most likely stick to sed, grep, sh, etc. But does that make the author a bad person? Worthy of ridicule for having thrown it online? Of course not. This is just a silly script, of the variety that most of us probably have sitting around in somewhere $HOME. It's not worth getting worked up over. The ultimate irony is, I wonder how the critics would feel about the code of sed and grep. Have they bothered to look? I myself do have these loud, exaggerated, critical attitudes towards code quality, but at some point I realized that most of the code I rely on every day is probably not up to my standards, and yet I still willingly rely on it. A younger self might have been tempted to re-write all of it, but I only have one lifetime to do such things and I'm already busy as it is. There is a time for rewrites on the basis of code quality, I would advocate for it where it is constructive or even simply satisfying, but at some point you have to admit that many (most?) times you will have to pass on this impulse.
- Nursie 14y agoThis is just a silly script, of the variety that most of us probably have sitting around in somewhere $HOME I have some very silly scripts hanging around. "killname.sh" dates from before I knew 'pkill' was a thing :)
- AlexandrB 14y agoThanks to this reply, I just learned that 'pkill' is a thing! I've generally relied on killall - though it's not available on some platforms AFAIK. To echo the larger point, I've written a bunch of similar scripts in my lifetime.
- asveikau 14y agoFor a long time OS X didn't have `pkill`. I think it's there now with 10.8, but was missing for too many years. I remember the one weird thing was that `killall` used to behave weirdly on commercial Unix. It would ignore its arguments and simply attempt to kill all processes. It's been a long time since I've logged into such a system, but it was then that I got used to typing `pkill`.
- askimto 14y agoLooks reasonable to me.