← Back to context

Comment by fsloth

6 days ago

The program behaves as you want.

No, really - there is tons of potentially value-adding code that can be of throwaway quality just as long as it’s zero effort to write it.

Design explorations, refactorings, erc etc.

And how do you know it behaves like you want?

This is a really hard problem when I write every line and have the whole call graph in my head. I have no clue how you think this gets easier by knowing less about the code

  • Tests pretty much. Not a silver bullet for everything, but works for many cases.

    Unless you're a 0.1% coder, your mental call graph can't handle every corner case perfectly anyway, so you need tests too.

    • No one is saying you shouldn't write tests. But we are saying TDD is dumb.

      Actually, for exactly the reasons you mention: I'm not dumb enough to believe I'm a genius. I'll always miss something. So I can't rely on my tests to ensure correctness. It takes deeper thought and careful design.

  • By using the program? Mind you this works only for _personal_ tools where it’s intuitively obvious when something is wrong.

    For example

    ”Please create a viewer for geojson where i can select individual feature polygons and then have button ’export’ that exports the selected features to a new geojson”

    1. You run it 2. It shows the json and visualizes selections 3. The exported subset looks good

    I have no idea how anyone could keep the callgraph of even a minimal gui application in their head. If you can then congratulations, not all of us can!

    • Great, I used my program and everything seems to be working as expected.

      Not great, somebody else used my program and they got root on my server...

        > I have no idea how anyone could keep the callgraph of even a minimal gui application in their head
      

      Practice.

      Lots and lots of practice.

      Write it down. Do things the hard way. Build the diagrams by hand and make sure you know what's going on. Trace programs. Pull out the debugger! Pull out the profiler!

      If you do those things, you too will gain that skill. Obviously you can't do this for a giant program but it is all about the resolution of your call graph anyways.

      If you are junior, this is the most important time to put in that work. You will get far more from it than you lose. If you're further along, well the second best time to plant a tree is today.

      1 reply →

  • how do you know what you want if you didn't write a test for it?

    I'm afraid what you want is often totally unclear until you start to use a program and realize that what you want is either what the program is doing, or it isn't and you change the program.

    MANY programs are made this way, I would argue all of them actually. Some of the behaviour of the program wasn't imagined by the person making it, yet it is inside the code... it is discovered, as bugs, as hidden features, etc.

    Why are programmers so obsessed that not knowing every part of the way a program runs means we can't use the program? I would argue you already don't, or you are writing programs that are so fundamentally trivial as to be useless anyway.

    LLM written code is just a new abstraction layer, like Python, C, Assembly and Machine Code before it... the prompts are now the code. Get over it.

    •   > how do you know what you want if you didn't write a test for it?
      

      You have that backwards.

      How do you know what to test if you don't know what you want?

      I agree with you though, you don't always know what you want when you set out. You can't just factorize your larger goal into unit tests. That's my entire point.

      You factorize by exploration. By play. By "fuck around and find out". You have to discover the factorization.

      And that, is a very different paradigm than TDD. Both will end with tests, and frankly, the non TDD paradigm will likely end up with more tests with better coverage.

        > Why are programmers so obsessed that not knowing every part of the way a program runs means we can't use the program?
      

      I think you misunderstand. I want to compare it to something else. There's a common saying "don't let perfection be the enemy of good (enough)". I think it captures what you're getting at, or is close enough.

      The problem with that saying is that most people don't believe in perfection[0]. The problem is, perfection doesn't exist. So the saying ends up being a lazy thought terminator instead of addressing the real problem: determining what is good enough.

      In fact, no one knows every part of even a trivial program. We can always introduce more depth and complexity until we reach the limits of our physics models and so no one knows. Therefore, you'll have to reason it is not about perfection.

      I think you are forgetting why we program in the first place. Why we don't just use natural language. It's the same reason we use math in science. Not because math is the language of the universe but rather that math provides enough specificity to be very useful in describing the universe.

      This isn't about abstraction. This is about specification.

      It's the same problem with where you started. The customer can't tell my boss their exact requirements and my boss can't perfectly communicate to me. Someone somewhere needs to know a fair amount of details and that someone needs to be very trustworthy.

      I'll get over it when the alignment problem is solved to a satisfactory degree. Perfection isn't needed, we will have you discuss what is good enough and what is not

      [0] likely juniors. And it should be beat out of them. Kindly