David Schwartz 430 Posted September 9 I've been playing around with ChatGPT to help with certain Delphi coding tasks and I find it's really great at coding import/export routines between classes where the field names and types are the same. It's also great for generating template code for large Case statements, and certain kinds of refactoring. Coming up with functions to do specific things is not something it's very good at. I think with more popular languages, it would do a better job. But it makes up lots of stuff and if you try drilling-down it will eventually go in circles explaining how to implement things that don't really exist. I'm curious what sorts of things others are successfully using some AI tools for that help with Delphi code? Share this post Link to post
corneliusdavid 220 Posted September 9 Last December, I blogged about how ChatGPT helped me write a DLL to call a SOAP web service where the header packet was already created (I had always used the wizard-created class and had a brain block). More recently, I've been using Claude to jump-start projects. For example, I needed to write a small WebBroker app but hadn't done that in a while and just needed a quick reminder of the structure. I was about to look up an old project when I decided to ask Claude and it built a simple example. AI isn't doing my work for me but it's increasing my productivity by either reminding me of techniques or helping me get something going quicker. It's sort of like a writer who sits down to type the next novel but just needs a shove of inspiration to get it started. 1 Share this post Link to post
Dave Nottage 563 Posted September 9 27 minutes ago, David Schwartz said: ..it makes up lots of stuff Absolutely. Depending on which engines you use, it can recognise this if you "call it out" - why it doesn't realise this from the start is a mystery. 28 minutes ago, David Schwartz said: I'm curious what sorts of things others are successfully using some AI tools for that help with Delphi code? I'm having loads of success discovering how to do things that I would otherwise have little or no clue about. Asking the right questions (including follow-up questions), and being able to recognise flaws in the answers, is the key. 2 Share this post Link to post
Lars Fosdal 1793 Posted September 9 I mostly use CoPilot to extract the stuff I need from massive amounts of documentation. I sometimes use it to summarize key info from a large text. I currently don't use it much for programming, but I would like to use it for explaining "what does this do", or for getting suggestions to improve code. 1 Share this post Link to post
Brandon Staggs 285 Posted September 10 I've found that using Copilot with prompts like "Write Delphi code that does X on MacOS" is the fastest way to figure out what API to use and what units to import. The code may not compile but it doesn't need to -- such things typically take a lot longer to learn when wading through Apple Developer docs or trying to find it in Stack Overflow. Also questions like "What is the equivalent MacOS code to do what X does on Windows" and stuff like that, actually work pretty well to get me on the right track with minimal Googling or looking through SO. 4 Share this post Link to post
David Schwartz 430 Posted September 10 (edited) "Yes!" to all of these. I've also used it to do refactoring that's too complex to do with RegEx patterns. Like if you have "a.x := b.x" and you want to change everything to "b.x := a.x", or changing a Case statement into cascaded if..then..else or the other way around. You could give it a class with just variables and have it write all of the properties using either in place vars or methods. If you have a particular structure you want to follow, you can say, "create a class like xyz using this list of fields instead". Edited September 10 by David Schwartz Share this post Link to post
corneliusdavid 220 Posted September 10 46 minutes ago, David Schwartz said: Like if you have "a.x := b.x" and you want to change everything to "b.x := a.x" You don't need AI for that, you just need GExperts! Share this post Link to post
Der schöne Günther 316 Posted September 11 (edited) Another thing that worked surprisingly well for me is code review. I've had copilot complain about too little documentation in certain areas, point out a possible deadlock and suggest external libraries that saved me from reinventing the wheel. I haven't tried out reviewing Delphi code, though. Edited September 11 by Der schöne Günther 2 Share this post Link to post