1. 1

    For the same reason “military grade” isn’t a compliment except among marketers.

    People always use the truism “You get what you pay for” without understanding it: If you pay for absolute shit, you get it, regardless of how much it cost. Price and quality are at least loosely correlated in some industries, but software isn’t one of them and it never has been.

    1. -1

      These are bizarre, even if they’re from 2005.

      His windowing example shows that he had never seen a window manager like XMonad or RatPoison. It’s trivial to make a window manager enforce uncrossable or always-on-top windows, block movement when someone tries to drag across another window. Can Windows really not do that? There’s a ton of them for the Mac.

      Setup and teardown scripts follow a programmed order in Unices, Mac, and Linux. I actually don’t know how to do it on anything but init-based systems: /etc/init.d, rc0.d, and rc6.d execute their contents in ASCII order, but I’m sure there’s an equivalent for launchd and systemd, I just haven’t needed to read a man page yet.

      Named pipes and quota let you solve the multi-user file problem. There’s no such thing as “exclusive mode” in a real OS.

      File association stealing can be annoying, but only the last program launched would win, so they wouldn’t “fight”.

      Is this what Windows is like? I’ve never really used it (had to run VisualAge and Eclipse on it at work for a while), but it sounds like DOS never died.

      The blog links all worked for me, but the MSDN links didn’t.

      1. 9

        I don’t think there was anything bizarre to his article. Windows tasks can be started or stopped in a given order too, but there’s still the issue of badly written services which try anyway to be the last or first to do something, and I’m sure there would be similar examples on Linux.

        For file associations it seems you missed the end of the article where he gave an example of the issue, which again could apply to other operating systems.

        1. 7

          This is a pretty uncharitable reading of the post (which is a pretty classic one from a pretty classic blog).

          His windowing example shows that he had never seen a window manager like XMonad or RatPoison.

          Pretty sure the Windows team, even in 2005, had people who’d seen lots of different window manager approaches. Don’t assume ignorance on their part.

          It’s trivial to make a window manager enforce

          And this is where you misunderstand what the post is about. It’s not about Windows having or lacking some feature. It’s about companies that build Windows applications wanting, and going to great lengths to try to implement, hostile, nonsensical, and literally logically impossible things.

          Your preferred approach seems to be to have the window manager tell the programmer they can’t do what they asked for. Which works up until the moment the programmer decides to hack around the window manager’s prohibition, which is why people are bringing up hypotheticals like an app editing the user’s window manager config in order to specially privilege itself over other windows. And the point of the post is to walk through the thought exercise of “if there were a feature that did this” – where “this” means full-screen, always on top, and no other application’s window can be visible – “what would happen if two applications each tried to use that feature simultaneously”. This is a reductio ad absurdum to show why such a feature could not exist.

          Also, trying to get around it by saying you’d just have your tiling WM split the screen between the two windows wouldn’t actually get around it, because then the app author would come back with “no, that’s not what I meant, I meant really full screen and no other application is allowed to be visible while mine is open”. You can say that’s hostile to the user, and it is, but the app authors (or, rather, their employers) are still going to try any way they can think of to make it happen.

          1. 5

            His windowing example shows that he had never seen a window manager like XMonad or RatPoison. It’s trivial to make a window manager enforce uncrossable or always-on-top windows, block movement when someone tries to drag across another window. Can Windows really not do that? There’s a ton of them for the Mac.

            I wouldn’t call this trivial at all: What if I have an always-on-top window in full-screen mode, and another full-screen always-on-top window gets opened? With tiling WMs you might be able to justify them just splitting the fullscreen among them, but for non-tiling WMs there’s no reasonable solution, unless you’re fine with the WM moving and resizing your windows, which I’m not.

            1. 0

              That’s what a WM is for, yes. If you’ve set a window to be uncrossable, the WM (which is a singleton) is responsible for moving the new one to a non-conflicting space. In a tiler, the existing windows get split or moved.

              1. 7

                If you’ve set a window to be uncrossable

                Okay, so I’ll have my application edit your xmonad config file to ensure that it’s always on top. In case another application goes in and edits the xmonad config file after me, I’ll have my app run a timer in the background to check and ensure it still has top priority in the WM config.

                1. 4

                  You puny app will do no such thing on my immutable, password-protected xmonad.hs

                  (app installs keylogger to sniff password and edits xmonad.hs)

                  Oh yeah? Try to get your app to put my finger on the finger print reader to edit xmonad.hs

                  (app does just that by hooking itself into a commonly used fingerprint-protected command)

                  …etc.

                  The end result looks rather like Core War(s) [1]…

                  [1] https://corewars.org/

                2. 7

                  No user knows what a WM is. No user knows what a tiling WM is. Even if they knew, no user should have to configure a third program to resolve a conflict between two programs.

                  Raymond Chen is talking about end-user experience and you are talking about interfaces that only a small subculture (even within the userbase of Linux on the Desktop) uses.

                  1. 3

                    Enough users do know what window managers are to make a bunch of alternatives available on Mac, UNIX, and Linux (and aside, I find it a little offensive to be called a Linux user; I’m a UNIX user, and now Mac because it’s the last UNIX workstation).

                    But every desktop computer ships with a WM, whether the user has configured it themselves or not. And most of those can manage some kind of always-on-top and blocking behavior, even if it’s not exposed by default; a program can ask for it. Chen’s argument is that you can’t even do this, which is false or indicates severely crippled behavior in Windows.

                    Condescending to users as if they’re stupid is why they avoid learning anything, and why they loathe technical people.

                    1. 1

                      What alternative window managers are available for macOS?

                    2. 2

                      Even if they knew, no user should have to configure a third program to resolve a conflict between two programs.

                      You’re not configuring a ‘third program’, you’re telling the system, in an appropriate place, to act in a certain way. The WM is more these days part of the system. It might be implemented as a separate program but I don’t think anyone actually sees it that way except for some arch linux alumni.

                      1. 0

                        The distinction between system and program does not matter to me. I care about the fact that I need to configure anything at all to work around broken interaction between two parties.

                        1. 1

                          The distinction between system and program does not matter to me.

                          Even if they knew, no user should have to configure a third program to resolve a conflict between two programs.

                          It very clearly does because you explicitly called out configuring ‘a third program’.

                          I care about the fact that I need to configure anything at all to work around broken interaction between two parties.

                          Is it broken interaction? If one program signals an error, an always-on-top messagebox is displayed. If another program then signals an error, do you choose to display that second error? How should those messages interact?

                          The conflict is innate to the nature of having an ‘always on top’ option. The idea that something as fundamental as that should be removed just because it adds a form of conflict that already exists is ludicrous. Let’s not even mention the fact that you, as a user, would not have to configure anything anyway, because there exists a sane default. This is like saying “I should not have to configure my car seat position to match me, it should just work”, and then arguing that the car seat should be removed because it’s configurable.

                    3. 3

                      So how do I make my program run under a wm that supports this behavior? Should I bundle a wm in my program and kill the currently running one at startup?

                  2. 5

                    File association stealing can be annoying, but only the last program launched would win, so they wouldn’t “fight”.

                    I suspect both programs are running at the same time, with both running loops to check+change file associations.

                    It’s trivial to make a window manager enforce uncrossable or always-on-top windows

                    What’s possible and what are good options are not the same thing.

                    suspect he is describing a situation where the application devs don’t like that everyone can access the ‘always on top’ feature, so they want something even higher again to make sure they are the only ones ontop. This brings up both philosophical and practical problems.

                    1. 0

                      Chen describes two programs running timers, apparently pretty fast, reassigning filetypes without user permission. I don’t actually believe anyone would waste main loop time doing that, he may have seen a contrived demo or more likely made it up for the example.

                      The behavior defies the law of programmer laziness.

                      So a realistic scenario is just checking on startup or hitting a button in preferences, and that’s a trivial annoyance. Firefox used to be a prime offender there, and it just whined at me every startup.

                      1. 9

                        The behavior defies the law of programmer laziness.

                        This law does not exist in software developed by companies.

                        more likely made it up for the example.

                        Your perspective is the one of a Linux user, and Linux on the Desktop has both a very small marketshare and its own development culture around GUI programs. Just keep that in mind before you assert that the author is lying because his world seems alien to you.

                        1. 8

                          Raymond has seen a lot of things in real life that you wouldn’t believe, then. Read the blog entries on his Windows backward compatibility work.

                          1. 4

                            He’s seen things you people wouldn’t believe. COM files in DOS boxes running critical code. OS memory management driven by bugs in SimCity. A20 gates on fire off the shoulder… OK, not that, probably, but don’t underestimate the Windows Crazification Factor and the full scope of petty venality in writing closed-source software. BonziBuddy existed, after all.

                            1. 2

                              The behavior defies the law of programmer laziness.

                              Laziness can easily be overcome by offering money in exchange for goods and services.

                          2. 3

                            He’s answering developers questions. Imagine a music player developer asking for a way to set the flag on their window, without user interaction, or a virus scanner program that wants to set itself as the last program running.

                            All of these things are not hard if you force the user to configure them, but what happens when the user says no?

                          1. 6

                            My one disagreement with how this article is written is that it presents the complexity as being part of Unicode, as if Unicode could have been simpler and saved us all the trouble. The fact is, Unicode is merely representing reality: It could have been simpler, but there’s some irreducible complexity here because of how real-world natural languages work, and Unicode can’t do away with that while still allowing speakers of those languages to have text which works the way they’re accustomed to.

                            1. 3

                              (I am the author of the article)

                              There is some truth in your argument, but also something I want to disagree with.

                              I think there have been several significant issues over the history of Unicode’s design and development, and one of them was its initial Eurocentrism. The complexity in Unicode tends to grow the further you get from Western European scripts and the assumptions that are valid for those scripts.

                              For example: some of the assumptions Unicode makes about case, and which require special handling to work around, come from the fact that the early design of Unicode didn’t look enough beyond Western Europe. Even just digging more deeply into Greek or the Turkic languages would have exposed the trouble with Unicode’s early assumptions about case.

                              So I think at least some of the complexity in Unicode could have been avoided, or at the very least mitigated, with a less Eurocentric initial approach.

                              1. 2
                              1. 16

                                It’s strongly typed, with a bewildering variety of types to keep straight. More errors.

                                As someone who occasionally programs Haskell, I would not even dare to call C a Strongly Typed language. Moreover: The abstractions I learned because of Haskell, have substantially improved the readability and maintainability of the C-code I write, although I have to admit that not all abstractions are useful.

                                Code is scattered in a vast heirarchy of files. You can’t find a definition unless you already know where it is.

                                I usually fix this with a run of Doxygen.

                                It’s nice to have seen this and I agree that this article should make use think about how dirty our code often is, but I am missing a real conclusion here.

                                1. 10

                                  C isn’t strongly-typed, but it is wrongly-typed for application programming. The types encode the wrong things unless you’re writing an OS and “an unsigned integral value of this many bits” is all of the semantics most of your data can ever have.

                                  For applications, most semantics don’t have anything to do with size of the data in bits. Semantics are things like “height of person” or “width of page” or something you can track back to the physical world, or, maybe, something like “course prerequisite” which isn’t physical per se but still has an existence outside of the program you’re writing. Representations of those types, like “is this height in inches or centimeters”, are important, sure, but they’re also a distraction from the code’s logic, and something computers can handle better by way of very disciplined auto-conversion, auto-conversions which preserve all relevant semantics. Ideally, the programmer would only work in heights and weights, for example, and the computer (interpreter runtime, compiled code… ) would silently and efficiently shift representations between units of measure, numeric types and strings, and integers and floats. Scheme has had a numeric tower concept for decades now, which does some of this, but that’s only one piece of the puzzle here.

                                  Some domains require programmers to think hard about machine-level details. OS kernels are one example. Code which pushes the limits of floating-point precision is another. Code which absolutely must meet very tight performance desiderata is a third example. Those programs will be written in languages like Fortran and C and assembly for a long time to come. However, we got over writing everything in C long ago, and we have many fewer buffer overflows for it.

                                  1. 3

                                    it is wrongly-typed for application programming

                                    Right. That’s because it’s a… drumroll Systems-level programming language. Not an application-level one.

                                    1. 7

                                      And yet a lot of applications got written in it.

                                      1. 3

                                        I don’t think anyone is denying that. Plenty of people, for one reason or another (e.g. maybe it’s all they are familiar with?), end up using the wrong tool(s) for the job.

                                        1. 2

                                          Exactly! It’s not about a specific programming language, but it is about picking the language that makes it easiest to accomplish your goals, without sacrificing a lot of performance.

                                          If we are talking embedded systems, resource intensive, time or performance-intensive problems then C/C++ is often the way to go.

                                          If we are talking about regular desktop applications, then often Java should be the only way (as you’d get all the ARM and other systems for free), or C# if you are confined to MS-like platforms.

                                          If we are talking about complex theoretical problems, use Haskell. For example: I can solve 30% of the first 100 Project Euler questions in just one single line of code, 50% in less than 5 lines of Haskell, and 70% in less than 10. 25 different assignments in a single .hs file is not uncommon.

                                          1. 1

                                            “then C/C++ is often the way to go”

                                            Or Ada or Rust if balancing correctness/safety/security with performance.

                                            1. 1

                                              Or Ada or Rust if balancing correctness/safety/security with performance.

                                              Acutally no. In that case there is absolutely nothing to balance. It’s performance all the way without any compromises and any overhead is unacceptable.

                                              Ada is what you could use in safety critical applications, allthough those are often written in Erlang or C as well.

                                              And sorry, Go and Rust are nice, but I would not build any system on top of those languages yet. They simply have not been around for long enough and they could still disappear in no time because they still are niche languages that are barely used outside of Silicon Valley.

                                              In fact, it’s already hard enough to find python developers as it is. Using Go or Rust would narrow the recuiting pool down to just about a hundred individuals for just about everywhere except for Silicon Valley.

                                              1. 2

                                                You definitely can use Ada in those applications since it’s big in performance- and time-critical applications. It lets you turn the safety off as much as you need. Then, SPARK can get it back on some things without runtime checks.

                                                Far as Rust, that’s true if you want lowest-common denlminator. Jane St’s counter-argument for Ocaml was it lets you recruit higher caliber programmers that might also be more motivated since they get to use better tools. That could apply for Rust.

                                                Whereas, Go is a strange example because it’s designed to be quick to learn for non-programmers and even quicker for programmers. Anyone that learned huge platforms like .NET or Java can pick up Go easily. Same for anyone doing C/C++.

                                                1. 2

                                                  Far as Rust, that’s true if you want lowest-common denlminator. Jane St’s counter-argument for Ocaml was it lets you recruit higher caliber programmers that might also be more motivated since they get to use better tools. That could apply for Rust.

                                                  I’m not convinced that using a specific programming language helps you attract higher quality programmers. That’s something you’ll have to check for during the hiring phase.

                                                  1. 1

                                                    Oh, Im all for collecting evidence of whether the claim is true or false in practice. I just offered it as the other possibility that comes with an unusual language.

                                                2. 1

                                                  In fact, it’s already hard enough to find python developers as it is

                                                  FWIW, I think that’s a “high demand” problem, not a “low supply” problem, based on my experience.

                                    2. 4

                                      Code is scattered in a vast heirarchy of files. You can’t find a definition unless you already know where it is.

                                      I usually fix this with a run of Doxygen

                                      Or cscope, ctags, etc! There are lots of tools for source base navigation.

                                    1. 9

                                      I’m glad somebody wrote this up, because I feel like everybody who works with big data learns these lessons independently (sometimes multiple times within the same organization). If you teach CS, please make your students read this before they graduate.

                                      Understanding these lessons is basically why the office I work at is so much more productive than the rest of the company we’re a part of: there’s been an effort to get incoming devs to understand that, in most cases, it’s faster, cheaper, & easier to use unix shell tools to process large data sets than to use fancy hypebeast toolchains like hadoop.

                                      There are a couple things this essay doesn’t mention that would probably speed up processing substantially. One is using LC_ALL=C – if you force locale to C, no locale processing occurs during piping, which speeds everything up a lot. Another is that if you are using GNU awk, there’s support for running commands and piping to them internally, which means that downloads can actually be done inside AWK and posts can be done there too – which allows you to open multiple input and output streams and switch between them in a single batch, avoiding some merge steps. Also, one might want to use xargs instead of gnu parallel, because xargs is a more mature tool & one that’s available on basically all unix machines out of the box.

                                      1. 4

                                        One thing I found particularly useful about this post (not evident from the title, but constitutes the first half) is specifics about how the Big Data Science Toolchains can fail, in this case Apache Spark, even when the author tried a bunch of the obvious and less-obvious fixes.

                                        The biggest win here seems to be not necessarily the raw processing time due to low-level optimizations in awk, but more big-picture algorithmic wins from “manually” controlling data locality, where Spark didn’t do the right thing automatically, and couldn’t be persuaded to do the right thing less automatically.

                                        1. 3

                                          Have them read “The Treacherous Optimization” which is all about how GNU grep is so fast: grep is important for its own sake, of course, but the point is that these tools have had decades of work poured into them, even the relatively new GNU tools which postdate the Classic Unix codebases.

                                          It’s also an interesting introduction to code optimization and engineering tradeoffs, or tradeoffs where multiple decisions are defensible because none of them are absolutely perfect.

                                          1. 3

                                            Yeah I’ve personally run into exactly this kind of slowness with R (and Python to a lesser extent), and fixed it with shell. I love R but it can be very slow.

                                            That’s part of the reason I’m working on Oil. Shell is still useful and relevant but a lot of people are reluctant to learn it.

                                            I posted this in another thread, but it is good to eyeball your computations with “numbers every programmer should know”:

                                            https://gist.github.com/jboner/2841832

                                            https://people.eecs.berkeley.edu/~rcs/research/interactive_latency.html

                                            In particular most “parsing” is linear time, so my rule is that you want to be within 2x-10x of the hardware’s theoretical speed. With certain tools you will be more in the 100-1000x range, and then it’s time to use a different tool, probably to cut down the data first. Hardware is cheap but waiting for data pipelines costs human time.

                                            1. 4

                                              When I was working in my first lab I did exactly the same – moved an existing computational biology pipeline off of R to AWK, lots of shell plumbing, GNU Parallel, and a Flask front-end server which submitted jobs in GridEngine. Brought runtime down from 40 minutes to about 30 seconds for one genome. R is nice but can be slow (also, it was just a prototype.)

                                              The pivotal lesson I learned was to embrace the battle-tested technologies in the shell stack and everything Unix instead of fantsy-pantsy modern stacks and tools on top of Hadoop, Spark and others. “Someone probably solved your problem in the 80s” from the author rings absolutely true.

                                              Others call it Taco Bell programming.

                                              1. 2

                                                Taco Bell programming is amazing, I’m saddened by the fact that Taco Bell programming has become quite esoteric. I wish this knowledge was more widespread in the industry.

                                            2. 1

                                              You must be very glad. 3 identical comments 😅

                                              1. 1

                                                Just a glitch. My mouse’s debounce doesn’t work properly, and lobste.rs doesn’t properly deduplicate requests, so when I click post it sometimes emits several duplicate requests which the server treats as duplicate comments (even though they come from the same form).

                                                There was a patch applied for this a year ago, but either it didn’t work or it never migrated from the git repo to the live version of the site.

                                            1. 3

                                              I don’t know if encrypting gopher would be a good idea.

                                              In HTTP encryption is made for the purpose of protecting authentication credential and communication privacy, but isn’t this requirement just coming from the fact we abuse HTTP in every possible way?

                                              Gopher is made for showing a publicly available hierarchy of menus and files.

                                              And yes, there’s the privacy concern of the provider/government/whatever snooping on your gopher requests and responses. But if that is a concern, wouldn’t other protocols better suited for private communication?

                                              1. 5

                                                Private by default is a social expectation, not merely a technical one; in short, we encrypt things for the same reason we send almost all mail in envelopes, and we don’t shout our conversations in public spaces.

                                                1. 3

                                                  Heresy! Encrypt all the things!

                                                  (I’m one of those weirdos who’s still not convinced that plain static website content really needs encryption, but I realize the arguments against that idea are many and hold their water pretty well.)

                                                1. 21

                                                  Just a list and no explanation, quite uninteresting.

                                                  1. 8

                                                    Hey, so thanks for the criticism (I think). This is the 4 year old party I was talking about. It’s a fun format of rants in a list. I agree it’s not for everyone. https://spaceninja.com/2015/12/07/falsehoods-programmers-believe/

                                                    1. 8

                                                      I think people have the same problem with every list of this genre: There’s no explanations and no suggestions.

                                                      There are, implicitly, problems to avoid, but even that has limits, in that it assumes the programmer is trying to write the most generally applicable software, possible or otherwise. For example, from “Falsehoods programmers believe about time”: “The system clock will never be set to a time that is in the distant past or the far future”. Depending on the software, and how you define “the distant past or the far future”, you can assume this if you document it as a requirement. Kerberos does precisely this as part of its security model.

                                                      So in treating these things uniformly as “falsehoods” these lists assume that engineering trade-offs don’t exist, or that making such trade-offs is incorrect somehow.

                                                      1. 1

                                                        Well the statement that it will “never be set to a time in the distant past or the far future” is a falsehood. If Kerberos engineers had not considered this then their spec would have a gaping hole in it. So it sounds useful to me. The idea that the statement is carte blanche useless because in one extremely niche scenario you can as a working model assume that the time is not in the distant past or far future is pretty contrived. People will still violate the spec, you’ve just made it a scenario you don’t have to concern yourself with.

                                                        I do think lists of “Falsehoods” are “Brains not included”, you have to use your own mind and knowledge to consider how these scenarios may apply (or not apply), and that doesn’t mean they aren’t useful. For example in this article I noticed at least 3 things in our application that I hadn’t considered. Pretty useful stuff.

                                                        1. 1

                                                          The idea that the statement is carte blanche useless because in one extremely niche scenario you can as a working model assume that the time is not in the distant past or far future is pretty contrived.

                                                          I said the exact opposite: The statement isn’t completely true because of examples like Kerberos, so pretending that it’s necessarily a falsehood is wrong.

                                                          1. 0

                                                            I’m pretty sure you didn’t say the exact opposite, and I don’t even know what that means for this statement. Kerberos does nothing to protect you from getting distant past or future, it just means you are violating the spec by doing so.

                                                      2. 4

                                                        Almost all of the “falsehoods programmers believe” articles share this problem, though: they’re just a long list of stuff labeled “this is wrong”, but with no explanation of why those things are wrong, or what someone should do instead. This makes them extremely unhelpful.

                                                        1. 4

                                                          I strongly disagree that they are unhelpful to everyone, though I do think they are less accessible to beginners. Some of these falsehoods don’t have a thing you can do instead. Some of them don’t have a good explanation as to why it is false. That doesn’t mean it’s not useful to know that it’s a potential pitfall when you hear it. Some of these you will do knowing they are a falsehood because there is no “good option”. In life we don’t always have a clear and obvious best option, but having a heuristic around risks is still useful.

                                                          https://github.com/kdeldycke/awesome-falsehood

                                                          1. 1

                                                            The typical list-of-bullet-points “falsehoods” article, though, doesn’t provide enough information for anyone to decide “this has no good option, I’ll pick the least worst based on tradeoffs”, because it doesn’t say why the things in its list are wrong. If people were doing comparative explanations of why certain assumptions cause problems, and going over the tradeoffs involved, that would be useful. But they’re not: they’re just posting a list of “this is wrong and no, I’m not telling you why or what you could learn about the problem domain to let you make better choices”. Many of them verge on, or simply are, pure self-congratulatory “I know more trivia about this than you do”.

                                                          2. 3

                                                            Well-structured articles of this type imply underlying situations and behaviors by the order in which elements are listed, so that if you’re following the list, you end up with a general understanding of the landscape being described. This one mimics the structure only shallowly, though: you don’t, by reading it, get an understanding of how search is actually used or what kinds of problems you run into (although search is a pretty diverse space & depending on your data set & your user base’s needs, completely different behaviors are appropriate, which makes it a poor fit for this kind of list).

                                                            I’m sort of tempted to write a different version of this list, keeping the “falsehoods programmers believe” format, to illustrate this point. When such a list is well-written, an intelligent reader (even one with no deep knowledge of the subject) ought to require no explanation for each point, because the order of the points has led them to update their mental model incrementally such that each point can be justified based on a generalization of the unstated logic behind the previous points.

                                                            This one doesn’t do that, but instead just sort of skips around. The points that are obvious to people outside of search are things like “users will not expect search to act like google” – in other words, sort-of-cheap-shots about end users that don’t necessarily apply outside general-audience systems & don’t really need to be said in the situations where they do apply. Other points (like “search is not a database”) are deeper & really do need to be said, but probably ought to be contextualized so that they’re understandable.

                                                            1. 1

                                                              Well-structured articles of this type imply underlying situations and behaviors by the order in which elements are listed, so that if you’re following the list, you end up with a general understanding of the landscape being described.

                                                              I’m not sure that I’d agree with that. Or, at least, I’d dispute how many “well-structured articles of this type” are in existence.

                                                              I’m sort of tempted to write a different version of this list, keeping the “falsehoods programmers believe” format, to illustrate this point. When such a list is well-written, an intelligent reader (even one with no deep knowledge of the subject) ought to require no explanation for each point

                                                              This reminds me of “well-written code doesn’t need documentation because it’s self-documenting”. Which is something that’s perhaps true in theory, but which I’ve always found to be false in practice.

                                                              A little while ago I tried taking a different approach to this sort of article, to show what it would look like: the “truths programmers should know” isn’t a list of bullet points, and does go into detail on the problem domain to explain what’s going on and why common assumptions about it might fail. I don’t see why other “falsehoods programmers believe” articles couldn’t be written the same way.

                                                              1. 3

                                                                I’d dispute how many “well-structured articles of this type” are in existence.

                                                                For sure, they’re a rarity. “Falsehoods programmers believe about names” does this, though.

                                                                This reminds me of “well-written code doesn’t need documentation because it’s self-documenting”. Which is something that’s perhaps true in theory, but which I’ve always found to be false in practice.

                                                                I wasn’t going for that take at all.

                                                                Communication isn’t really a matter of conveying meaning by encoding that meaning (since that kind of communication can only express trivial truths), but by creating an environment that constraints somebody’s existing world model in such a way that the only way to process the message produces a change to the model. A teacher isn’t telling a student a sequence of facts, but asking a question in such a way that answering the question requires them to independently reinvent the theory behind the answer, and a good teacher knows how to do this incrementally so that each discovery is low-effort.

                                                                In other words, this kind of article oughtn’t be a literal list of falsehoods so much as a tour through the intellectual space of the subject being described by way of iterative violations of successive models.

                                                                Doing this requires us to begin with an understanding of what the reader already thinks (in the case of names, that one can implement a name form as two input fields that take ascii text, or in the case of time, the idea of newtonian universal time.) Each ‘falsehood’ in the list causes the reader to transform his mental model of an appropriate implementation in a predictable way, and so the order is determined so that it leads the reader from the most obvious model to the most correct model with a minimum of effort on the part of the reader, while still making the reader actually determine both the reasoning & the solution themselves.

                                                                This is a hard thing to do with search, compared to names or time. Everybody with a CS degree was at one point asked to deal with name records in a naive way as part of some class assignment, & everybody except the sentinelese has basically imbibed newtonian time. Relatively few people think even shallowly about search implementations, so there aren’t obvious-but-false starting points that are easily identified: the points OP rejects are actually more nuanced than what J Random Hacker would probably come up with immediately. And, on the other side, there isn’t a maximally-flexible ending point: ultimately, you need completely different kinds of search systems for different types of data & different types of users (something management learned the hard way when they tried to force patents, trademarks, chemical, and scholarly journals to all use the same underlying search engine!)

                                                        2. 4

                                                          That there’s an equal, large number of upvotes for the article and your comment is itself interesting. Does that mean the content was interesting to half with others wanting different style? Or interesting to most of them who then agreed that it could be better after seeing your comment?

                                                          If anything, it reminds me of the old strategy of having high-level points people can optionally drill down into. They expand, link, pop stuff up, whatever. Some people also did two versions of an article: a short one (eg executive summary) and long one (full details).

                                                          1. 5

                                                            Agreed. I’d rather have a list of only five items with a thorough discussion about why this is, than a way too long and boring list that I’m not going to dig through anyway.

                                                            1. 4

                                                              If you find it uninteresting then you possibly aren’t in the step of implementing or pushing against implementing search in your application. This is a healthy sane checklist of things to consider.

                                                              1. 8

                                                                If you’re pushing against search and bring up a “falsehood”, any good project manager would ask “why?” So having an explanation would help a lot.

                                                                1. 1

                                                                  Sure, but this article would be a bajillion pages if they felt obligated to describe every one of these, many of which are obvious on a very small amount of reflection.

                                                                  1. 1

                                                                    Exactly. Just think about it and use your brain, don’t expect everything served on the silver plate. If you wanted this checklist with explanations, it would be at least 200 pages long book.

                                                            1. 14

                                                              Thanks, I feel like a dick, now.

                                                              On a serious note, that hit me right in the feels. I wouldn’t go as far as saying that I am overconfident, but I’m definitely a loudmouth, and tend to argue to exhaustion when I think I’m right.

                                                              I’ve been working for a while in recognizing that I might be wrong and try to clearly communicate that I am open (and in fact, often hoping) to be proven wrong, but it’s a process, and I can’t help but wonder how often have I just been a massive dick and prevented other people from even throwing an idea =(

                                                              1. 8

                                                                I’m almost exactly the opposite. I realize that usually my preferences boil down to: “I like this way because I’m used to it”, or “I don’t think it matters”. I used to be the most experienced C# programmer on my team. My teammates used to ask me questions like “Should I assign a type explicitly or just use ‘var’?” any I would say that that’s a personal preference and it doesn’t really matter. Another programmer with a much more pronounced opinion joined the team, and I noticed that people liked his answers a lot more. Sometimes people just like to be told what to do, especially when the consequences of the choices aren’t so clear.

                                                                1. 5

                                                                  Sometimes people just like to be told what to do, especially when the consequences of the choices aren’t so clear.

                                                                  This, and also cases where the consequences on either side of a tradeoff are so minor, that the energy spent deliberating them out is costlier than just making a call and moving on. I spent far longer learning this, and fixing my behavior, than I wish I had.

                                                                  On so many of these low-impact-low-cost details, where I did not strongly care, where I could expect another senior to reasonably disagree (even just for reasons of “this is what I am used to instead”), I would give teammates a full-depth, longwinded explanation, only to end in an equivocation and let them decide. Maybe one out of a dozen times they learned something, but often I was wasting people’s time when they just wanted a boolean result from the ask_swifthand function.

                                                                  The first step in fixing this was realizing why I always led with longwinded explanations. It turned out to be misapplied empathy (which I assume-by-default that I lack, hence it took a while to realize).

                                                                  I personally value knowing the detailed ins-and-outs wherever possible, and so I saw extending a full explanation to another person as a sign of respect: share all the learning, and help them make their own decision. But when that comes by wasting their time (on a low-impact-low-cost choice), was not being perceived that way.

                                                                  Change was slow. I first changed my explanations to lead with the decision before launching into the explanation, giving a TL;DR to frame their expectation. After some time doing this, I began leading with the decision and then asking “There are reasons I could dive into, but they are subtle and inconsequential. So I’ll leave it there, unless you are curious?” followed by a long, awkward pause while I wait for an answer.

                                                                  Due to some personality quirks that pause is the hardest part for me, but it gets the job done. It balances respecting their time by giving them the option to walk away with my desire to extend a courtesy that I would (personally) value of learning more.

                                                                  Ironically, I do not always extend this sort of preemptive empathy to the rest of my life’s conversations. The last paragraph in the article really hit home, as I know friends and family often feel my SOLH is overconfidence layered with stubbornness.

                                                                  1. 3

                                                                    Sometimes people just like to be told what to do, especially when the consequences of the choices aren’t so clear.

                                                                    Newbies need to be fed opinions because they don’t have enough experience to have any of their own, and the ones they might have at the moment are more likely to be wrong than right. Like, yes, you can write thousand-line subroutines in Python, that’s certainly something the language allows, but more mature opinion will state that writing smaller subroutines is better for reasons of ease of modification a neophyte hasn’t run into yet.

                                                                    Gnomonic pronouncements make things go faster, but once the learner has some experience of their own, pushback is to be expected and should be encouraged. Except with things like styleguides. Those are completely arbitrary and set in stone for precisely that reason.

                                                                    So teachers need to have strong opinions because they can’t go over every single thing when they answer a single question, but those opinions must be held loosely enough that students can successfully challenge them as they gain enough knowledge to exercise their own agency.

                                                                    1. 2

                                                                      This is one thing that’s true: people like to be told what to do. People should be encouraged to think for themselves. The best of both worlds is perhaps by explaining the difference and explaining why you lean the way you do. That way you teach thought and give a straight answer.

                                                                    2. 5

                                                                      tend to argue to exhaustion

                                                                      that doesn’t sound “loosely held” :)

                                                                      1. 1

                                                                        I recently had an argument that went on for an hour until I conceded from frustration. Once we switched from the what to the how they immediately took to my original argument. Loosely held seems like it can be in the eye of the beholder.

                                                                        1. 1

                                                                          Well, for some definition of loosely =P

                                                                        2. 3

                                                                          I am open (and in fact, often hoping) to be proven wrong

                                                                          Say that clearly and directly. Tell the other person that you are not feeling personally attacked and hope to be proven wrong.

                                                                        1. 20

                                                                          This comment really sums the issue up:

                                                                          And as a user, I can tell you that “exciting and engaging” is often done at the expense of “wow, I can actually use this website”. 🙂

                                                                          1. 11

                                                                            Useless comment for me to say this, but I’m cracking up at the italicized emoji in your quote. 😂

                                                                            1. 1

                                                                              who can blame you, it’s exciting and engaging

                                                                            2. 2

                                                                              An “exciting and engaging” website only a few people with bleeding-edge software can use isn’t exciting or engaging to most people, who, get this, aren’t going to be using bleeding-edge software.

                                                                            1. 1

                                                                              This whole article is basically just a strawman. Ignoring that, the simple fact of the matter is firefox and chromium are the only browsers I can reasonably test against as both can be run heedlessly and controlled by something like selenium. The other browsers are either extremely fringe, like palemoon; outdated, also like palemoon; require a specific nonfree os with specific license costs, like IE; or require racks of devices, safari.

                                                                              Anecdotally, for internal use webapps I’ve only ever got complaints from someone using a 4 year out of date chrome and one person who for some reason uses palemoon. I don’t see a reason to include a whole compatibility toolchain like babel or the financial times polyfills for these individuals.

                                                                              Even in customer facing web applications, there are some things that cant be trivially polyfilled. I’ve experienced this with some canvas apis and safari, because safari for some reason lags severely behind firefox and chrome at implementing web standards. It’s not easy for me to test this browser, because as I said above, it requires specific hardware and software licenses that are not “free.”

                                                                              1. 4

                                                                                the simple fact of the matter is firefox and chromium are the only browsers I can reasonably test against as both can be run heedlessly and controlled by something like selenium.

                                                                                There used to exist a SAAS tool (hehe) for testing layouts across multiple browsers. Don’t know if it still exists and if it supports modern js-heavy sites thought.

                                                                                That said, as I pointed out in the post: if you actually test in Firefox it will typically also work in Chrome and other browsers.

                                                                                1. 2

                                                                                  There are several such services, with BrowserStack and Sauce Labs being quite popular.

                                                                                  1. 1

                                                                                    That said, as I pointed out in the post: if you actually test in Firefox it will typically also work in Chrome and other browsers.

                                                                                    the vice versa is usually true as well and firefox has its own quirks that chromium does not support. e.g. select > option onclick handlers, instead of just a select onchange handler.

                                                                                    Firefox isn’t exactly a saint in this regards either and it’s just as easy to build “firefox” apps too.

                                                                                    1. 2

                                                                                      probably correct but for some reason I rarely see that happen in practice.

                                                                                      When was the last time you came across across a website that only worked in Firefox?

                                                                                  2. 4

                                                                                    The simple fact is, competent websites run on any browser because competent websites don’t use weirdo bizarre technologies like ActiveX or whatever the modern equivalent might be. Toy websites might get away with only supporting the specific software setup on the author’s desk, but websites which support people using assistive technologies, people in the Third World, and, most importantly, people trying to give the website owner money will be as accessible as possible, for much the same reason Walmart doesn’t install a ten-foot freeclimb wall in front of their main entrance.

                                                                                  1. 1
                                                                                    1. 12

                                                                                      I have a lot of issues with the idea that asking people to behave professionally (in what is essentially a professional setting) is somehow offensive or autocratic. Threatening to throw toys out of the pram does not reassure me that people have good points.

                                                                                      1. 18

                                                                                        This entire issue has been hijacked by the alt-right/gamergate crowd as another front in their “culture war”.

                                                                                        (Edit, changed “the” to “their” in reference to “culture war”).

                                                                                        1. -1

                                                                                          Except it isn’t just in a professional setting, it’s in every public forum.

                                                                                          It’s also impossible to know what they define to be “professional” because of comments like this:

                                                                                          Threatening to throw toys out of the pram

                                                                                          Bizarre ageist rants which foreclose on the idea that this is even up for discussion, and which assume everyone knows what “acceptable” or “professional” are as if those ideas were cross-cultural (they’re not, of course, and you’d need to be racist to imagine they were) and as if everyone were neurotypical.

                                                                                          1. 7

                                                                                            Ageist, racist and ableist. I got the trifecta!

                                                                                            Bizarre ageist rants

                                                                                            Threatening to retract past contributions, particularly over a perceived abuse of power that hasn’t happened yet is childish behaviour. Spouting ad hominem attacks against people you disagree with qualifies too, and gets you a ‘troll’ downvote.

                                                                                            which assume everyone knows what “acceptable” or “professional” are

                                                                                            This sounds like a very good argument for some sort of document which defines what “acceptable” and “professional” might be. If only the Linux kernel had one.

                                                                                            1. 1

                                                                                              Your inability to defend your arguments means they’re not worth engaging.

                                                                                        1. 8

                                                                                          One argument I like and want to make sharper: you might think you have nothing to hide, but you’re using your definition of “nothing”. Would you let your insurance company know how much junk food you eat?

                                                                                          1. 3

                                                                                            I’m not doing anything wrong now, but I don’t know what you’ll think is wrong next week.

                                                                                            There’s no limit on ex post facto prosecution in the real world.

                                                                                          1. 4

                                                                                            When will people realize that imposing CoC tramples on peoples feelings of moral autonomy?

                                                                                            I want to know, what do CoC proponents think whats causing the backlash?

                                                                                            1. 29

                                                                                              The backlash is caused by some folks wanting to be assholes. A piece of documentation saying ‘respect others’ should not be threatening to anyone.

                                                                                              How can anyone defend the attacks on Linus right now? Him and his family are having threats on their lives over a document asking others to be respectful.

                                                                                              1. 5

                                                                                                So the best argument you could come up against people disagreeing with you is basically the equivalent of “have you stopped beating your spouse yet”?

                                                                                                I think it’s largely a matter of people from the US trying to force their cultural norms onto the rest of the world, and frankly I’m not willing to lower civilizatory standards to accommodate largely US-specific social issues.

                                                                                                There are certainly issues to be solved, but adopting US-style problem-solving approach of “war on bad behavior” will be similarly effective as their “war on drugs” or “war on terrorism”. Thanks, but no thanks, I want to improve things, not make them worse.

                                                                                                1. 4

                                                                                                  I want to be right or at least to say things I believe are correct even if they make me an asshole.

                                                                                                  1. 5

                                                                                                    If you think human conflict is solved the “show the asshole the boot” way, then you probably lack experience, because your opponent will claim that you are the asshole.

                                                                                                    Also, take a step back. Where did i approve of harassing other people? That i approve a thought does not mean that i approve all methods of enforcing or implementing it. That i think stealing is illegal does not mean that i approve of going around and lynching burglars.

                                                                                                    1. 24

                                                                                                      If you think human conflict is solved the “show the asshole the boot” way, then you probably lack experience

                                                                                                      The counter-argument to this is https://en.wikipedia.org/wiki/Paradox_of_tolerance

                                                                                                      1. 24

                                                                                                        If you think human conflict is solved the “show the asshole the boot” way, then you probably lack experience, because your opponent will claim that you are the asshole.

                                                                                                        Have you ever worked in an office, volunteer organization, missionary group, art collective, or literally any other group human endeavour?

                                                                                                        They all have expected norms of behavior and ask those who don’t conform to them to leave.

                                                                                                        1. 0

                                                                                                          I don’t remember any such group needing a pseudo-law HR-babble document to accomplish that, at least not in the last 30 years.

                                                                                                          1. 11

                                                                                                            They literally all do. Every single organization you’ve ever been involved with that wasn’t just you and some buddies had an employee handbook or volunteer agreement or something in which this sort of thing was spelled out.

                                                                                                            To not have one opens them up to “well I didn’t know I couldn’t do that” when they get mad at someone, or a lawsuit if they get fired because they didn’t know some behavior wasn’t acceptable.

                                                                                                            And apparently these sorts of things are necessary, because a lot of people can’t just…not be a dick.

                                                                                                            1. -2

                                                                                                              To all of that: No. Please stop applying your cultural expectations to the rest of the planet.

                                                                                                              1. 0

                                                                                                                https://i.kym-cdn.com/photos/images/original/001/143/769/86b.jpg

                                                                                                                ;)

                                                                                                                Seriously though, if you don’t like it you’re free to start your own kernel with blackjack and hookers if you’d like. Stop telling others how they can run their projects.

                                                                                                                1. 1

                                                                                                                  We need a CoC which goes against that kind of cultural imperialism.

                                                                                                                  Not to mention blatant racism and sexism.

                                                                                                                  1. -1

                                                                                                                    Stop telling others how they can run their projects.

                                                                                                                    Oh, the old Fox News “if the argument is lost, just accuse others of the thing you are doing yourself to turn any discussion into a fact-free ‘you did it! no you!’”.

                                                                                                                    I think we can stop here.

                                                                                                              2. 1

                                                                                                                There’s a long unbroken chain from https://en.wikipedia.org/wiki/Code_of_Hammurabi to present day, by way of https://en.wikipedia.org/wiki/Common_law (among other such pseudo-law HR-babble documents, including of course https://www.archives.gov/founding-docs/constitution-transcript).

                                                                                                                1. -1

                                                                                                                  None of these are even remotely related to the topic at hand.

                                                                                                          2. 0

                                                                                                            assholes

                                                                                                            OK, that’s a start. Now define it, as opposed to thinking anyone who acknowledges it’s a complex topic is a horrible human being. Define it in a culture-neutral fashion, and define it such that the non-neurotypical don’t get thrown out or made to feel less than.

                                                                                                          3. 1

                                                                                                            I don’t even think that’s the biggest problem directly, but the fact that “imposing” (not a word I’d choose) a CoC on a community that’s (obviously) not prepared for it will be divisive – and why should it not? It’s kind of the point of a CoC – a “motion of confidence” of sorts that a community poses to itself. Either it’s admitted which forces the reactionaries to split of or if it looses the progressives don’t feel welcome anymore. And frankly, I don’t know if this is a good thing or not.

                                                                                                            1. -3

                                                                                                              I love reading the replies to https://lobste.rs/s/uyriow/linux_4_19_rc4_released_apology#c_yl3d7r in retrospect.

                                                                                                            1. 1

                                                                                                              It’s still a thing to the extent Algol is still a thing in the form of C#/Java.

                                                                                                              Modern Fortran has a passing resemblance to FORTRAN-IV, like C#/Java has a passing resemblance to Algol-60. In fact, modern Fortran looks even less like FORTRAN-IV than it looks like Algol-60.

                                                                                                              1. 1

                                                                                                                without reverseengineering or violating End-User License Agreement terms.

                                                                                                                How sure are you a court would agree that you’re not violating the EULA?

                                                                                                                1. 1

                                                                                                                  I wouldnt be. I lol’d at that part. Xilinx etc’s lawyers too good for me to think we’ll get ahead of them.

                                                                                                                1. 11

                                                                                                                  What is Yggdrasil?, its an end to end encrypted networking protocol.

                                                                                                                  It’s also a sign that you’re Officially Old, if you’re wondering why you’d be installing a completely dead distro in another, living distro.

                                                                                                                  1. 4

                                                                                                                    The ‘find peers’ part of the title was a bit weird. But then I found it completely plausible that there is some community that specializes in running old, obscure Linux distributions. There were so many unique (but not always great) distributions: Yggdrasil, EasyLinux, DLD, Caldera OpenLinux, TurboLinux, Corel Linux, Storm Linux, Stampede.

                                                                                                                    1. 2

                                                                                                                      My first distro will always have a special place.

                                                                                                                      Coming from Atari ST and Amiga I spend days and days trying to get X to work (this was before internet being available to the common people and search engines). When I finally got it up it was like completing a game: now what?

                                                                                                                      Also FVWM (I think it was) looked horrible and unusable being used to the Atari ST and Amiga desktop environments.

                                                                                                                    1. 5

                                                                                                                      These have been floating around FOR-EVER but I’m glad they keep cropping up. I see evidence of these constantly in just about every technical community I inhabit.

                                                                                                                      They were an eye opener for me at the time. Particularly #2 (accept me as I am) and #4 (transitive).

                                                                                                                      Grokking the fundamental falsehood of some of these deeply was definitely a step towards finally growing up in certain ways that I REALLY needed to (and had for a long time).

                                                                                                                      I also credit having successfully jettisoned #2 with being why at age 35 I finally started dating and met my wife :)

                                                                                                                      1. 5

                                                                                                                        I recognize some of these patterns, but I don’t think I associate them with technical communities. Where I’ve run into them is in “cultural geek” communities, those organized around things like fandoms. This could be idiosyncratic based on which specific kinds of both communities I’ve run into though.

                                                                                                                        1. 2

                                                                                                                          I’ll take your word for it. In my case, the degree ov overlap between technical communities and various fandoms is extremely high.

                                                                                                                          1. 1

                                                                                                                            That’s interesting and believable too, which is why I added the caveat that it could well be idiosyncratic. I’ve definitely read about this kind of thing in my area, artificial intelligence, e.g. the old MIT hacker culture. I just haven’t encountered it in person, and it always felt like something that existed way before my time. Out of curiosity, what kinds of technical communities have you encountered where the overlap is high?

                                                                                                                            The AI conferences I personally go to do have a handful of geeky people, but way more business/startup/government/military/professor types. A bunch of these factors pretty clearly don’t apply as far as I can tell, for better or worse. For example, socially awkward and/or unhygienic people are pretty much jetissoned without a second thought if someone thinks they might interfere with funding.

                                                                                                                            1. 2

                                                                                                                              So, I want to be sure to constrain this properly.

                                                                                                                              I came into the Boston technical scene in the early 1990s. At that time, the overlap with the Boston science fiction fandom community was HUGE as it was for the Polyamory and BDSM communities (of which I’ve never been a part. Vanilla and proud yo :)

                                                                                                                              In fact, I pretty much got my start in the Boston tech scene by showing up at a science fiction fandom oriented group house in the middle of a blizzard and passing out my resume to anyone who’d talk to me :) I ended up living in that group house for a time.

                                                                                                                              I’m fairly sure this isn’t representative of the here and now. Our industry has become a very VERY different place several times over since then (mostly for the better) and I suspect that younger folks are being drawn from a much more diverse background of interests.

                                                                                                                              1. 1

                                                                                                                                Hah interesting, I know some people who I think had a similar kind of experience in the SF Bay Area in the ’90s, living in group houses to get broadband internet and such. I got into tech in the late ‘90s in suburban Houston, which might have had a geek scene, but if so I didn’t know about it. The tech scene I was exposed to was much more “professional engineering” oriented, anchored by people who worked at NASA or NASA contractors (plus some people doing tech at oil companies).

                                                                                                                          2. 1

                                                                                                                            I’m not found that to be the case, even here in the Lobsters community in its forum and chat forms.

                                                                                                                          3. 2

                                                                                                                            I’m curious how #2 motivated you to start dating. Were you just generally more receptive of criticism from friends, and if so, how does that translate to wanting to start dating?

                                                                                                                            1. 4

                                                                                                                              Not so much about wanting to start dating, but being willing to make the changes necessary to be perceived as attractive.

                                                                                                                              “Friends accept me as I am”.

                                                                                                                              Who cares if I have a giant sloppy beard, dress in sweat pants and faded T-shirts all the time, and generally take PRIDE in not giving two shits about my personal appearance? My TRUE friends will accept me for who I am and see past all that.

                                                                                                                              Except that this is the real world. How you look DOES matter. Shave the beard, lose a few pounds, buy some decent clothing and it’s a whole different ballgame.

                                                                                                                              1. 1

                                                                                                                                I definitely agree with what you’re saying, but it reminds me of some definitions from Douglas Coupland’s novel Generation X :

                                                                                                                                anti-victim device (AVD) - a small fashion accessory worn on an otherwise conservative outfit which announces to the world that one still has a spark of individuality burning inside: 1940s retro ties and earrings (on men), feminist buttons, noserings (on women), and the now almost completely extinct teeny weeny “rattail” haircut (both sexes).

                                                                                                                                … and:

                                                                                                                                personality tithe - a price paid for becoming a couple; previously amusing human beings become boring: “Thanks for inviting us, but Noreen and I are going to look at flatware catalogs tonight. Afterward we’re going to watch the shopping channel.”

                                                                                                                                https://en.wikiquote.org/wiki/Generation_X:_Tales_for_an_Accelerated_Culture

                                                                                                                                Some parts of a given personality are stupid and need to be shorn so the person can have a more interesting life. It’s easy to lionize the idea that someone can be Good Enough, or, in somewhat different subcultures, Cool Enough, that you never have to compromise on those things, but even if you luck into a job where that works, it doesn’t and can never work in a healthy personal relationship.

                                                                                                                                1. 4

                                                                                                                                  Sounds like I need to read that book!

                                                                                                                                  I don’t personally see it as compromise.

                                                                                                                                  The truth is that my self confidence was in the shitter at that time. My personal appearance was just one outward manifestation of that.

                                                                                                                                  Recognizing that I needed to make changes if I wanted to meet someone and be less lonely was a first step towards letting go of some of that baggage.

                                                                                                                          1. 19

                                                                                                                            What to say, what to say. Yes, generally speaking I agree. “Defensive programming” can be like shotgun parsing applied to anything that’s not parsing.

                                                                                                                            Checks here, checks there, checks everywhere. Checks, not asserts. Checks that try to do something reasonable (such as avoid crashing the program). It muddies up the logic and gets in the way, and it makes hard to reason about what’s meant to be a valid kind of thing to pass to a function (ideally we’d have types to express that, but I still use mainstreamish programming languages). Is something valid because you can pass it without crashing the program? Or is it potentially invalid, because there is a check that makes the function a no-op or bail-out-with-error or whatever? What if you don’t notice this case and the invalid value just keeps going deeper and deeper into the program?

                                                                                                                            However, I also don’t feel like free() being a no-op when given a NULL pointer is necessarily defensive programming. One might say that you should never call free if you haven’t got something to deallocate, but in a program littered with constructs like

                                                                                                                            if (ptr) free(ptr);
                                                                                                                            

                                                                                                                            the “defensive check” is simply moving common, repeated logic into one place. Isn’t that what functions exist for?

                                                                                                                            Herein lies the difficulty. It can be hard to decide whether some check is defending against invalid state or just implementing valid logic. I still struggle with it, having been programming for 20 years. If someone’s got a good rule of thumb, I’m all floppy hears. I kinda suspect it’s too context specific for a rule of thumb though.

                                                                                                                            1. 2

                                                                                                                              if (ptr) free(ptr);

                                                                                                                              This isn’t defensive, this is not knowing the tools: free(NULL) is a safe no-op. Double-freeing is bad, but that construct won’t catch that. This construct will prevent it: free(ptr); ptr = NULL;

                                                                                                                              There. Now, you can’t double-free, and you can write free(ptr); an arbitrary number of times to make the cleanup code less conditional and more robust.

                                                                                                                              1. 1

                                                                                                                                free(NULL) is a safe no-op

                                                                                                                                Yes, that’s what I said.

                                                                                                                                What I’m questioning here is whether moving that check from the place of call to the implementation of free is defensive programming or not. If you RTFA, spc476 tells a story about a function that is essentially free(), except that on some platforms it’s got the check built in and on others it doesn’t.

                                                                                                                                Is the built in check defending against the blunder of passing the function a NULL pointer, or is it just a convenient place to lay the logic that would otherwise be repeated all over?

                                                                                                                              2. 2

                                                                                                                                In my (granted pretty limited) experience if (ptr) free(ptr); is something that either indicates

                                                                                                                                • some confusion about how ptr is used (similar issue in python 2 was calling decode on a already decoded string. This would no-op, but would leave people thinking that the source thing is bytes, or let people mix and match bytes and strings). Usually pointers are either freed or not freed so… how are you in a state where you don’t know if something needs to be freed?

                                                                                                                                • is actually being used as a sort of “optional type”. The check is similar to null-checking in other languages. Imagine if foo.bar no-oped if foo was null. Seems pretty reasonable to ask the user to confirm this.

                                                                                                                                Rust’s linear types work on some level because of the fact that you usually know whether something needs to be freed or not.

                                                                                                                                Then again, I don’t have that much experience with C APIs in a while. It could be pretty common to optionally pass in pointers all over. But I feel like it’s not?

                                                                                                                                1. 1

                                                                                                                                  is actually being used as a sort of “optional type”. The check is similar to null-checking in other languages. Imagine if foo.bar no-oped if foo was null. Seems pretty reasonable to ask the user to confirm this.

                                                                                                                                  This is what is is, generally. If you think of it not as foo.bar() where foo is NULL, but rather as bar(Nothing) where a NULL value stands for nothing, does it make a little more sense?

                                                                                                                                  If you want to go further, does NULL stand for an empty list, or does it stand for nothing? Does it make sense to free an empty list? Why not?

                                                                                                                                  There are generally three ways to implement optionality in C apis: (1) format strings, which are used to specify what you have, (2) pointer + count (think arrays), (3) NULL pointer as a stand-in for nothing, or any other pointer to a something. In addition to that, NULL pointers see some use as sentinels to indicate that I have nothing more. All pretty common; any fancier way to indicate optionality gets clumsy.

                                                                                                                                  Rust’s linear types work on some level because of the fact that you usually know whether something needs to be freed or not.

                                                                                                                                  How does that knowledge manifest? In C, it is sometimes the case that the place of resource acquisition is near the place of free, so you can encode this knowledge in control flow. But that’s not always the case.. then storing NULL pointers to say that I have nothing is a way to encode the knowledge of (not) having to free something. And when it comes to that, it’s either if (ptr) free(ptr); all over, or the common logic is built into free().

                                                                                                                                  1. 2

                                                                                                                                    Thank you for this detailed reply! It helped me to identify something that causes a bit of a mismatch with C programs. In reality, C ends up being applied in two different ways:

                                                                                                                                    • writing tricky system internals (the stuff where the bit twiddling and the array pointer math is a necessary evil/very useful)
                                                                                                                                    • writing the same kinds of applications as other people write in higher-level languages

                                                                                                                                    So in former case certain API designs make sense, but in the latter one another kind of API design makes sense. Of course, the rub is that C does not provide enough abstraction tooling to write “good” API designs for higher level stuff (leading to people designing APIs purely through macros).

                                                                                                                                    In a lot of higher level software I would prefer for a double free to blow up so that I now can go in and find the issue with the data flow, since the double free problem also has the nasty “use after free” dual problem. But if you’re writing, say, a language interpreter it’s possible that the data flow is so dependent on user data that it’s very difficult to do this in a manageable way. So this more permissive API would end up being more helpful than having your program crash all the time

                                                                                                                              1. 3

                                                                                                                                Be careful when XOR-swapping two integers that are addressed by pointers/references. If they both point to the same memory location, then the value gets erased to zero. In C it would be good to add the restrict keyword to the two pointers, to let the human know about this pitfall (it doesn’t stop the compiler).

                                                                                                                                1. 6

                                                                                                                                  Be careful when using coding tricks in production code.

                                                                                                                                  I doubt whether there’s still a compiler used “for real” which doesn’t optimize the normal swap algorithm, using a temporary variable, into whatever’s most efficient for the system, which usually works out to being a single opcode. This is decades-old peephole optimization stuff. The intricacies of restrict and pointer aliasing are useful to keep in mind in general, but if you’re using this trick in code where correctness matters, just use a temporary variable and have some faith in the people who wrote the optimizer.