←back to thread

53 points cmpit | 2 comments | | HN request time: 0.495s | source
Show context
throw16180339 ◴[] No.41920894[source]
My ChatGPT use falls into two categories:

1. Having it perform mechanical refactorings where there's no creativity involved. I'm hacking on a program that was written in the early 2000s. It predates language support for formatted IO. I had ChatGPT replace many manual string concatenations with the equivalent of sprintf. It's easy enough to test the replacements at the REPL.

2. Questions that would be unreasonable or impossibly tedious to ask a person.

Describe in detail the changes from language version X to language version Y.

Which functions in this module can be replaced by library functions or made tail recursive? This definitely misses things, but it's a good starting point for refactoring.

Is there a standard library equivalent of this function? I regularly ask it this, and have replaced a number of utility functions.

Give examples for using function.

replies(1): >>41921780 #
1. rerdavies ◴[] No.41921780[source]
You might want to try Claude 3.5 Sonnet instead of Chat GPT. Claude 3.5 Sonnet seems to be a generational advance over earlier AIs like Chat GPT. I find that I can reliably uses it in cases where Chat GPT produces pure hallucinatory nonsense. I've only seen Claude hallucinate once, and that after I had incorrectly told it that its answer was wrong. It's not the only AI that does code well, but at this particular snapshot in time (Oct 2024), general concensus seems to be that it is currently the best.

It has fundamentally changed the way I write code. And I'm still exploring the boundaries of what kinds of tasks I can feed it. (45 year veteran senior programmer).

Sorry for the TLDR post, but I find it difficult to briefly make the case for why Claude 3.5 Sonnet (and other similarly modern and capable AIs) are fundamentally different from smaller and older AIs when it comes to use as a coding assistant.

I do use it for simple tedious things like "Convert an ISO date string in GMT to a std::chrono::systemclock::timepoint" (requires use of 3 generations of C/C++/Posix library functions that would take about 15 minutes of wading through bad documentation and several false starts to get right).

But have also had success with larger fragments ranging up to 100 or 200 lines of code. It still has distinct limitations (bizarre choices of functional composition, and an unpleasant predilection for hard-coded integer constants, which can be overcome with supplementary prompts. Seems to be brilliant tactically, and shows a terrifyingly broad knowledge of APIs and libraries across the the three platforms I use (android/javascript, typescript/React/MUI, C++/linux). But doesn't yet have a good sense of strategic coding (functional and class decomposition &c).And usually requires three or four supplementary prompts to get code into a state that's ready to copy and paste (and refactor some more). e.g. "Wrap that up in a class; use CamelCase for classnames, and camelCase for member names. ... &c &c.

And have also used it help me find solutions to problems that I've spent months on ("android, java: unable to connect to an IoT wi-fi hotspot without internet access when the data connection is active"; Claude:" blah blah ... use connectivityManager.bindProcessToNetwork()"!!!).

Or "C++/linux/asound library: why does this {3000 lines of code} fail to reliably recover from audio underruns".

And had some success with "find the wild memory write in this 900 line code fragment". Doesn't always work, but I've had success with it often enough that I'm going to use it lot more often.

And used it to write some substantial bash scripts that I just don't have the skills or literacy to deal with myself (long time Windows programmer, relative newcomer to linux).

replies(1): >>41923193 #
2. sireat ◴[] No.41923193[source]
What is a good way to integrate Claude 3.5 Sonnet into Visual Studio Code based workflow?

That is how to get the tight integration that Copilot offers but with Claude?

I've been using Github Copilot since the technical preview in mid 2021 and it too changed fundamentally how I write code. Perhaps I've gotten too used to it.

I find that regular LLM chat interfaces break the flow for me.

My usual use is to use Copilot as a rubber ducky or an eager junior assistant of sorts That is I would write

  //Converting an ISO date string in GMT to a  std::chrono::systemclock::timepoint 
and then it is Tab time.

If the result is not so good it means my requirements were not detailed enough. Rarely will it be completely unusable.

As a side effect I am forced to document more of my work, which is a good thing.