News for hackers. Stuff that matters.
Re:Why LLM-Powered Programming Is More Mech Suit Than Artifi... by vlovich123 on Monday April 21, 2025 @11:54AM (#43753357)
By building a high level abstract understanding of how things operate & then understanding how that abstractions need to be expressed. Writing code certainly is more concrete and can highlight mistakes like when there's a gap in your understanding vs spots where details matter more specifically.

At many big tech companies I've worked out, an abstract design proposal precedes any actual coding for many tasks. These design proposals are not about how you lay out code or name variables, but a high level description of the problem and the general approach to solve the problem.

Expressing that abstract thinking requires writing code but that's the "how" - you can write that same code many ways.

Re:Why LLM-Powered Programming Is More Mech Suit Than Artifi... by codr7 on Monday April 21, 2025 @12:02PM (#43753479)
If you haven't solved exactly the same problem before, specifying a solution before writing code is a bad idea imo. More often than not, it turns out that the prematurely defined general approach isn't very optimal.

Which points at a pretty substantial limitation of LLM coding...

Re:Why LLM-Powered Programming Is More Mech Suit Than Artifi... by skydhash on Monday April 21, 2025 @12:09PM (#43753557)
The solution is always out there. The code is just an automated way to get it without the error prone way of humans doing manual calculations. But sometimes, your understanding is flawed, so the code you write is not the correct way to have the solution. Which is why you have to get actual correct answers (specs) before writing code.

Correctness is not embedded in software. It's embedded in the real world.

Re:Why LLM-Powered Programming Is More Mech Suit Than Artifi... by vlovich123 on Monday April 21, 2025 @01:04PM (#43754086)
Typically I find a novel problem domain requires roughly about 3 attempts from scratch to get a maintainable longer-term solution. However, that still requires having some idea in mind to try before just writing code. Of course you might also do some prototyping on certain subparts of the problem but there’s only so much of that that can be done and you’re still trying out what expressing high level ideas looks like / how it works.

I don’t think there’s anything where the first step is writing code. It’s like saying the first step of solving a math problem is writing down equations.

Re:Why LLM-Powered Programming Is More Mech Suit Than Artifi... by skydhash on Monday April 21, 2025 @12:05PM (#43753512)
> By building a high level abstract understanding of how things operate & then understanding how that abstractions need to be expressed. Writing code certainly is more concrete and can highlight mistakes like when there's a gap in your understanding vs spots where details matter more specifically.

The whole argument behind TDD is that it's easier to write code that verify something than actually implement the code. Because it only have the answer, not the algorithm to solve the question.

So for any code you will be writing, find the answers first (expected behavior). Then add tests. The you write the code for the algorithm to come up with the answer.

Static typing is just another form of these. You tell the checker: This is the shape of this data, and it warns you of any code that does not respect that.

Re:Why LLM-Powered Programming Is More Mech Suit Than Artifi... by vlovich123 on Monday April 21, 2025 @01:08PM (#43754137)
And an even stronger approach than TDD would be to develop a formal proof in something like Coq. At some point you have to define your algorithm and it’s easier when you actually have some inkling of how it would work rather than just trying to blindly get a test suite to pass.
Re:Why LLM-Powered Programming Is More Mech Suit Than Artifi... by immibis on Monday April 21, 2025 @07:18PM (#43757558)
This is the extreme end of the static checking spectrum - so extreme that you can spend hours or days per line of code, and it's so slow that about five people in the world do it on production code (and their customers pay handsomely for knowing it has been checked this way).
Re:Why LLM-Powered Programming Is More Mech Suit Than Artifi... by vlovich123 on Monday April 21, 2025 @07:33PM (#43757624)
Sure. But even there you start with an understanding of how you want to solve the problem and then spend all your time writing the proof in a way that the computer can prove that you have indeed solved it correctly. At all times you generally start with an idea of a solution - you might prototype stuff to test out different solutions and how you like them but with things that are less pure R&D you need to prototype less.
Re:Why LLM-Powered Programming Is More Mech Suit Than Artifi... by tsimionescu on Tuesday April 22, 2025 @04:19AM (#43760094)
TDD in this sense of building a test suite before ever having working code, or even worse, the style of TDD that Uncle Bob presents in his book, where you write some test code, then some production code to make the test pass, then some more test code, then some more production code etc. is a fantasy and/or a disaster. Especially if we're talking at the level of unit testing: unless you have a very clear outline of the code that you're going to write, and unless the problem is very well specified, you'll throw away 90% of the tests you've written as your code evolves, wasting inordinate amounts of time in the process.

Regular static typing (assuming you don't go to the level of dependent types or something) has the advantage that it is extremely quick to write, compared to an equivalent test. So even if you get the types wrong 90% of the time on the first pass, you've still wasted only a trivial amount of time (consider how long it takes to write "int foo(int x)" versus tests that fail if "foo(x)" accepts anything except an int, or returns anything except an int for any int input - and how much work you'd throw away if you later realize you have to replace int with string).

Re:Why LLM-Powered Programming Is More Mech Suit Than Artifi... by pydry on Tuesday April 22, 2025 @04:51AM (#43760217)
>unless the problem is very well specified

Why wouldnt you decide what your code should do before writing it?

Re:Why LLM-Powered Programming Is More Mech Suit Than Artifi... by jstanley on Tuesday April 22, 2025 @10:54AM (#43762943)
Why wouldn't you just get everything right the first time and never need to learn anything new?
Re:Why LLM-Powered Programming Is More Mech Suit Than Artifi... by pydry on Tuesday April 22, 2025 @02:02PM (#43764736)
Getting everything right the first time != deciding what you're trying to achieve before you write the code to achieve it.
Re:Why LLM-Powered Programming Is More Mech Suit Than Artifi... by tsimionescu on Wednesday April 23, 2025 @01:59AM (#43769074)
If you write unit tests for what you're trying to achieve, and then after you achieve it it turns out you didn't get everything right and the code was supposed to do something different, then those unit tests were almost pure waste: you have tests that assert your code is doing the wrong thing (which you thought was the right thing intially). So not only is the code wasted, the unit tests that tested it, which are likely much more code overall, are added waste.
Re:Why LLM-Powered Programming Is More Mech Suit Than Artifi... by pydry on Wednesday April 23, 2025 @07:14AM (#43770749)
>If you write unit tests for what you're trying to achieve, and then after you achieve it it turns out you didn't get everything right and the code was supposed to do something different, then those unit tests were almost pure waste

And the code changes were pure waste too.

That's why it's important to try and reduce the risk of building to the wrong requirements wherever possible - fail fast and often, use spikes and experiments, use lean, etc.

It's why it's important to reduce the cost of writing tests and code as much as possible too.

Writing the test itself and showing bits of it to others can actually help uncover many requirements bugs too. That's called BDD.

However, if it turned out it was the right thing and you didnt write a test you've just made it much harder to change that code in the future without breaking something. The cost of code changes went up.

Re:Why LLM-Powered Programming Is More Mech Suit Than Artifi... by tsimionescu on Wednesday April 23, 2025 @01:28PM (#43774511)
> And the code changes were pure waste too.

Yes, I said so as well. Though it's also important that the code changes are likely to be the thing that reveals that the feature is misunderstood/badly specified. Lots of people can take a working feature and tell you if it addresses their problem. Much fewer can look at a set of unit tests and tell you the same.

> However, if it turned out it was the right thing and you didnt write a test you've just made it much harder to change that code in the future without breaking something. The cost of code changes went up.

Very much debatable. If the code needs to change because requirements themselves change in the future, the tests that are validating the old requirements are not helpful. And many kinds of refactoring also break most kinds of unit tests too.

From my experience, unit tests are most useful for testing regression cases, and for validating certain constrained and well defined parts of the code, like implementations of an algorithm. They're much less useful for testing regular business logic - integration tests are a much better solution for those.