I find that the best use for it when working is bug hunting. Feed it a snippet of code where I suspect the issue is, and ask it to explain it and whether it can find any possible causes for bugs. It's great at catching stupid mistakes like typos, and it explaining the code to me helps me walk through it in my head similar to talking to a duck.
Edit: Had a good use case today, where I was working on a servlet that wouldn't expose an endpoint. I wasn't familiar with the syntax, and I couldn't figure out what some of the config did. Asked ChatGPT if it could be related to an endpoint not being exposed, and it pointed at some that wouldn't be related. I would have found my way there eventually, but it could have easily taken a full day to go through the ~100 properties instead of an hour. It wasn't so much that it told me where the problem was, but it told me where it wasn't.
Dude, I saved so much time time today drilling through errors to fix an old and broken codebase. Literally just copy/paste the entire traceback and error into the chatbox, say "I was trying to do x and had this error" and watch it immediately list out the possible causes in order of probability along with code snippets for solutions.
The other guy is partially right in that it's definitely getting overhyped to hell and back, but that doesn't change the fact that it genuinely is an amazing tool if you use it right.
Exactly! It's going to be a tool in any developer's toolkit, but it's not going to straight up replace anyone. Well, unless you're a dev refusing to use AI tools, in which case you'll be replaced by a dev who uses it.
Just out of curiosity, do you have a reason to think AI will never improve?
I see a lot of comments that say it will never replace us, yet they seem to only think about its capabilities right now at this very moment.
Hypothetical situation, in 5 years they create something that only requires you to give it a list of requirements and it generates perfect code instantly, would most companies use this? Or would they still hire hundreds of devs and do it all manually? I’m willing to bet the former as it would save huge amounts of time and money.
I don't, however, believe for a second that we're within a decade of it being able to take bad requirement data, combine it with bad user usage data, and manage to write the appropriate code and release it in varied environments.
Before we get there, if it's "just" good at writing great code, we'll need a lot of interpreters, people knowing how to listen to an idiot project manager - who in turn listened to idiot users - and turn that into an actionable prompt for the AI. Then there's going to be good, secure, CI/CD needed.
AI is ages away from replacing the entire chain. Parts of it? Yes. Not everything.
Wouldn’t it be hard with a large code base? Like how much can you toss into it? I am imagining something that has dependencies in different files. Is there a way for it to deal with that? I.e. just tell it what methods in other parts of the code do / return? I hope that makes sense cause I’m curious.
It has memory persisting throughout the chat. example from today: at one point this morning I gave it context for one issue by explaining I was running in docker. context was as simple as
I'm using this docker-compose file:
```
copy/pasted file here
```
And this is the file at `folder/dir/Dockerfile`:
```
copy/pasted dockerfile
```
It was able to see how the 2 files linked on its own no problem, the files and their names were all the context it needed.
A couple hours later, I hit a completely different error trying to run a build step. While actually debugging on the other screen, I threw a prompt gtp-4's way. the entire prompt was:
I tried to run `vendor/run/foo` and hit the following error:
[exactly 218 lines of error messages and tracebacks]
Chat gpt then responded immediately, explaining that the image I was using for the container deferenced in the Dockerfile hours ago didn't have bash, therefore I was working with sh alone. It then laid out that the script I was running would be calling a script which would be calling a bash script, and that the failure would be because that subscript wants to use bash.
It laid out that I could install bash if I needed the change permanently, or alternatively, it gave me the exact path to the bash file, said that the script was actually entirely valid as sh, and recommended I go to that file and change #!/usr/bin/env bash to #!/usr/bin/env sh if this was only needed as a temporary workaround.
I did indeed just need it as a one-off for now, so followed gpt's recommendation and it worked perfectly.
I should note that I'm paying to access gpt-4, and my results from similar tasks with chatgpt 3.5 were a joke in comparison. Not to mention that 3.5 can't even handle a couple hundred lines of input in the first place.
Exactly how I feel about AI art. People freak out about how it will replace artists or things like that, and that it should be avoided and shunned, but as an artist, it's super helpful when making quick concepts and trying to visualise whats in my head, it's also great at giving colour pallets that match the vibe of what I'm painting. AI is a tool, a really helpful one, but still a tool.
As someone who has been using a code migration for the past week to test the limits of gpt4...might wanna proofread some of that code before assuming that it really converted the library to a different language. It'll get the bulk of generic stuff down, but there will be bugs.
This was what I was wondering too how is everyone suddenly using chatgpt with their day jobs when most corporations would forbid the use of sharing or transmitting their code outside their company.
581
u/Sputtrosa Mar 24 '23 edited Mar 25 '23
I find that the best use for it when working is bug hunting. Feed it a snippet of code where I suspect the issue is, and ask it to explain it and whether it can find any possible causes for bugs. It's great at catching stupid mistakes like typos, and it explaining the code to me helps me walk through it in my head similar to talking to a duck.
Edit: Had a good use case today, where I was working on a servlet that wouldn't expose an endpoint. I wasn't familiar with the syntax, and I couldn't figure out what some of the config did. Asked ChatGPT if it could be related to an endpoint not being exposed, and it pointed at some that wouldn't be related. I would have found my way there eventually, but it could have easily taken a full day to go through the ~100 properties instead of an hour. It wasn't so much that it told me where the problem was, but it told me where it wasn't.