by shubhamjain · 2y ago · 0 comments
1. Generating config files: Eg, Webpack, Docker-compose. Describe your use-case and it will generate the config file you need. This is usually faster than perusing docs and looking for specific flags/options.
2. Generating CLI syntax: jq, cat, tar, find. The flags/syntax are so hard to remember when you want to do something specific. ChatGPT does a great job here in quickly generating the command you want.
3. Solving problems when you're stuck: When I feel stuck with a problem or an error message, ChatGPT has proven to be an invaluable resource. Even when the answer it gave was wrong, a little hint in there was enough for me to find the solution I needed.
4. Generating functions you're too lazy to write: Often, you know how to write a function but you're too damn lazy to write it. Eg, use axios, go to this URL, get the contents and write it to CSV. Writing a function to do this feels like a chore. ChatGPT is a helpful assistant in this case.
Overall, I think there are plenty of ways the tool can save you time, even if you're skeptical about changing your whole workflow.
GitHub Search is my favorite tool and I don't think most people realize how powerful it is or how much they can rely on it. You can get so much intel from there, not just about how to use a library, but even esoteric URLs or some fingerprints that are only in a site you're trying to scrape or an app you're trying to reverse engineer... it's saved me a ton of time and is a great way to find specific resources that I'd never know existed otherwise.
Co-Pilot is also great but it's hard to explain why without just telling you to try it yourself. It's basically a super advanced auto-complete, but it's also more than that... it feels like a second brain that is running one thought ahead of you at all times. Sometimes I'm thinking through a problem and I just press tab and it's already thought of the solution.
> 4. Generating functions you're too lazy to write: Often, you know how to write a function but you're too damn lazy to write it. Eg, use axios, go to this URL, get the contents and write it to CSV. Writing a function to do this feels like a chore. ChatGPT is a helpful assistant in this case.
A friend swears by it and has whole single-page sites written by chatGPT in his internal lab.
Just to test your point, I've asked ChatGPT to write a VBScript function that returns false if the input is true and false if the input is false.
It wrote a seven-line function testing true, false and otherwise (clever, testing for null).
I would have just written a function to return false - one line that covers all conditions, including null. There is no testing, so it uses fewer CPU cycles.
So that's my rational: yes it can be used but don't just take the results at face value.
<insert to-be-fair meme here>
You purposefully asked GPT a trick question for which it likely has very little training data. No one would ever go on StackExchange et al. asking how to write a function that always returns false. So GPT had to take its training data on other, realistic questions and fumble something together.
A GPT can only ever be as good as its initial training material. It can not have new ideas or innovations.
There was an excellent post here a couple of days ago to an article, which explains quite well what a GPT can and can not do and why:
https://explainextended.com/2023/12/31/happy-new-year-15/
EDIT. GPT4 was happy to give me a one-liner that meets the conditions and even explains why my request was dumb:
https://chat.openai.com/share/1d949b5b-3c2b-4634-802e-3ea4c2...
It really doesn't do well with trick questions. If you ask it the river crossing problem but the boat is big enough to bring all the items, it insists on taking multiple trips. But that's okay. Because of AI we have to develop a more nuanced view of intelligence. previously, you could just place people on a 2d spectrum from dumb as a door nail to frighteningly smart. Now, because we have these things that are impossibly smart compared to a human in some dimensions but not in others, we have to give that 2d scale a lot more dimensions. Which always existed before, but most of us aren't cognitive psychologists.
That said, I wouldn't recommend using the standard ChatGPT interface for generating code -- just use a solution that integrates with your IDE/editor, and use it as some kind of coding autocomplete. (You can sometimes even trick the AI to converse with you in the comments, eg. /* Question: what is the gcc option to enable all warnings? Answer: <wait for completion>... ), so it can be super convenient when you just have a random question while typing code in your IDE or editor.
100% would recommend everyone to try it out.