Threads for madhadron

  1. 9

    Curious to hear from some Erlang/Elixir devs here. As I understand it, “rebooting” is at the heart of the OTP philosophy. Generally speaking, does it work well? What are some examples of when it doesn’t?

    1. 5

      Generally speaking, does it work well?

      In my experience, it works very, very well. Restarting is the most efficient way to deal with transient failures, and Erlang’s use of supervision trees means that the piece being restarted tends to have the smallest granularity to be useful, while preserving the state in the rest of the system.

      I feel that Erlang/Elixir’s “Let it Crash” philosophy has less to do with restarting during transient failures than many people might think. It has more to do with turning errors and failures into tools, and being forced to really think about failure scenarios when developing. Fred Hebert explains this idea in a really excellent talk/transcription: https://ferd.ca/the-zen-of-erlang.html

      What are some examples of when it doesn’t?

      “Let it crash” does not really work when dealing with data/state that cannot be thrown away or reconstructed. For example, when I need to integrate with some service whose API does not allow for idempotent requests, I often find myself having to be more careful about crashes, and leaning more heavily on other error handling mechanisms. Another commenter mentioned poison messages, but I haven’t really struggled with those, because practicing “Let it crash” will make bugs around poison messages very loud and straightforward to fix.

      Letting things crash+restart is not a panacea, it’s one strategy among several. Erlang also supports exceptions, and there’s a very common pattern of returning ‘Either-shaped’ terms from functions that can fail; {ok, Result} | {error, Term}.

      1. 2

        It’s less about rebooting the whole thing and more about having a supervisor that can start the process back in a known state. It works well in many cases…provided you don’t let yourself infinitely reprocess poison messages.

      1. 1

        Git has exhausted its potential in my eyes. God be merciful, I’ll write my own vcs. For myself. Maybe not even going to make it publicly available, but only to those who actually get it.

        1. 2

          Good luck! You’ll be following in the footsteps of many dead or antiquated VCS systems, like (off the top of my head…) Fossil, BitKeeper, Mercurial, Bazaar, and Darcs.

          1. 1

            I sort of want https://pijul.org/ to break out and become the next big thing, but I worry it’s not better enough to overthrow the consensus choice.

          2. 2

            You could also write a new porcelain on top of git. git’s internals are a pretty straightforward set of primitives about a content addressable file system and commits.

          1. 22

            If I had to give two real high-dollar items for making git branching less painful:

            • Rebase, not merge, your feature branch. Do not squash.
            • Rebase your feature branch against master/main/whatever at least every day .

            I’d also suggest knowing when to cut losses–if you have a zombie branch a few months old, take the parts that are super neat and throw away the rest.

            1. 7

              This is pretty much it. GitHub exacerbates this problem because its pull request workflow based on branches is broken. What you really want is a pull request on a cherry picked range of commits onto another branch. That way you can have commits from your branch flowing into main while you continue to develop along your branch.

              1. 2

                Indeed, any of these advices would have solved the problem. Instead, I ended up spending almost a month just trying to solve the mess.

                1. 3

                  My condolences, friend. Happens to all of us eventually.

                2. 2

                  Some time ago I setup an alias for git cherry-pull <mainline>, which (rebase style) lets you assign each commit to a new branch, pushes them, then opens the ‘new pull request’ page for each branch.

                  I should dust off the code and publish it.

                  [edit] A colleague pointed out that a script needs to be ~perfect because it obscures the details of the git operations, while doing it longhand keeps them front of mind. Might explain why I rarely use it anymore.

                  1. 1

                    Sounds nifty! Is the interface like rebase interactive? And I’d recommend a new name, because google autocorrupts it to cherry-pick.

                    1. 1

                      I’ve written similar scripts. The two things that I kept hitting are:

                      1. Getting this to play nicely with rebase -i and merging/splitting commits is…not trivial.
                      2. Automation in PRs is often triggered by the main/master branch, so all but your bottom PR doesn’t get checked.
                  2. 3

                    It seems to be fairly unmaintained, but I really like git-imerge for long-lived branches. It does pairwise merges of each of your commits against each of the upstream ones giving you an NxM matrix of all possible merges. It builds this as a frontier from the top-left (shared parent) branch to the bottom-right (final merge). You get to resolve conflicts exactly on the pair of your commit vs theirs that introduced it. You then have the full history for bisecting if the end result doesn’t work. You can then choose one of three ways for it to clean up the resulting history:

                    • The equivalent of a git merge.
                    • The equivalent of a git rebase.
                    • A rebase-with-history, where it gives you a rebase but also sets the parent of each of your commits such that downstream users can still merge from your branch.
                    1. 2

                      I’d recommend squashing before the rebase simply so there’s only one commit you have to resolve conflicts on.

                      But yes, rebase often. This is the way.

                    1. 4

                      If you’re interested in designing buildings for change, the classic book is How Buildings Learn.

                      I think the key reason that software is not like architecture is the difference in goals. In architecture we are trying to produce well adapted buildings with the “quality without a name” that Christopher Alexander describes. In software the quality without a name, which is a property of human perception of geometry, isn’t a thing.

                      1. 3

                        TIL about service workers and then shared workers. That’s fun!

                        1. 21

                          I find that, having written a lot of Haskell and done a lot of pure math, I am less and less interested in using category theory to describe what I am doing. The category theory seems like the implementation detail, and not the thing I care about. The way I have come to think of things like monads is more like model theory: the monad is a theory, and there are models of it. Those models happen to be isomorphic to categorical constructions.

                          This text seems to suffer from what every other category theory text does: where are the theorems? There are lot of definitions here, but definitions are cheap. They alter over time to keep theorems true as new corner cases are found. If someone knows of a category theory text that isn’t a giant collection of definitions, I would love a pointer to it.

                          1. 15

                            I feel that I am in the same boat. I enjoy Haskell and mathematics. It brings me intense joy to use mathematics to gain new insights into other area, so I leapt at the opportunity. Just like your experience, the first few chapters were purely defining terms, but I kept pushing through. Finally, we started getting into some relations.

                            Given f : A → (B, C), ∃ g : A → B and h : A → C
                            

                            This was treated as some mind-blowing revelation on par with the Euler identity. Pages and pages of exercises were dedicated to showing the applicability of this formula across domains. There was an especially deep interest showing real world examples. That by asking a barber for a Shave and a Haircut, then telling them to skip the shave, I could get just a haircut.

                            The next chapter introduced symmetric monoidal categories with the earth-shattering property that I could take a value (B, C) and get a value (C, B). There was a brief mention that there existed braided categories without this property, and that they had deep connections to quantum mechanics (and my thesis!), but that they were outside the scope of this book. What was in scope was a collection of example problems about how, given waffles and chicken, we can construct a meal of chicken and waffles.

                            1. 2

                              Stellar comment, category theory (at least at my depth) tends to explain the obvious with the obscure.

                            2. 5

                              It makes sense to me why a theory of associative maps (to put it glibly) might be useful for someone designing high-level abstractions, since it can help to identify what the important invariants of those abstractions should be. What chafes a little for me in Haskell’s aesthetic embrace of category theory is precisely that a lot of its enthusiasts have the opposite inclination from you and seem to want to refer everything about what they’re doing to category theory. This feels deeply silly to me, because the vast majority of the interesting semantic properties of any given program are carried by concrete implementors of those category-theoretic abstractions. It’s nice that they’re there to provide the interfaces and invariants that allow me to productively compose concretions, but the generality that allows them to do that is also what prevents them from having much to say about what my program actually does. At the risk of seeming uncharitable, I wonder if a lot of the fetishism is down to Haskell being the most obvious place to go for people who belatedly realized that they’d have preferred to pursue pure math than be focused on software.

                              If someone knows of a category theory text that isn’t a giant collection of definitions, I would love a pointer to it.

                              I think Emily Riehl’s Category Theory in Context is one such text. It’s pretty typical of a math text targeted at mathematicians in its very terse Definition -> Theorem -> Worked Proof -> Exercises format, but the balance between those elements seems similar to anything else in the genre.

                              1. 3

                                I think that there’s computer science and there’s software engineering and Haskell happens to be a good tool for either. As a result you get a lot of writings out of scope for any given person’s interest.

                                1. 2

                                  Absolutely! It’s just been my experience that a lot of the prominent writing about Haskell from the computer science perspective in particular tends to defer overwhelmingly to category theory in a way that feels reductive to me. It’s certainly possible that I’m just working with a non-representative sample.

                                  1. 2

                                    FWIW as someone who’s done a decent amount of higher math, I agree.

                            1. 3

                              Monaco hanging storage bags. They’re what they use at pharmacies to hold all the prescriptions. The bags are transparent and hang from a rod so they don’t bunch up or get lost under each other.

                              I tried all the methods about tubes and filing cabinets and so forth and hated all of them. This is the only solution I’ve found that is actually good.

                              1. 3

                                Coincidentally, this approach came up on Cool Tools today https://kk.org/cooltools/organizing-cables-and-other-gear-using-hanging-storage-bags/

                              1. 1

                                Most of the problems mentioned go way if you don’t send single expressions, only whole programs with their imports. The PLT Racket folks went that way for pedagogical reasons (students ending up with weird environments and wondering why their commands weren’t working right in the REPL).

                                1. 7

                                  Grabbing some system from a different field and trying to apply it whole cloth to programming while missing the point and failing to recognize where things don’t match is a long tradition in the field. Design patterns are the biggest other example that comes to mind. I think it’s “real engineering” envy.

                                  The really important idea, which goes back to Deming, who taught it to the Japanese manufacturers after WWII, was that people work in a system. That system accounts for most of their performance or lack thereof. It has random variation. And you should be looking at the system and thinking about how to make it better.

                                  There are bits and pieces that are sometimes useful. From Goldratt, we get the idea of looking at unshipped code as a cost we are bearing, but chasing bottlenecks is rarely that helpful. From lean, standardized work lists are a really useful tool because we can look at them and say, “This is nuts” and automate large hunks of it, and having easy to track and update visuals of what’s going on (kanban) are a big help as long as we don’t try to imitate the particular visual representations of a factory floor. So it’s worth reading all this stuff, but only as a source of ideas. No one should expect the systems to directly translate.

                                  1. 4

                                    SeaMonkey. Wow :)

                                    1. 2

                                      That is a name I have not heard in a very long time. (Insert Star Wars meme here.)

                                    1. 10

                                      I hope the author gets the help they need, but I don’t really see how the blame for their psychological issues should be laid at the feet of their most-recent employer.

                                      1. 50

                                        In my career I’ve seen managers cry multiple times, and this is one of the places that happened. A manager should never have to ask whether they’re a coward, but that happened here.

                                        I dunno, doesn’t sound like they were the only person damaged by the experience.

                                        Eventually my physicians put me on forced medical leave, and they strongly encouraged me to quit…

                                        Seems pretty significant when medical professionals are telling you the cure for your issues is “quit this job”?

                                        1. 16

                                          Seems pretty significant when medical professionals are telling you the cure for your issues is “quit this job”?

                                          A number of years ago I developed some neurological problems, and stress made it worse. I was told by two different doctors to change or quit my job. I eventually did, and it helped, but the job itself was not the root cause, nor was leaving the sole cure.

                                          I absolutely cannot speak for OP’s situation, but I just want to point out that a doctor informing you to rethink your career doesn’t necessarily imply that the career is at fault. Though, in this case, it seems like it is.

                                          1. 4

                                            It doesn’t seem like the OP’s doctors told them to change careers though, just quit that job.

                                            1. 3

                                              To clarify, I’m using “career change” in a general sense. I would include quitting a job as a career change, as well as leaving one job for another in the same industry/domain. I’m not using it in the “leave software altogether” sense.

                                        2. 24

                                          I’m trusting the author’s causal assessment here, but employers (especially large businesses with the resources required) can be huge sources of stress and prevent employees from having the time or energy needed to seek treatment for their own needs, so they can both cause issues and worsen existing ones.

                                          It’s not uncommon, for example, for businesses to encourage unpaid out-of-hours work for salaried employees by building a culture that emphasizes personal accountability for project success; this not only increases stress and reduces free time that could otherwise be used to relieve work-related stress, it teaches employees to blame themselves for what could just as easily be systemic failures. Even if an employee resists the social pressure to put in extra hours in such an environment, they’ll still be penalized with (real or imagined) blame from their peers, blame from themselves for “not trying hard enough”, and likely less job safety or fewer benefits.

                                          In particular, there’s relevance from the business’ failure to support effective project management, manage workloads, or generally address problems repeatedly and clearly brought up to them. These kinds of things typically fuel burnout. The author doesn’t go into details enough for an outside observer to make a judgment call one way or the other, but if you trust the author’s account of reality then it seems reasonable to blame the employer for, at the least, negligently fueling these problems through gross mismanagement.

                                          Arguably off-topic, but I think it might squeak by on the grounds that it briefly ties the psychological harm to the quality of a technical standard resulting from the mismanaged business process.

                                          1. 3

                                            a culture that emphasizes personal accountability for project success; this not only increases stress and reduces free time that could otherwise be used to relieve work-related stress, it teaches employees to blame themselves for what could just as easily be systemic failures.

                                            This is such a common thing. An executive or manager punts on actually organizing the work, whether from incompetence or laziness, and then tries to make the individuals in the system responsible for the failures that occur. It’s hardly new. Deming describes basically this in ‘The New Economics’ (look up the ‘red bead game’).

                                            More cynically, is WebAssembly actuall in Google’s interests? It doesn’t add revenue to Google Cloud. It’s going to make their data collection harder (provide Google analytics libraries for how many languages?). It was clearly a thing that was gaining momentum, so if they were to damage it, they would need to make sure they had a seat at the table and then make sure that the seat was used as ineffectually and disruptively as possible.

                                            1. 9

                                              More cynically, is WebAssembly actually in Google’s interests?

                                              I think historically the answer would have been yes. Google has at various points been somewhat hamstrung by shipping projects with slow front end JS in them and responded by trying to make browsers themselves faster. e.g. creating V8 and financially contributing to Mozilla.

                                              I couldn’t say if Google now has any incentive to not make JS go fast. I’m not aware of one. I suspect still the opposite. I think they’re also pushing mobile web apps as a way to inconvenience Apple; I think Google currently want people to write portable software using web tech instead of being tempted to write native apps for iOS only.

                                              That said, what’s good for the company is not the principle factor motivating policy decisions. What’s good for specific senior managers inside Google is. Otherwise you wouldn’t see all these damn self combusting promo cycle driven chat apps from Google. A company is not a monolith.

                                              ‘The New Economics’

                                              I have this book and will have to re-read at least this bit tomorrow. I have slightly mixed feelings about it, mostly about the writing style.

                                              1. 1

                                                Making JS fast is one thing. Making a target for many other languages, as opposed to maintaining analytics libraries and other ways of gathering data for one languages?

                                                Your point about the senior managers’ interests driving what’s done is on point, though. Google and Facebook especially are weird because ads fund the company, and the rest is all some kind of loss leader floating around divorced from revenue.

                                                The only thing I’ll comment about Deming is that the chapter on intrinsic vs extrinsic motivation should be ignored, as that’s entirely an artifact despite its popularity. The rest of the book has held up pretty well.

                                                1. 10

                                                  Making JS fast is one thing. Making a target for many other languages, as opposed to maintaining analytics libraries and other ways of gathering data for one languages?

                                                  Google doesn’t need to maintain their analytics libraries in many other languages, only to expose APIs callable from those languages. All WebAssembly languages can call / be called by JavaScript.

                                                  More generally, Google has been the biggest proponent of web apps instead of web services. Tim Berners-Lee’s vision for the web was that you’d have services that provided data with rich semantic markup. These could be rendered as web pages but could equally plug into other clients. The problem with this approach is that a client that can parse the structure of the data can choose to render it in a way that simply ignores adverts. If all of your adds are in an <advert provider="google"> block then an ad blocker is a trivial browser extension, as is something that displays ads but restricts them to plain text. Google’s web app push has been a massive effort to convince everyone to obfuscate the contents of their web pages. This has two key advantages for Google:

                                                  • Writing an ad blocker is hard if ads and contents are both generated from a Turing-complete language using the same output mechanisms.
                                                  • Parsing such pages for indexing requires more resources (you can’t just parse the semantic markup, you must run the interpreter / JIT in your crawler, which requires orders of magnitude more hardware than simply parsing some semantic mark-up. This significantly increases the barrier to entry for new search engines, protecting Google’s core user-data-harvesting tool.

                                                  WebAssembly fits very well into Google’s vision for the web.

                                                  1. 2

                                                    I used to work for a price-comparison site, back when those were actual startups. We had one legacy price information page that was Java applet (remember those?) Supposedly the founders were worried about screen scrapers so wanted the entire site rendered with applets to deter them.

                                                    1. 1

                                                      This makes more sense than my initial thoughts. Thanks.

                                                    2. 2

                                                      Making a target for many other languages, as opposed to maintaining analytics libraries and other ways of gathering data for one languages?

                                                      This is something I should have stated explicitly but didn’t think to: I don’t think wasm is actually going to be the future of non-JS languages in the browser. I think they for the next couple decades at least, wasm is going to be used for compute kernels (written in other langs like C++ and Rust) that get called from JS.

                                                      I’m taking a bet here that targeting wasm from langs with substantial runtimes will remain unattractive indefinitely due to download weight and parsing time.

                                                      about Deming

                                                      I honestly think many of the points in that book are great but hoo boy the writing style.

                                              2. 1

                                                That is exactly what I thought while reading this. I understand that to a lot of people, WebAssembly is very important, and they have a lot of emotions vested into the success. But to the author’s employer, it might not be as important, as it might not directly generate revenue. The author forgets that to the vast, vast majority of people on this earth, having the opportunity to work on such a technology at a company like Google is an unparalleled privilege. Most people on this earth do not have the opportunity to quit their job just because a project is difficult, or because meetings run long or it is hard to find consensus. Managing projects well is incredibly hard. But I am sure that the author was not living on minimum wage, so there surely was compensation for the efforts.

                                                It is sad to hear that the author has medical issues, and I hope those get sorted out. And those kinds of issues do exacerbate stressful jobs. But that is not a good reason for finger pointing. Maybe the position just was not right for the author, maybe there are more exciting projects that are waiting in the future. I certainly hope so. But it is important not to blame one’s issues on others, that is not a good attitude in life.

                                                1. 25

                                                  Using the excuse that because there exist others less fortunate, it’s not worth fighting to make something better is also not a good attitude in life.

                                                  Reading between the lines, it feels to me like there was a lot that the author left unsaid, and that’s fine. It takes courage to share a personal story about mental wellbeing, and an itemized list of all the wrongs that took place is not necessary to get the point the author was trying to make across.

                                                  My point is that I’d be cautious about making assumptions about the author’s experiences as they didn’t exactly give a lot of detail here.

                                                  1. 3

                                                    Using the excuse that because there exist others less fortunate, it’s not worth fighting to make something better is also not a good attitude in life.

                                                    This is true. It is worth fighting to make things better

                                                    Reading between the lines, it feels to me like there was a lot that the author left unsaid, and that’s fine. It takes courage to share a personal story about mental wellbeing, and an itemized list of all the wrongs that took place is not necessary to get the point the author was trying to make across.

                                                    There is a lot of things that go into mental wellbeing. Some things you can control, some things are genetic. I don’t know what the author left out, but I have not yet seen a study showing that stressful office jobs give people brain damage. There might be things the author has not explained, but at the same time that is a very extreme claim. In fact, if that were true, I am sure that the author should receive a lot in compensation.

                                                    My point is that I’d be cautious about making assumptions about the author’s experiences as they didn’t exactly give a lot of detail here.

                                                    I agree with you, but I also think that if someone makes a very bold claim about an employer, especially about personal injury, that these claims should be substantiated. There is a very big difference between “working there was hard, I quit” and “the employer acted recklessly and caused me personal injury”. And I don’t really know which one the author is saying, because from the description could be interpreted as it just being a difficult project to see through.

                                                    1. 8

                                                      In fact, if that were true, I am sure that the author should receive a lot in compensation.

                                                      By thinking about it for a few seconds you can realize that this can easily not happen. The OP itself says that they don’t have documented evidence from the time because of all the issues they were going through. And it’s easy to see why: if your mental health is damaged, your brain is not working right, would you be mindful enough to take detailed notes of every incident and keep a trail of evidence for later use in compensation claims? Or are you saying that compensation would be given out no questions asked?

                                                      1. 3

                                                        All I’m saying is, there is a very large difference between saying this job was very stressful, I had trouble sleeping and it negatively affected my concentration and memory and saying this job gave me brain damage. Brain damage is relatively well-defined:

                                                        The basic definition of brain damage is an injury to the brain caused by various conditions such as head trauma, inadequate oxygen supply, infections, or intracranial hemorrhage. This damage may be associated with a behavioral or functional abnormality.

                                                        Additionally, there are ways to test for this, a neurologist can make that determination. I’m not a neurologist. But it would be the first time I heard that brain damage be caused by psychosomatic issues. I believe that the author may have used this term in error. That’s why I said what I said — if you, or anyone, has brain damage as a result of your occupation, that is definitely grounds for compensation. And not a small compensation either, as brain damage is no joke. This is a very different category from mere psychological stress from working for an apparently mismanaged project.

                                                        1. 5

                                                          Via https://www.webmd.com/brain/brain-damage-symptoms-causes-treatments

                                                          Brain damage is an injury that causes the destruction or deterioration of brain cells.

                                                          Anxiety, stress, lack of sleep, and other factors can potentially do that. So I don’t see any incorrect use of the phrase ‘brain damage’ here. And anyway, you missed the point. Saying ‘This patient has brain damage’ is different from saying ‘Working in the WebAssembly team at Google caused this patient’s brain damage’. When you talk about causation and claims of damage and compensation, people tend to demand documentary evidence.

                                                          I agree brain damage is no joke, but if you look at society it’s very common for certain types of relatively-invisible mental illnesses to be downplayed and treated very lightly, almost as a joke. Especially by people and corporations who would suddenly have to answer for causing these injuries.

                                                          1. 4

                                                            Anxiety, stress, lack of sleep and other factors cannot, ever, possibly, cause brain damage. I think you have not completely read that article. It states – as does the definition that I linked:

                                                            All traumatic brain injuries are head injuries. But head injury is not necessarily brain injury. There are two types of brain injury: traumatic brain injury and acquired brain injury. Both disrupt the brain’s normal functioning.

                                                            • Traumatic Brain Injury(TBI) is caused by an external force – such as a blow to the head – that causes the brain to move inside the skull or damages the skull. This in turn damages the brain.
                                                            • Acquired Brain Injury (ABI) occurs at the cellular level. It is most often associated with pressure on the brain. This could come from a tumor. Or it could result from neurological illness, as in the case of a stroke.

                                                            There is no kind of brain injury that is caused by lack of sleep or stress. That is not to say that these things are not also damaging to one’s body and well-being.

                                                            Mental illnesses can be very devastating and stressful on the body. But you will not get a brain injury from a mental illness, unless it makes you physically impact your brain (causing traumatic brain injury), ingest something toxic, or have a stroke. It is important to be very careful with language and not confuse terms. The term “brain damage” is colloquially often used to describe things that are most definitely not brain damage, like “reading this gave me brain damage”. I hope you understand what I’m trying to state here. Again, the author has possibly misused the term “brain damage”, or there is some physical trauma that happened that the author has not mentioned in the article.

                                                            I hope you understand what I am trying to say here!

                                                            1. 9

                                                              Anxiety and stress raise adrenaline levels, which in turn cause short- and long-term changes in brain chemistry. It sounds like you’ve never been burnt out; don’t judge others so harshly.

                                                              1. 3

                                                                Anxiety and stress are definitely not healthy for a brain. They accelerate aging processes, which is damaging. But brain damage in a medical context refers to large-scale cell death caused by genetics, trauma, stroke or tumors.

                                                              2. 8

                                                                There seems to be a weird definitional slide here from “brain damage” to “traumatic brain injury.” I think we are all agreed that her job did not give her traumatic brain injury, and this is not claimed. But your claim that stress and sleep deprivation cannot cause (acquired) brain injury is wrong. In fact, you will find counterexamples by just googling “sleep deprivation brain damage”.

                                                                “Mental illnesses can be … stressful on the body.” The brain is part of the body!

                                                                1. 1

                                                                  I think you – and most of the other people that have responded to my comment – have not quite understood what I’m saying. The argument here is about the terms being used.

                                                                  Brain Damage

                                                                  Brain damage, as defined here, is damage caused to the brain by trauma, tumors, genetics or oxygen loss, such as during a stroke. This leads to potentially large chunks of your brain to die off. This means you can lose entire brain regions, potentially permanently lose some abilities (facial recognition, speech, etc).

                                                                  Sleep Deprivation

                                                                  See Fundamental Neuroscience, page 961:

                                                                  The crucial role of sleep is illustrated by studies showing that prolonged sleep deprivation results in the distruption of metabolic processes and eventually death.

                                                                  When you are forcibly sleep deprived for a long time, such as when you are being tortured, your body can lose the ability to use nutrients and finally you can die. You need to not sleep at all for weeks for this to happen, generally this is not something that happens to people voluntarily, especially not in western countries.

                                                                  Stress

                                                                  The cells in your brain only have a finite lifespan. At some point, they die and new ones take their place (apoptosis). Chronic stress and sleep deprivation can speed up this process, accelerating aging.

                                                                  Crucially, this is not the same as an entire chunk of your brain to die off because of a stroke. This is a very different process. It is not localized, and it doesn’t cause massive cell death. It is more of a slow, gradual process.

                                                                  Summary

                                                                  Mental illnesses can be … stressful on the body.” The brain is part of the body!

                                                                  Yes, for sure. It is just that the term “brain damage” is usually used for a very specific kind of pattern, and not for the kind of chronlc, low-level damage done by stress and such. A doctor will not diagnose you with brain damage after you’ve had a stressful interaction with your coworker. You will be diagnosed with brain damage in the ICU after someone dropped a hammer on your head. Do you get what I’m trying to say?

                                                                  1. 4

                                                                    I get what you are trying to say, I think you are simply mistaken. If your job impairs your cognitive abilities, then it has given you brain damage. Your brain, is damaged. You have been damaged in your brain. The cells and structures in your brain have taken damage. You keep trying to construct this exhaustive list of “things that are brain damage”, and then (in another comment) saying that this is about them not feeling appreciated and valued or sort of vaguely feeling bad, when what they are saying is that working at this job impaired their ability to form thoughts. That is a brain damage thing! The brain is an organ for forming thoughts. If the brain can’t thoughts so good no more, then it has been damaged.

                                                                    The big picture here is that a stressful job damaged this person’s health. Specifically, their brain’s.

                                                                    1. 3

                                                                      I understand what you are trying to say, but I think you are simply mistaken. We (as a society) have definitions for the terms we use. See https://en.wikipedia.org/wiki/Brain_damage:

                                                                      Neurotrauma, brain damage or brain injury (BI) is the destruction or degeneration of brain cells. Brain injuries occur due to a wide range of internal and external factors. In general, brain damage refers to significant, undiscriminating trauma-induced damage.

                                                                      This is not “significant, undiscriminating trauma-induced damage” (for context, trauma here refers to physical trauma, such as an impact to the head, not psychological trauma). What the author describes does not line up with any of the Causes of Brain Damage. It is simply not the right term.

                                                                      Yes, the author has a brain, and there is self-reported “damage” to it. But just because someone is a man and feels like he polices the neighborhood, does not make me a “police man”. Just because I feel like my brain doesn’t work right after a traumatic job experience does not mean I have brain damage™.

                                                                      1. 1

                                                                        The Wikipedia header is kind of odd. The next sentence after “in general, brain damage is trauma induced” lists non-trauma-induced categories of brain damage. So I don’t know how strong that “in general” is meant to be. At any rate, “in general” is not at odds with the use of the term for non-trauma induced stress/sleep depriv damage.

                                                                        At any rate, if you click through to Acquired Brain Injury, it says “These impairments result from either traumatic brain injury (e.g. …) or nontraumatic injury … (e.g. listing a bunch of things that are not traumatic.)”

                                                                        Anyway, the Causes of Brain Damage list is clearly not written to be exhaustive. “any number of conditions, including” etc.

                                                                2. 2

                                                                  There is some evidence that lack of sleep may kill brain cells: https://www.bbc.com/news/health-26630647

                                                                  It’s also possible to suffer from mini-strokes due to the factors discussed above.

                                                                  In any case, I feel like you’re missing the forest for the trees. Sure, it’s important to be correct with wording. But is that more important than the bigger picture here, that a stressful job damaged this person’s health?

                                                                  1. 2

                                                                    the bigger picture here, that a stressful job damaged this person’s health

                                                                    Yes, that is true, and it is a shame. I really wish that the process around WASM be less hostile, and that this person not be impacted negatively, even if stressful and hard projects are an unfortunate reality for many people.

                                                                    I feel like you’re missing the forest for the trees.

                                                                    I think that you might be missing the forest for the trees – I’m not saying that this person was not negatively impacted, I am merely stating that it is (probably, unless there is evidence otherwise) to characterize this impact as “brain damage”, because from a medical standpoint, that term has a more narrow definition that damage due to stress does not fulfill.

                                                          2. 4

                                                            Hello, you might enjoy this study.

                                                            https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4561403/

                                                            I looked through a lot of studies to try and find a review that was both broad and to the point.

                                                            Now, you are definitely mixing a lot of terms here… but I hope that if you read the research, you can be convinced, at the very least, that stress hurts brains (and I hope that reading the article and getting caught in this comment storm doesn’t hurt yours).

                                                            1. 2

                                                              Sleep Deprivation and Oxidative Stress in Animal Models: A Systematic Review tells us that sleep deprivation can be shown to increase oxidative stress:

                                                              Current experimental evidence suggests that sleep deprivation promotes oxidative stress. Furthermore, most of this experimental evidence was obtained from different animal species, mainly rats and mice, using diverse sleep deprivation methods.

                                                              Although, https://pubmed.ncbi.nlm.nih.gov/14998234/ disagrees with this. Furthermore, it is known that oxidative stress promotes apoptosis, see Oxidative stress and apoptosis :

                                                              Recent studies have demonstrated that reactive oxygen species (ROS) and the resulting oxidative stress play a pivotal role in apoptosis. Antioxidants and thiol reductants, such as N-acetylcysteine, and overexpression of manganese superoxide (MnSOD) can block or delay apoptosis.

                                                              The article that you linked Stress effects on the hippocampus: a critical review mentions that stress has an impact on the development of the brain and on it’s workings:

                                                              Uncontrollable stress has been recognized to influence the hippocampus at various levels of analysis. Behaviorally, human and animal studies have found that stress generally impairs various hippocampal-dependent memory tasks. Neurally, animal studies have revealed that stress alters ensuing synaptic plasticity and firing properties of hippocampal neurons. Structurally, human and animal studies have shown that stress changes neuronal morphology, suppresses neuronal proliferation, and reduces hippocampal volume

                                                              I do not disagree with this. I think that anyone would be able to agree that stress is bad for the brain, possibly by increasing apoptosis (accelerating ageing), decreasing the availability of nutrients. My only argument is that the term brain damage is quite narrowly defined (for example here) as (large-scale) damage to the brain caused by genetics, trauma, oxygen starvation or a tumor, and it can fall into one of two categories: traumatic brain injuries and acquired brain injuries. If you search for “brain damage” on pubmed, you will find the term being used like this:

                                                              You will not find studies or medical diagnoses of “brain damage due to stress”. I hope that you can agree that using the term brain damage in a context such as the author’s, without evidence of traumatic injury or a stroke, is wrong. This does not take away the fact that the author has allegedly experienced a lot of stress at their previous employer, one of the largest and high-paying tech companies, and that this experience has caused the author personal issues.

                                                              On an unrelated note: what is extremely fascinating to me is that some chemicals such as methamphetamine (at low concentrations) or minocycline are neuroprotective being able to lessen brain damage for example due to stroke. But obviously, at larger concentrations the opposite is the case.

                                                              1. 1

                                                                How about this one then? https://www.sciencedirect.com/science/article/abs/pii/S0197458003000484

                                                                We can keep going, it is not difficult to find these… Your’re splitting a hair which should not be split.

                                                                What’s so wrong about saying a bad work environment can cause brain damage?

                                                                1. 1

                                                                  Your’re splitting a hair which should not be split.

                                                                  There is nothing more fun than a civil debate. I would argue that any hair deserves being split. Worst case, you learn something new, or form a new opinion.

                                                                  What’s so wrong about saying a bad work environment can cause brain damage?

                                                                  Nothing is wrong with that, if the work environment involves heavy things, poisonous things, or the like. This is why OSHA compliance is so essential in protecting people’s livelihoods. I just firmly believe, and I think that the literature agrees with me on this, that “brain damage” as a medical definition refers to large-scale cell death due to trauma or stroke, and not chronic low-level damage caused by stress. The language we choose to use is extremely important, it is the only facility we have to exchange information. Language is not useful if it is imprecise or even wrong.

                                                                  How about this one then?

                                                                  Let’s take a look what we got here. I’m only taking a look at the abstract, for now.

                                                                  Stress is a risk factor for a variety of illnesses, involving the same hormones that ensure survival during a period of stress. Although there is a considerable ambiguity in the definition of stress, a useful operational definition is: “anything that induces increased secretion of glucocorticoids”.

                                                                  Right, stress causes elevated levels of glucocorticoids, such as cortisol.

                                                                  The brain is a major target for glucocorticoids. Whereas the precise mechanism of glucocorticoid-induced brain damage is not yet understood, treatment strategies aimed at regulating abnormal levels of glucocorticoids, are worth examining.

                                                                  Glucocorticoids are useful in regulating processes in the body, but they can also do damage. I had never heard of the term glucocorticoid-induced brain damage, and searching for it in the literature only yields this exact article, so I considered this a dead end. However, in doing some more research, I did find two articles that somewhat support your hypothesis:

                                                                  In Effects of brain activity, morning salivary cortisol, and emotion regulation on cognitive impairment in elderly people, it is mentioned that high cortisol levels are associated with hippocampus damage, supporting your hypothesis, but it only refers to elderly patients with Mild Cognitive Impairment (MCI):

                                                                  Cognitive impairment is a normal process of aging. The most common type of cognitive impairment among the elderly population is mild cognitive impairment (MCI), which is the intermediate stage between normal brain function and full dementia.[1] MCI and dementia are related to the hippocampus region of the brain and have been associated with elevated cortisol levels.[2]

                                                                  Cortisol regulates metabolism, blood glucose levels, immune responses, anti-inflammatory actions, blood pressure, and emotion regulation. Cortisol is a glucocorticoid hormone that is synthesized and secreted by the cortex of adrenal glands. The hypothalamus releases a corticotrophin-releasing hormone and arginine vasopressin into hypothalamic-pituitary portal capillaries, which stimulates adrenocorticotropic hormone secretion, thus regulating the production of cortisol. Basal cortisol elevation causes damage to the hippocampus and impairs hippocampus-dependent learning and memory. Chronic high cortisol causes functional atrophy of the hypothalamic-pituitary-adrenal axis (HPA), the hippocampus, the amygdala, and the frontal lobe in the brain.

                                                                  Additionally, Effects of stress hormones on the brain and cognition: Evidence from normal to pathological aging mentions that chronic stress is a contributor to memory performance decline.

                                                                  We might be able to find a few mentions of brain damage outside of the typical context (as caused by traumatic injury, stroke, etc) in the literature, but at least we can agree that the term brain damage is quite unusual in the context of stress, can we not? Out of the 188,764 articles known by pubmed, only 18,981 mention “stress”, and of those the almost all are referring to “oxidative stress” (such as that experienced by cells during a stroke). I have yet to find a single study or article that directly states brain damage as being a result of chronic stress, in the same way that there are hundreds of thousands of studies showing brain damage from traumatic injuries to the brain.

                                                                  1. 2

                                                                    Well, if anybody asks me I will tell them that too much stress at work causes brain damage… and now I can even point to some exact papers!

                                                                    I agree that it’s a little hyperbolic, but it’s not that hyperbolic. If we were talking about drug use everyone would kind of nod and say, ‘yeah, brain damage’ even if the effects were tertiary and the drug use was infrequent.

                                                                    But stress at work! Ohohoho, that’s just life my friend! Which really does not need to be the way of the world… OP was right to get out, especially once they started exhibiting symptoms suspiciously like the ones cited in that last paper (you know, the sorts of symptoms you get when your brain is suffering from some damage).

                                                                    1. 2

                                                                      If someone tells me that they got brain damage from stress at work, I will laugh, tell them to read the Wikipedia article article and then move on. But that is okay, we can agree to disagree. I understand that there are multiple possible definitions for the term brain damage.

                                                                      If we were talking about drug use everyone would kind of nod and say, ‘yeah, brain damage’ even if the effects were tertiary and the drug use was infrequent.

                                                                      In my defense, people often use terms incorrectly.

                                                                      OP was right to get out

                                                                      I agree. Brain damage or not, Google employee or not, if you are suffering at work you should not stay there. We all have very basic needs, and one of them is being valued and being happy to work.

                                                                      Anyways, I hope you have a good weekend!

                                                            2. 6

                                                              I have not yet seen a study showing that stressful office jobs give people brain damage.

                                                              This is a bizarre and somewhat awful thread. Please could you not post things like this in future?

                                                              1. 8

                                                                I disagree. The post seemed polite, constructive, and led to (IMO) a good conversation (including some corrections to the claims in the post).

                                                                1. 4

                                                                  Parent left a clear method for you to disprove them by providing a counter-example.

                                                                  If you can point to some peer-reviewed research on the topic, by all means do so.

                                                                  1. 5

                                                                    Yea but this is an obnoxious, disrespectful, and disingenuous way to conduct an argument. I haven’t read any studies proving anything about this subject one way or another. Because I am not a mental health researcher. So it’s easy for me to make that claim, and present the claim as something that matters, when really it’s a pointless claim that truly does not matter at all.

                                                                    Arguing from an anecdotal position based on your own experience, yet demanding the opposing side provide peer-reviewed studies to contradict your anecdotal experience, places a disproportionate burden on them to conduct their argument. And whether intentional or not, it strongly implies that you have little to no respect for their experiences or judgement. That you will only care about their words if someone else says them.

                                                        1. 2

                                                          Looking to start a dialog and nothing else really. I’m having doubts about my recent thoughts on software longevity.

                                                          1. 7

                                                            Have you looked into Knuth’s efforts? For TaoCP he defined his own assembly language for this exact reason. TeX was implemented as a literate program in Pascal, which is an easy to implement, very stable target (it was designed to be implemented in a compiler class, after all). He probably is the person whose software has the longest intentional life of anything running today.

                                                            1. 1

                                                              I haven’t but that sounds perfect to check out - thank you!

                                                            2. 1

                                                              FWIW I’ve been enjoying your exploration of ideas around software longevity and hope you keep exploring ideas. You’ve helped push me to take a look at SML and provided an extra dimension of consideration around some half-baked ideas I was chewing on.

                                                              1. 3

                                                                Thank you, it’s motivating to know I’m not alone.

                                                                Just as an aside, the next “step” for me is writing my first real 100 year program; I’m still unsure what it will be. Most likely it’ll be something which replaces what I use frequently, like IRC, email, RSS feed reader, or a basic HTTP client to view and interact with simple web pages like lobste.rs. Thanks to the “simple web” movement the latter is becoming more useful again! My day job though involves full featured web browsers so it won’t sever me completely unfortunately.

                                                                I’ve also had the idea of writing a pidgin-like clone for services I use, so I can get a seamless experience using IRC, Facebook Messenger, Discord, Matrix, etc. I think the best idea is to transform all those messages into ActivityPub messages and then consume them… So essentially a bunch of ActivityPub bridges.

                                                              2. 1

                                                                A data point. One program I wrote back in 1991 I still use to this day. It’s in C, with no dependencies other than a standard C compiler (and the standard C library). It has been modified since then (in 1992, 2009, 2011, 2012, 2015, 2020 and 2021) so I’m unsure what that means in this context. Another program I wrote in 1999 that I still use today is in C (my blogging engine). And just for kicks, I just typed in a C program published in 1985 (but probably written earlier) and it worked as is (but with some warnings).

                                                                Now, am I saying that C should be a 100 year language? Well, it’s half way there. The only other contenders I see are Fortran, LISP, and Cobol (from an “it exists and is still used” perspective).

                                                                1. 2

                                                                  If Cobol counts, then so do Ada, Forth and Basic, all three still used in specific domains. If LISP counts, then so do SQL, APL and Prolog, whose original implementations aren’t used anymore but still live through other incarnations.

                                                                  And I’m sure I’ve forgotten a few others. That makes C a little less impressive I think.

                                                              1. 13

                                                                Clearly C is a distraction from ALGOL 68. ;)

                                                                1. 22

                                                                  I don’t understand. Nowadays people don’t remember their ASCII by heart any more?

                                                                  1. 25

                                                                    I genuinely hope this is a joke, because I’m 35 and been programming as a career for 12-ish years (including a 1-year paid internship) and I haven’t needed an ASCII chart more than a handful of times.

                                                                    1. 12

                                                                      Hahaha, I feel you.

                                                                      I guess it’s always other people who deal with stuff like vtys and software flow control and fast parsers and keyboard drivers for us.

                                                                      OTOH, man ascii. Typed in cool-retro-term for the best effect when teaching.

                                                                      I believe it’s nice to start with unescaped in-band formats, then move on to the escaped ones, then fixed layout and finally TLV.

                                                                      1. 5

                                                                        man ascii

                                                                        Did not know that was there. Nice!

                                                                        1. 4

                                                                          Ha, I just had to check to make sure \044 was what I thought it was when I saw it in a script yesterday.

                                                                        2. 8

                                                                          Being able to read hex and distinguish ASCII can come in handy in surprising places (especially during debugging).

                                                                          1. 1

                                                                            Recognizing SHIFT-JIS in hex has saved me days before.

                                                                          2. 2

                                                                            I’m sure it’s mostly a joke, but surely most developers know at least 1-3 ASCII codes by heart, especially full stack devs. When debugging HTTP-relates stuff you see stuff like %20 a lot

                                                                            1. 1

                                                                              Depends on what you work on, after many years of googling (no, I don’t have it ALL memorized) I started self-hosting one at an url I remember)

                                                                            2. 2

                                                                              Most people can’t read hexdumps anymore, and don’t have to thanks to improvements in tooling in recent years. We should be glad people don’t have to remember ASCII anymore :)

                                                                              1. 2

                                                                                Mine has rotted quite thoroughly out of my head. In the blue moon that I need to check, I just go pull up the table.

                                                                                Most of the character problems I deal with these days involve Unicode instead, or rather, people not understanding Unicode and screwing it up.

                                                                                1. 2

                                                                                  The last time I saw an ASCII chart printed in a book, it was published in the 80s (in fact, I think every computer book published in the 80s, at least in the US, had an ASCII chart somewhere in it). By the 90s, I think it was assumed ASCII was a known standard.

                                                                                  1. 1

                                                                                    I slacked off back in the days and didn’t get around to actually learning it. Then we switched to Unicode and I just gave up.

                                                                                    1. 6

                                                                                      FWIW, all the ASCII knowledge is still applicable; the first 128 Unicode characters matches 7-bit ASCII, and UTF-8 encodes the values below 128 as just plain bytes with those values. So when looking at most text using the Latin alphabet, you can’t tell if you’re looking at ASCII encoded as bytes or Unicode encoded as UTF-8 even when looking at a raw hex dump.

                                                                                  1. 15

                                                                                    In my experience the biggest reason I would not use SQLite on the server is its poor concurrency. Even if you have a single-process multi-threaded server and take advantage of SQLite’s unlock notification functionality, PostgreSQL will absolutely murder it on any sort of concurrent write-heavy’ish workload. Also, SQLite uses a really counter-intuitive locking sequence (I don’t remember the details off the top of my head but can dig it up) so you often have to use BEGIN IMMEDIATE to avoid being drowned in deadlocks.

                                                                                    1. 18

                                                                                      If you’ve been reading the recent wave of SQLite-on-the-server posts from a couple companies, the thing they have in common is low write loads.

                                                                                      Which is surprisingly common in more service-y setups — a single giant codebase, sure, SQLite isn’t the right fit, but once you’re doing some more focused services I think it would be rare not to have at least a few that are write-light or even effectively read-only. I’ve been working through this myself lately and starting to come around to the idea of using SQLite for those cases just because of the reduced number of moving parts to worry about.

                                                                                      1. 4

                                                                                        I think most (but not all) write-intensive SQL use-cases are for metrics or analytical tasks. (Because I’m assuming if one needs some persistent, but not critically persistent, state such as sessions, one would use some better suited system like Redis or any other generic KV store.)

                                                                                        In such scenarios I think nothing can beat a purposely built system like ClickHouse in both terms of raw IO, concurrency and throughput.

                                                                                        Thus, setting these aside, I don’t think write concurrency plays a huge role until the application becomes very (as in viral) successful.

                                                                                        1. 5

                                                                                          I don’t really think this is true. CRUD in general is often write heavy. It just depends on the details of the domain. Keeping state of an MMORPG? Very much write and read heavy.

                                                                                          1. 1

                                                                                            Keeping state of an MMORPG? Very much write and read heavy.

                                                                                            Even with classical SQL databases like PostgreSQL or MySQL, write heavy applications tend to be programmed in such a manner that lock contention is reduced as much as possible; there might be multiple writers, but the code is designed so that they don’t touch the same rows.

                                                                                            Thus at that point one doesn’t actually use the DB for its SQL capabilities, but instead more like a document or KV store; therefore perhaps a proper KV store might actually be the best solution…

                                                                                            1. 2

                                                                                              Why isn’t a SQL database a “proper” KV store? How exactly do you think SQL databases store rows on disk? It’s a KV store.

                                                                                              If 99% of your write workload is non-conflicting, why does that imply you should absolutely fuck yourself for the remaining 1% by using a “proper” KV store with inferior transaction support and inferior query ergonomics? Or worse, eventual consistency?

                                                                                              1. 1

                                                                                                Why isn’t a SQL database a “proper” KV store? How exactly do you think SQL databases store rows on disk? It’s a KV store.

                                                                                                Indeed a relational database can be seen as a KV store, where the key is the primary key and the value is the whole row, but in certain cases a plain-simple KV store (like LMDB that does include transactions) is perhaps more than enough (and simpler)…

                                                                                                1. 3

                                                                                                  Why is it simpler? If I literally never need to look up anything in my entire application by anything other than the primary key, maybe. But the instant I want to search for a value by some secondary key, I’m stuck manually implementing secondary indexes, and maintaining those indexes correctly as values are added, removed, and changed. In SQLite I type CREATE INDEX and I’m done. That is far simpler.

                                                                                              2. 2

                                                                                                Thus at that point one doesn’t actually use the DB for its SQL capabilities, but instead more like a document or KV store; therefore perhaps a proper KV store might actually be the best solution…

                                                                                                This is a strange statement. Avoiding lock contention is a fact of life with all databases. How does it somehow make it unnatural for SQL?

                                                                                          2. 1

                                                                                            How write-heavy are we talking? And are you talking into account SQLite’s WAL journalling mode?

                                                                                          1. 6

                                                                                            It’s also great for deploying read-only websites. My photo gallery is published as an S3 bucket full of images and a SQLite file; the web server is a Clojure application that has a local copy of the DB. Currently the deployment script works by downloading the DB from S3 and shoving it onto the web server’s file system, but there’s no reason the web server couldn’t just periodically fetch the DB for itself.

                                                                                            1. 3

                                                                                              This might be a fun option for replicating your database to the web server. https://litestream.io/

                                                                                              1. 1

                                                                                                Possibly, although rsync has served me well enough so far. If I had more traffic, I might be concerned about requests hitting a partially-written SQLite file, but then I could just switch to doing atomic file moves or a blue-green pair of DB files. I haven’t looked into Litestream, but whatever it is, it’s probably more complicated than that.

                                                                                                1. 1

                                                                                                  It almost isn’t. One could think of litestream as rsync for sqlite formatted files, with the option of doing continuous rsync.

                                                                                                  1. 2

                                                                                                    Mmm. But rsync is everywhere already, which automatically makes it simpler. :-)

                                                                                                    If I needed continuous uptime, the application code to do periodic fetches and swap-outs on the DB would probably take just a couple hours to write.

                                                                                                    1. 3

                                                                                                      I’m not trying to convince you to switch. I’m just saying litestream is probably a good replacement, if you ever find yourself needing to go beyond the lazy of rsync.

                                                                                                      If I needed continuous uptime, the application code to do periodic fetches and swap-outs on the DB would probably take just a couple hours to write.

                                                                                                      If you find yourself thinking of actually doing this; I almost guarantee Litestream would take less time and do it in a more foolproof way.

                                                                                              2. 2

                                                                                                That’s a nice setup that I’m going to keep in the back of my mind.

                                                                                                1. 1

                                                                                                  One other aspect is that when I sync to the server, this is the process:

                                                                                                  1. Upload all new image files
                                                                                                  2. Upload updated DB
                                                                                                  3. Delete all stale image files

                                                                                                  That way there’s very little chance of a dangling reference – even if the process is interrupted in the middle.

                                                                                                  (Images are all content-addressed as well.)

                                                                                              1. 40

                                                                                                It’s the standard bearer of the “single process application”: the server that runs on its own, without relying on nine other sidecar servers to function.

                                                                                                Now there’s an “SPA” I can get behind.

                                                                                                1. 3

                                                                                                  the server that runs on its own, without relying on nine other sidecar servers to function.

                                                                                                  And what happens when that single server fails?

                                                                                                  1. 20

                                                                                                    You start a new instance and issue litestream recover s3://…. or whatever and go on your way… That’s the product.

                                                                                                    The post also outlines future enhancements that will do read-replicas, so only writes would be unavailable while the replacement server boots.

                                                                                                    1. 11

                                                                                                      Not every program needs All The Nines.

                                                                                                      1. 9

                                                                                                        What happens when your single Postgres server goes down? The whole service is down. Same thing.

                                                                                                        1. 10

                                                                                                          I have never used a single Postgres server in production. Have you?

                                                                                                          Postgres failovers have been 100% reliable for me, but that requires tradeoffs in terms of setup complexity and write latency. I am perfectly happy to take a slightly more complex setup involving ‘one more sidecar server’, thank you.

                                                                                                          1. 4

                                                                                                            Sure. Back in the 1990’s, mind you. Losing a box and a Postgres instance is fairly rare and most web apps don’t have really massive uptime requirements.

                                                                                                    1. 3

                                                                                                      There are some interesting historical details in here but I have always thought and continue to think that MVC is a solution in search of a problem :)

                                                                                                      Models and views have always seemed very clear cut to me, but IMO the controller is where we often run into trouble. It seems to invite framework / library designers to shoehorn various disparate ideas into this sometimes ill fitting abstraction, and as a result you can end up with some very cumbersome tools like J2EE.

                                                                                                      1. 3

                                                                                                        The controller described in the original version of MVC is not something that users of GUI toolkits use today. It is handled by the windowing system. The more useful vestige that I generally refer to as a controller is parameterizing widgets like buttons or tables so you control their specific behavior (onClick, getLabel, isActive for a button, for example) by providing them with an object that implements those methods. This is how Cocoa uses it.

                                                                                                        You’re right about people trying to shoehorn things into MVC without understanding the constraints its solving for. I think that those constraints are:

                                                                                                        1. The views on the data must be able to operate and update completely independent of one another, so you need a choke point (the model) where there is an authoritative form of the data and views update based on that.
                                                                                                        2. You want to be able to reuse views so that you have a consistent UI language, so you set up that visual language and let people wire up the semantics of the language in a specific case.
                                                                                                        1. 1

                                                                                                          The Newton folks observed that the purpose of the controller is to avoid creating a specialised view for each model that it’s attached to. They then proposed that this is necessary only in environments where creating a specialised view is difficult. Their hypothesis was that class-based OO was a good fit for models (where you have many instances of the same class for different objects) but prototype-based OO was a better fit for UIs, where you want to adapt a generic view to your specific use.

                                                                                                          Given how well JavaScript has done as a UI language, I’m inclined to believe that their hypothesis has some merit.

                                                                                                          1. 1

                                                                                                            I’m inclined to agree as well. I have tended to pass in controller objects because I wanted to keep techniques to hand that worked in multiple languages, but prototypes are certainly an easier way. You can also do basically the same thing with anonymous subclasses in Java.

                                                                                                          2. 1

                                                                                                            That makes a LOT of sense. Thanks.

                                                                                                            Are there any frameworks or toolkits, either now or historically, that implemented this understanding of MVC?

                                                                                                            1. 2

                                                                                                              Most of them. Swing, Gtk+, Win32/MFC… The model/observer stuff isn’t really the GUI toolkit’s problem. It’s a way of organizing code. And they all have a way of specifying behavior of a widget for a particular case.

                                                                                                          3. 2

                                                                                                            MVC is a solution in search of a problem :)

                                                                                                            This is one way to look at it and your specific objections are clearly valid. I would also posit that another way to look at it is the MVC pattern is a natural outgrowth of separation of concerns albeit with ill-fitting demarcations. So, in Rails for example, you will often get a different flavor of the problem you outline with “skinny controllers and fat models”. I’ve seen this (and been responsible for) where the model object gets overloaded with responsibility and grows entirely out of control. In these cases, I find that MVC is usually the start of decent design but certainly not the end of it.

                                                                                                            1. 3

                                                                                                              To be fair, the MVC being described is local GUI interfaces, not the variation of it used by web frameworks.

                                                                                                              1. 1

                                                                                                                A very fair call-out!

                                                                                                              2. 1

                                                                                                                That’s a really excellent point. If I’m honest my opinions here are absolutely influenced by the fact that I have encountered way more ungainly MVC implementations than elegant ones, and perhaps I just need to be looking at or building the right kind of code-base to have a better experience with this pattern.

                                                                                                            1. 10

                                                                                                              I’m posting this as someone who has written a lot of front-end framework code over the last decade or so and anticipate continuing to do so for the foreseeable future. Nevertheless, it reinforces and enhances a few ideas that have been brewing in my mind lately:

                                                                                                              1. There are lots of new-ish (or seemingly new, anyway) native web APIs like the constraint validation API that tend to be overlooked.
                                                                                                              2. The UX for native web APIs is generally better or at least more mobile-friendly that ones that have been reinvented from scratch. For example, as a user, I would much prefer to a native date-picker from <input type="date"> than most third-party plugins, regardless of whether they’re jQuery plugins on mostly static sites or React or Vue plugins on mostly dynamic web apps. Accessibility is pretty much always better with the native APIs as well.
                                                                                                              3. Using native APIs and using frameworks like React is not an either/or proposition. Rather, the more a web app leans on native APIs, the more its code and dependencies are focused on core functionality rather than reinventing common widgets.
                                                                                                              1. 2

                                                                                                                TIL there’s an <input type="date">! I missed when that happened!

                                                                                                                In the article, your comment about controlling when things render is something I see a lot with React. One of the key points of React was not letting people control when to render, since it stopped teams at Facebook from clobbering each other’s refresh loops. If you don’t have a large number of teams all working on pieces of the same page, I have doubts about the whole approach.

                                                                                                              1. 4

                                                                                                                IMO this is a good candidate for a partitioned table. Partition by (e.g.) one month, and you can delete an entire month’s worth of data just by dropping the table.

                                                                                                                1. 2

                                                                                                                  The author mentions this at the bottom of the article.

                                                                                                                  1. 1

                                                                                                                    So they do.

                                                                                                                  2. 1

                                                                                                                    That may or may not be useful on SSDs/NVMe. One of the world’s MySQL experts that I know had a rant about this: partitioned tables are not faster if you’re not on spinning disks. I don’t remember the details but it was fairly compelling. This obviously depends on your storage engine. For something like Splunk where archival/deletion of cold buckets was a design goal for the storage engine it works fine, but Splunk is automatically partitioned by timestamp anyway.