19 ms·
Tips for better coding with ChatGPT
- foxbyte 3y agoThat's a valid point. Even as AI evolves, human supervision remains crucial. Pair programming with AI could enhance its utility safely.
- iLoveOncall 3y ago[flagged]
- lijok 3y ago[flagged]
- moron4hire 3y agoI have 20 years of experience and thought the article was a pretty good summary of LLM tools and techniques for programming. While it is admittedly pretty high-level, I don't expect an article in Nature to go much deeper on any topic, let alone software development. And it definitely doesn't have "OpenAI Voice". This was a less formal, less pedagogical style than ChatGPT tends to generate.
- iLoveOncall 3y ago"Six tips for better coding" implies detailed tricks, not a high level presentation. I'm sure the "author" rewrote it, I'm just saying they probably got the substance from ChatGPT.
- pwython 3y agoFor those saying Jeffrey Perkel has "no programming experience," please see: https://scholar.google.co.uk/scholar?as_q=&btnG=Search+Scholar&as_sauthors=%22Jeffrey+M.%2BPerkel%22 https://scholar.google.co.uk/scholar?as_q=&btnG=Search+Schol...
- sanitycheck 3y agoI had a good skim through those myself after seeing the (now flagged) comment you're referring to, and I didn't spot any evidence of programming experience. That's not to say there isn't any, of course! He seems to be a career science writer, and former biologist.
- pwython 3y agoVery late reply, but hey, here's an example of Jeff's programming knowledge: https://observablehq.com/@jperkel/example-executable-observable-notebook https://observablehq.com/@jperkel/example-executable-observa... I believe he is very familiar with C, R, Python, Julia, and other languages.
- chank 3y ago> Trust but verify... Based on my own attempts to have ChatGPT generate code for me, it's better to NOT trust it. It tends to hilucinate even with simple requirements.
- apples_oranges 3y agoI think they should use a different name altogether for chatGPT 4 as it is very different and superior to 3.5. And when people say chatGPT doesn't work for me, I would like to know which one they tried.
- ben_w 3y agoMm. One of the cases where cute corporate names for each version would actually help. GPT: Alice; GPT-2: Bob; GPT-3: Carol; GPT-3.5: Mountain Carol; GPT-4: Dallas; …; GPT-19: Sydney
- danielbln 3y agoThey did that for a while during the GPT-3 days, Ada, Babbage and Davinci all were/are different variations of GPT-3.
- ducharmdev 3y agoI was chatting with someone I know that has a paid subscription for ChatGPT 4. I was venting about the hallucinations I was getting for a certain problem; they mentioned how much better v4 is, and proceeded to plug my prompt into it. The answer it gave was actually a more blatant lie compared to the responses I got from v3.5.
- paulmooreparks 3y agoI've been seeing this "try ChatGPT 4" advice all over HN. I am using 4, and it still hallucinates and generates quite useless code. It's only marginally better in my experience.
- agentcoops 3y agoIf you're already a programmer, there's no excuse for not working directly with the APIs. Learn about context and prosper.
- Archipelagia 3y agoEh, I might be a whiner, but I seeing that nature.com, I expected something better than a Malcol Gladwell level article. Okay, the tip with anthropomorphisation is okay, and reminding people that you can't believe in LLMs output is always good... but, like, I'd assume an average Nature reader is smart enough to not need tips like "iterate" or "embrace change".
- deleted 3y ago[deleted]
- culebron21 3y agoI gave this a try and got disappointed seeing "common sense" kind of reasoning, too. Regarding Malcolm Gladwell, do you mean the "Blink" book?
- grzracz 3y agoI've been using it for weeks, but recently it was so gutted that it barely understands TypeScript. I do my own coding again because sifting through all the possible bugs is more work than just writing it yourself. A true shame, because before it got "faster" it was capable of creating entire apps.
- anotherpaulg 3y agoI've been using the openai apis to write and edit code for 3-4 months now. So I think that makes me an old timer (ha!). I have also been building tooling for improving the chat based coding experience [0]. All of this work has given me an opportunity to think about how to work best with GPTs on coding, and I've shared some thoughts about this in the past [1]. Here are some of my thoughts on how to code with chatgpt. Many overlap with topics covered in the Nature article. - It really does help to think of chatgpt as a junior coder. I mentioned this in the writeup about my first AI coding project [2]. A bunch of things in this list would also be helpful when working with a junior dev. - GPT isn't good at code architecture. It will repeat code and take the shortest, laziest path to coding up your request. You need to walk it through changes like you might with a junior dev. Ask for a refactor to prepare, then ask for the actual change. Spend the time to ask for code quality/structure improvements. - Don't copy-and-paste between a chat session and your files. Use a tool like Copilot [3] or aider [0] that will give GPT your code to edit and apply its changes automatically. This is critical as it removes friction and lets you iterate quickly on code with GPT. - GPT is amazing at generating fresh new self-contained code. It takes more skill and better tools to work with it to edit existing code. - Break down a big change and ask for a series of smaller, self contained steps. This is a smart way to code solo, but really helps GPT succeed at more complex code modifications. - GPT has a wide breadth of coding knowledge, and impeccable command of syntax... but it is sometimes overconfident about details. So it will usually choose the right library for a task, but sometimes make an error about the details of the api/method/params. Paste doc snippets or error messages into the chat and it will fix those bugs. - GPT is really strong at churning out good boilerplate and roughing in a solution. This reduces the activation energy required to start larger changes or changes which will require unfamiliar libraries/packages/languages. GPT can can quickly prepare the ground for you to do the interesting work. - If you can, use gpt-4 (not gpt-3.5-turbo) since it can successfully generate larger, more complicated code changes. [0] https://github.com/paul-gauthier/aider https://github.com/paul-gauthier/aider [1] https://news.ycombinator.com/item?id=36020809 https://news.ycombinator.com/item?id=36020809 [2] https://github.com/paul-gauthier/easy-chat https://github.com/paul-gauthier/easy-chat [3] https://github.com/features/copilot https://github.com/features/copilot
- SOLAR_FIELDS 3y ago
- ionwake 3y agoDoes anyone know if you can use Copilot with Gpt4 ? I already have gpt4 access but have not been able to approved for code interpreter hence I am still using chat to handle code tasks.
- leodriesch 3y agoGitHub Copilot X [0] seems to be exactly that, it is in technical preview with a waitlist. [0]: https://github.com/features/preview/copilot-x https://github.com/features/preview/copilot-x
- deleted 3y ago[deleted]
- mellosouls 3y agohttps://github.com/github-copilot/chat_waitlist_signup/join https://github.com/github-copilot/chat_waitlist_signup/join I can't remember what the other platform options are, but for VSCode you need to use a preview version, which has meant I haven't had much time to test it yet as I'm full on with the stable release. But as an example I can select a block of code and ask it to generate tests, explain it or various other stuff. I haven't tried it further yet to see to what extent is provides value beyond just saving copying and pasting and establishing a context in ChatNormal. It's not clear either that it is 4 as you requested; it may be the default 3.5, I've had a very brief look but couldn't see the spec. Update, according to the Verge, its 4: https://www.theverge.com/2023/3/22/23651456/github-copilot-x-gpt-4-code-chat-voice-support https://www.theverge.com/2023/3/22/23651456/github-copilot-x...
- siva7 3y agoI got access to Copilot X and it's certainly nowhere near the capabilities of GPT-4, so i assume its 3.5-turbo, even Phind.com is significantly better
- gumballindie 3y agoNow nature.com gives “coding” advice? Is openai paying for such articles or are they bored?
- dlb007 3y agosame thought
- visarga 3y agoI thought you needed to publish amazing discoveries to get in. We have a million articles about prompting already.
- palunon 3y agoFor an article in the Nature scientific journal, sure. For an op-ed on Nature.com? Nah.
- progx 3y ago0185 clickbait with absolut common advices. This could be written by ChatGPT.
- juujian 3y agoIf you frequently browse Hacker News, you are probably not the main audience. I just sent this to one of my less technology-savvy colleagues in my discipline, because it is difficult to find content that provides a realistic expectation of what ChatGPT can and cannot do for people who do not currently write code but need to keep up with things.
- juujian 3y agoIt's an editorial from one of their technology editors. I have read a ton of useful editorials from Nature throughout my academic career -- not sure if it's beyond their scope, but I would be sad to see it go.
- agentcoops 3y agoFurther evidence of my justified true belief that the world will rapidly divide between those who already had programmatic control over their computers, now infinitely more productive through direct access to the GPT APIs (to say nothing of the firms that will use LLMs only internally, trained on their own codebase for example) and those who believe GPT=ChatGPT, which will slowly become but another conduit for ads through plugins. It's quite sad when even Nature magazine becomes a spokesperson for the latter group, who will continue to believe that LLMs are a racket on the order of Bitcoin.
- da39a3ee 3y agoYes I think I have a similar sentiment. Articles like these would do better to take the approach of "Oh shit, something huge is happening and we might not be intelligent enough to see the ramifications, but here's a humble attempt" rather than "Ha, the techies have done something they think is impressive again. It's certainly interesting, but as usual they're exaggerating it and failing to think from a nuanced human perspective. However us journalists are trained in that sort of thing, so we can help out here, and we know you readers will be all too familiar with the way those techies can only think like computers lol."
- throwaway4aday 3y agoThe second group is going to be using chat interfaces in every app whether they like it or not in under 2 years. I think it'll be a net benefit, boomers (and everyone else too) will finally get their wish of just telling the computer what to do.
- mym1990 3y agoAnd with computers there was a divide between those willing to learn to program and those using the applications that were programmed...whats your point? The majority of society needs a pretty big level of abstraction to be willing to use something.
- Jeff_Brown 3y ago> now infinitely more productive How much more productive do you feel you are coding with an LLM? As another HN user said, to me it's like a talking dog -- incredible yet useless.
- endisneigh 3y agoI've used GPT-4 before it changed, and though impressive, writing code has never been the bottleneck for me personally. When these things can understand the business requirements and tell me what I should be building and why, with detailed sensible reasoning then I'll be hyped.
- Takennickname 3y agoYou're missing out. 90% of my boilerplate code is automatically customized and inserted in my codebase for me by copilot. Maybe "manual labor" makes you happy, that's up to you.
- Swizec 3y ago> When these things can understand the business requirements I’ve been looking into this. Nothing definitive yet, but my hunch is that current LLM’s struggle because they lack curiosity. They will answer your question, however vague, with the first most obvious answer they can think of. This is great, if you’re a junior team member. Super talented, very eager. But a more senior engineer approaches the problem differently. They ask more questions than provide answers. They’ll happily spend the first 25min of a 30min meeting asking heaps upon oodles of really dumb sounding questions. Then the last 5min, that’s the magic. They now have a solution perfectly tailored to the problem at hand, with all sorts of edge cases either explored or eliminated through questioning. The questions they kept asking weren’t dumb after all, they were pruning a decision/option tree in their head of all possible solutions until they landed on the most optimal solution for a set of known constraints. With further options to dig and improve. I think you can make an LLM do this (i’m trying), but it’s very very slow still.
- agentcoops 3y agoI think you’re still anthropomorphizing LLMs too much by saying the problem is a lack of curiosity. It’s an engineering problem: you haven’t figured out the correct “context” from which business requirements would follow. (And why Microsoft is so incredibly well positioned for the future)
- cardanome 3y agoI am absolutely disgusted by the idea of people using ChatGPT for serious coding work. Maybe I am just getting old but the idea of using a non-deterministic tool that can hardly be reasoned about that will straight up hallucinate facts for any professional work sounds insane to me. Yes, I do see the value for Junior Devs as I am sure it can drastically increase their output in the short term but aren't they shooting themselves in the leg in the long run? That might sound elitist but at the end of the day, you will need to learn to read technical documentation anyway and once you understand it there is no need for ChatGPT. Yes, if you are constantly hopping from one framework of the month to the next big thing, you just don't have the time to learn anything in depth and then again ChatGPT can help. But do you really want to live like this? Instead of band aid solutions we might want to push for less hype-driven and more pragmatic development styles that allow us the time to learn our frameworks.
- BowBun 3y agoI've been giving it a shot based on recommendations from my bosses, and I'm a senior+ dev. 80% of the time, the suggestions are either too generic for our codebase and so has to be patched up with our variable names, methods, etc. About half the time it completely misses the mark/intent of what is being written, and offers an auto-complete for a different problem. 20% of the time, it actually acts like a full line or full section autocomplete. Areas I've found it particularly helpful are writing tests. For example I added a new integration yesterday that touched a bunch of interface files for those integrations. Copilot was able to pick up on that and auto-generate a 90% functional test with ~30 lines, including setup and assertions. I'm not convinced it's saving me time yet since I have to correct it/ignore it most of the time. When it works, it's cool. And like another comment said, typing speed has never been a bottleneck for me (record of 155 wpm on typing tests, I probably sit around 120-130 for average day-to-day typing).
- GolDDranks 3y agoDon't be. There are some use cases that fit very well. For example, we plan to use GPT-4 for generating text that ends up being seen and read by our customers. (Can't disclose the details, as it's near to core of our business model.) We need a _lot_ of text, and its in style that is time-consuming to think and write by hand. However, all the generated data is checked for correctness by humans. I think that these tips are excellent for designing the generating process so that the end result is of as high quality as it could reasonably be expected to be. Edit: Oh, you mean coding work as for generating code for developers? Not in the sense of using it as a component of a data-generating/transforming system? In that case, I pretty much agree. Edit2: Oof, I just realized that I mistook this whole thread for another thread that was posted earlier on Hacker News. So I thought we were talking about engineering systems that has GPT-4 as a subsystem: https://platform.openai.com/docs/guides/gpt-best-practices https://platform.openai.com/docs/guides/gpt-best-practices
- boredemployee 3y agoThe article is introductory in nature, tending to be irrelevant for the HN audience. What worries me is that I have seen people here more often commenting on the author's life, their academic or professional attributes instead of paying attention to the article.
- javier_e06 3y agoAnthropomorphize is a good way to get ChatGPT to code some obvious but tedious code and to remind you how to cherry pick in git or other myriad of task that most of know how to do and before we will revisit in some site. I give ChatGPT good context and then do code review of the code it presents in the same way I do code reviews with the code I see elsewhere. One warning here though. Don't ask ChatGPT to code something that you don't know how to interpret and/or not willing to test for correctness.
- btbuildem 3y agoAs I've been moving on from writing code to higher level work, I find these tools very welcome. I can just ask it to give me a quick grid layout or the right ffmpeg string of options and go about my tasks, instead having to dive into the nitty gritty or doing "manual labour" every time.
- jasfi 3y agoI'm trying to get it to write full-scale apps, via the APIs. Very difficult once you move past one file, but it's a challenge. The problem is that this tech isn't perfect, and can be unpredictable.
- throwaway4aday 3y agoSame, it requires a phenomenal amount of tooling and prompt engineering but I'm sure it's possible. At least for relatively small text focused apps.
- louiskw 3y agoA lot of the core arguments of the article around trust and safety sound very relevant to the problem I'm trying to solve [0] which is codebase search. Many orgs have a big enough codebase that they can improve productivity with existing patterns. [0] https://github.com/BloopAI/bloop https://github.com/BloopAI/bloop
- foxbyte 3y agoIt underscores the power of AI tools like ChatGPT while stressing the need for careful use. New tools like cwhy and ChatDBG that use AI for explaining compiler errors and debugging are fascinating developments
- deathmonger5000 3y agoI wrote a coding assistant that makes it easy to use natural language to create and modify code - no copy pasting necessary: https://github.com/ferrislucas/promptr https://github.com/ferrislucas/promptr
- ducharmdev 3y agoOn sites like Stack Overflow, incorrect and subtley wrong answers are often peppered with follow-up answers. But in a ChatGPT session, I alone have to critique its output, without contextual info regarding the data's source and without a community to help me critique it. I find that a bit exhausting; beyond simple use-cases, I've found it easier to just do it myself.
- GiselaWag12 3y agoI never thought I would get back my funds since I already lost hope until I found a hacker and a recovery agent, RecoveryNerd who I contacted via email at (recoverynerd@mail.com) and gave me a leap of faith in finding my funds. I personally would recommend Recovery Nerd since this is the least I could do for him after he saved my life by helping me recover my 47,000 USD worth of Bitcoin in less than three weeks from an online scammer. If you want to recover your lost funds or have any questions in regards to recovery, feel free to contact and be a hundred percent sure never to regret it.
- Ginabella 3y ago[flagged]
- lbertaaura99 3y agoI would strongly love to recommend the services of the best team of Jeanson James Ancheta wizard. They are professional and very discreet in carrying out their jobs, they have the best customer service agents and satisfaction at heart. If you have any services, kindly contact him via email:(jeansonjamesanchetawizard62@gmail.com) or on Telegram +31684518136 and he also help track and monitor your cheating partner's phone without being noticed, clear or erase criminal records, all social media hacks, funds recovery and many others.
- Richard649 3y ago[dead]