Hacker News new | ask | show | jobs
by neuronet 558 days ago
If I were a trained professional software engineer who found joy in writing tests and TDD, maybe I'd feel differently, but I write software to help with basic scientific analysis, and ChatGPT has been an absolute game changer for writing tests.

I personally find writing tests to be soul-crushing, boring, work. I never really learned it properly, and when I have a well-documented function, CGPT typically does a decent job making a rough draft. I often have to work on the test function, fix some things, but the final product is way better than the PoS I would have put together: my guess is it has saved me hundreds of hours. I have developed a decent understanding of fixtures, mocking, sharing fixtures across modules, etc, all with the help of ChatGPT. It "understands" my project and how it is organized, and makes suggestions based on this understanding. Yes, it sometimes gets stuck in local minima and I have to kick it out, which can be frustrating. But even that is a learning process, as I often go to SO or other people's code bases to find good examples, and feed them to ChatGPT to get it unstuck.

It's like the ultimate rubber duck paired programming partner. I tell it what I'm working on, and that's intrinsically helpful. But the rubber duck has really good feedback, because it has read the entire internet.

It's made writing tests for my code fun, for the first time ever.

The people I know personally who refuse to use CGPT are typically very good software developers, somewhat arrogant and have a chip on their shoulders, and honestly I think in 20 years we'll look back at them like people who thought the internet was a passing phase in the mid 1990s. I also think many of them don't understand how LLMs work, and how powerful they can be when prompted correctly

2 comments

Tests are usually soul crushing and boring for the same reason PHP was in 1999 - a complete lack of structure, tooling and separation of concerns made it tedious and difficult.

I find it interesting that when people describe to me how they use LLMs to write code it's either short throwaway scripts or to write the kind of code that would make me retch (e.g. tests stuffed full of horrible mocks, spaghetti boilerplate).

Bear with me here: what if that retch-inducing code works fine? It's generated by an AI, can be understood by an AI (presumably), does what it should, so why should it be palatable for a human? You're not in the loop anymore...
If it remains perfectly bug free until the end of time then yes it's fine /s
And when a bug shows up (as they always do), some AI will fix it.
The difference with the internet is that it was not the people on the inside calling it useless (engineers). It was the business people and others who had no understanding of the technology and possibilities.

In this case it is the opposite, the best ML/software engineers today think this is a passing phase. It's the general population and business people who are claiming it to be revolutionary.

Only time will tell though

There is reasonable debate about their scope and limits, but it's hard to find anyone who understands how LLMS work that thinks they are a passing phase.

The pushback I see is from people who were raised to write everything from scratch, who don't trust the output of LLMS because of "hallucinations" or other crappy outputs. The problem is, the people making these claims are really out of touch with prompt engineering, and how students are currently learning to code with AI in-the-loop (and for basic coding and testing etc for common libraries, LLMs are really, really good at explaining things and writing entry-level code and tests -- this is not arguable: people that are fighting this are graybeards that haven't learned to code at a basic-to-intermediate level in a long time).

A good software developer, with a nose for code smells, will not just accept any old code an LLM produces, you have to use it intelligently, push back on bizarre constructions. Hence, for me, who hates writing tests, it is an amazing tool. If I had an intern or an undergrad who loved grindout out tests I'd use them, but that's basically my LLM at this point (and for the "but ackshually" guys yes obviously you can't use them mindlessly, we are writing code not drawing doodles).

Excellent strawman, good job!