by wruza · 3y ago · 0 comments
When I tried to “talk” to gpts, it was always hard to formulate my requests. Basically, I want to code. To tell something structured, rigorous, not vague and blah-blah-ey. To check and understand every step*. Idk why I feel like this, maybe for me the next ten years will be rougher than planned. Maybe because I’m not a manager type at all? Trust issues? I wonder if someone else feels the same.
Otoh I understand the appeal partially. It roots in the fact that our editors and “IDEs” suck at helping you to navigate the knowledge quickly. Some do it to a great extent, but it’s not universal. Maybe a new editor (plugin) will appear that will look at what you’re doing in code and show the contextual knowledge, relevant locations, article summaries, etc in another pane. Like a buddy who sits nearby with a beer, sees what you do and is seasoned enough to drop a comment or a story about what’s on your screen any time.
Programming in a natural language and trusting the results I just can’t stand. Hell, in practice we often can’t negotiate or align ourselves in basic things even.
* and I’m not from a slow category of developers
This is just gpt-3. With chatGPT i finally managed to get unit test backbones for the most annoying methods in our code base that stuck our coverage at 92%. Once we get full copilot gpt-4 integration we will likely get to 98% coverage in a days time. That’s not nothing.
With GPT-4, I thought: "fuck. It's all over. How soon will I get laid off?"
Only half-joking, but GPT-4 is truly good at complex programming and problem solving, and noticeably better than GPT-3.5.
Something about the iterative context aware approach of chat helps me think through the problem. The only think I don't like about copilot is how you cant tell it to augment the output. Sometimes it's close but not perfect.
But you can actually think of this as a code quality measure. You want to avoid this. You want to organize the project in a way that writing or modifying the code is easy. That means, make it straightforward how functions are called, how things are done. Minimize interdependencies, side effects.
Then Copilot will work quite well.
A specification can be rigorous, structured, precise and formal: a declarative description of what is to be done - not how. It is a very different perspective from designing algorithms - even one that proves the thing to be done, is done.
But I think trusting the results is misplaced. It's more like being a partner in a law firm, where the articled clerks do all the work - but you are responsible. So you'd better check the work. And doing that efficiently is an additional skill set.
Some things that helped me to become a lot more efficient:
- Vim. Since you mostly edit code, not write it, it is reasonable to be in the editing mode by default, with a full keyboard of shortcuts you can use, not only ctrl/alt combinations. I use IdeaVim[1] plugin for Vim emulation.
- Never use your mouse. Keyboard actions are faster and more consistent once you get used to it. IDEs and editors are highly customizable and should allow to bind almost any action.
- Get rid of tabs, keep 1-3 active buffers in your vicinity. And then use ctrl+tab or ctrl+e to switch between them.
- Learn tricks for code navigation: jump to definition/usage/implementation, search file/class/symbol.
- Learn tricks for text navigation: pretty much any decent tutorial on Vim navigation will do.
However, this is the state of the art today. In the future, the training set will be based on the prompt-result output and refinement process, leading me to believe that next generation tools will be much better at prompting the user to provide the details. I've already seen this enhancement in gpt4 recently, I think this is a common and interesting use case.
Overall, these tools will become more and more advanced and useful for developers. Now is a great time to become proficient and start learning how the future will require you to adapt your workflow in order to best leverage chatGPT for development.
This response was written by a human.
It's still mental work. You still have to read the code over and edit stuff.
It helps me save lots of time so I can do quality things like comment on hn during work..
GPT seems really smart and you can give it very high-level prompts, which generate good quality code. But it's limited by the chat interface, and if it doesn't get it right the first time, it's tricky to get a tweaked version. For example, I asked it to generate some code for a login endpoint, and gave it all the details about language, libraries, database etc. It produced some pretty good code. But then I asked it to do a version didn't store passwords in plaintext. It did that, but also made other changes including using a different library than one I had specified. So then I had to try to fix that, which led to more weirdness. I ended up just using the code it generated as inspiration and writing it myself.
Copilot, with its integration into VSCode is quite different. It's *awesome*. It makes suggestions in inline, as you type. It seems to have a lot of context, and generates very good code, apparently based on information contained in other files in the same project. It matches style and naming conventions, and even when it's not quite right, I find it easy to just accept the suggestion, and tweak it. It's a huge help.
So my current practice is to rely on Copilot to generate code and use GPT as sort of a pairing partner that I can talk to about the code. It's pretty good at suggesting alternatives, developing ideas, explaining error messages and so on. This is a very, very early attempt at coding with the help of AI, and I haven't actually seen a productivity improvement, because I don't know how to use these tools well. But it's fun and exciting!
I.e. for a backend dev that hardly knows react and needs to write some, who usually gets by doing small modifications and copy-paste-driven development there, ChatGPT / Copilot is basically a 10x productivity multiplier.
I agree that I've not been feeling that much value yet when working in areas I'm proficient in.
I, too, was skeptical until...
I've making the switch to VS Code (not by choice...my previous daily driver, Atom, has been EOLed since December). Accordingly, I needed to port an Atom extension I wrote a long time ago to VS Code. What I didn't want to do was spend hours or days getting up to speed on how to write VS Code extensions, especially since this is the only one I'm ever likely to write (it's the only one I ever wrote for Atom :-)).
I used GPT-4 and it worked like a charm -- almost like magic. It wrote almost all the boilerplate and bullshittery for me. Was it perfect? No, the regex it came up with for recognizing the code pattern to which the extension applies (Scheme atoms or pairs) was crap. That's okay -- I know how to write regexes (in fact, I pretty much just dropped in my state machine parser from the old extension). But not having to spend hours and hours groveling through Microsoft docs and Googling to learn stuff I'm not likely to ever need again? Man, that was great.
> Programming in a natural language and trusting the results I just can’t stand.
This would worry me, too. But in this case, I was already well-familiar with Javascript and Typescript, so it was no problem for me to read the resulting code and give it a sanity check, test it, etc. I just didn't have to write it.
If you haven't already, look into trying out Copilot (I don't think there's a free version anymore?) or Codeium (free and has extensions for a lot of editors, just be careful with what code you're okay sending to a third party). Using AI prompts as a fancy auto complete is what has been giving me the most benefit. Something simple like a comment "# Test the empty_bank_account method" in an existing file using pytest, I go to the next line and then hit tab to auto-complete a 10-15 line unit test. It's not always right, but it definitely helps speed things up compared to either typing it all out or copy/pasting.
My biggest annoyance so far, at least with Codeium, is that sometimes it guesses wrong. With LSP-based auto-complete, it only gives me options for real existing functions/variables/etc. But Codeium/copilot like to "guess" what exists and can get it wrong.
> Like a buddy who sits nearby with a beer, sees what you do and is seasoned enough to drop a comment or a story about what’s on your screen any time.
I agree with you, this is probably where it would be most useful (to me). I don't need someone to write the code for me, but I'd love an automated pair-programming buddy that doesn't require human interaction.
My take is that data-centric programming requires too much context for GPT, and we're going to see a move back to doing things in a more OO way, hopefully with better languages than exist now. The ability to reason locally about objects helps both human and AI developers, so we can build larger systems. Data-centric/functional programs are akin to hand-crafted, artisanal goods that were slowly overtaken by standardized parts/division of labor production methods in the industrial revolution, and we are in the middle of one for software [0]. By the ended of it, software engineering may no longer be an oxymoron.
0. https://www.researchgate.net/profile/Brad-Cox-2/publication/...
The reason I mentioned data pipelines is I've adopted a compiler type view of programming, where data is mutated through series and or parallel steps until a satisfactory side-effect or output is reached. I find its a lot easier to define a problem when I think about it this way.
You will be if you don't embrace AI ;)