4 ms·
I agree. I have to really fight people when I try to write robust software. "Why are you writing a proper parser when a hacky regex that I thought about for 2 s
by IshKebab 3y ago
I agree. I have to really fight people when I try to write robust software. "Why are you writing a proper parser when a hacky regex that I thought about for 2 seconds worked the one time I tested it? You're wasting time."
They don't understand that I'm not wasting time, I'm just choosing to spend a little bit of time earlier, because I don't like spending a lot of time later when debugging why everything broke.
- datavirtue 3y agoSame here. I stopped suggesting robustness because no one cares.
- ilyt 3y agoI just include writing robust code in my estimates and don't tell anyone. Shoddy code only happens in "the production is on actual fire, not manager-imagined fire" fixes and not for long.
- sempron64 3y agoThe problem with a careful but non-methodical approach is that it requires the programmer to correctly determine the stability value of their design. We often overestimate the importance of architecture on stability, or worse, architect something that is harder to maintain than the naive solution. With buggy ship-it-now software you have a known bounded risk - bugs will occur in some cases but the software will ship and the bugs can be fixed because it’s simple. With prematurely architected software the risk is unbounded - the project may get bogged down indefinitely in its own complexity without shipping. The inverse extreme can also be a problem, of course A project that is maintained for a long time on the naive implementation will also become unmaintainable. However, this will be due to _known_ architecture problems encountered during maintenance. These problems can be addressed in a relatively bounded amount of time. They are also quantifiable and thus explainable to management.
- im_down_w_otp 3y agoThe specific case of building a proper parser doesn't take that much longer if you know what you're doing, and it also enables lots of wonderful quality of life features for end users through additional opportunities for automation and contextualization that can be surfaced. Though, given the constant incentive to never learn how to write a proper parser does mean that practically nobody knows how to do it, and so it will always look & feel like an unbounded science project, and thus rarely done. Infinitely recursive MVP'ing is a race to the bottom.
- sempron64 3y agoParticularly regarding parsing: Here's an excerpt from an interview with Anders Hjelsberg I heard recently. He's the creator of the Turbo Pascal compiler and later on of the creators of C#. https://www.aarthiandsriram.com/p/our-dream-conversation-anders-hejlsberg https://www.aarthiandsriram.com/p/our-dream-conversation-and... ``` Turbo Pascal 2 and Hash Tables Sriram: I think there is some, we're going to talk later about things like GitHub co-pilot, we're dealing with different kinds of code reuse, but I do think there's a little bit of romance in the, for example, I idol you and folks like John Carmack. John Carmack noodling away and trying to make sure every instruction and memory access is aligned on some cash line. The amazing thing is, even today, if you look at AI at the heart of it, you have matrix multiplication and doing things with floating point numbers. Some of these things really tend to matter, which on the theme of optimization, tell us a story of Turbo Pascal 2 and you discovering hash tables because it's legendary. Anders: [laughs] It is a funny story. You have to remember here that I am self-taught in the art of writing compilers. Now, I have since discovered and read a lot of the literature, but at the time, I was just coding away and doing it the best way I knew how. When you create a compiler, one of the things you have to create is simple tables, or they're not necessarily tables. They could be linked list, they could be whatever, but you have to look up names. When you're trying to compile a code that tries to assign one to X, well, you have to figure out where is X? What memory address have I associated with X? You have to look it up the declaration of X. In Turbo Pascal 1.0, the first version of Turbo Pascal, all of the variable declarations were just kept on a linked list because that much I knew, but of course, searching linked lists is not particularly efficient when they get large. For really large functions, that would just take an awfully long time. Then, well, maybe you could try first go by first letter, and then have 26 linked lists or whatever, and that could help a little bit. Then I remember reading the literature about these things called hash tables actually in this book by Niklaus Wirth, Algorithms +, what is it? Yes, Algorithms + Data Structures = Programs. A great book. He explains hash tables and I go, "Oh my God, that's amazing. I got to go try this." I went and implemented it and boom, the compiler went twice as fast. There's Turbo Pascal version 2.0. [laughter] Aarthi: Awesome. Anders: There's a good reason to sell upgrades. ``` Do you really need a proper parser to sell 1.0? A literal compiler project did not fail due to the lack of a "proper" parser (though it can be argued that the lookup table is after the parsing stage; obviously there was not a strong distinction in the Turbo Pascal implementation between tokenization and compilation).
- yodsanklai 3y agoNowadays, I'm maximizing my salary, and the way to do that is please management by shipping features. There's no incentive to add tests or refactor code, and I'm not going to win this battle. That being said, over the years I've learned to appreciate the point for shipping fast. Sometimes it's the right thing to do, it's always a tradeoff.