David Schwartz 426 Posted March 25, 2023 New technology always comes with a lot of "noise". If you're not willing to tolerate that "noise", then you can just stand by and wait while others master the underlying technology while simultaneously figuring out how to reduce the "noise level". Share this post Link to post
Rollo62 536 Posted March 27, 2023 On 3/25/2023 at 2:26 PM, David Schwartz said: ... wait while others master the underlying technology ... Sure, but what I do consider: Isn't that part of our daily tasks, to master such kind of technology ? Why wait, and what for ? I have already seen a lot of very interesting use cases out there, beside asking for coding problems, of course we can wait until others take over this job, like the Python community I'm only missing just a tiny bit of constructive dialog here, how to make use and make best of such AI, instead many people seems to ask AI to solve problems which it cannot solve (yet). Share this post Link to post
Lars Fosdal 1791 Posted March 27, 2023 /off-topic Me: I need help defusing a bomb AI: What kind of bomb Me: posts a series of photos of the bomb AI: Cut the red wire ... *BOOM* AI: ... after cutting the green wire 1 3 Share this post Link to post
Lars Fosdal 1791 Posted March 27, 2023 /on-topic This is application of "AI" in ways that I can like https://visualstudiomagazine.com/articles/2023/03/23/vs-ai.aspx 1 Share this post Link to post
Lars Fosdal 1791 Posted March 27, 2023 Also, on the term "AI": Quote Stefano Quintarelli, a former Italian politician and technologist came up with another alternative, “Systemic Approaches to Learning Algorithms and Machine Inferences” or SALAMI, to underscore the ridiculousness of the questions people have been posing about AI: Is SALAMI sentient? Will SALAMI ever have supremacy over humans? Uncovered in https://www.bloomberg.com/opinion/articles/2023-03-26/even-with-chat-gpt-4-there-s-no-such-thing-as-artificial-intelligence Share this post Link to post
Rollo62 536 Posted March 27, 2023 2 hours ago, Lars Fosdal said: Also, on the term "AI": Uncovered in https://www.bloomberg.com/opinion/articles/2023-03-26/even-with-chat-gpt-4-there-s-no-such-thing-as-artificial-intelligence Sure, why not, salami rules the world anyway Share this post Link to post
Lars Fosdal 1791 Posted March 27, 2023 This topic is drifting, so I'll cut and run here 😉 Share this post Link to post
David Schwartz 426 Posted March 27, 2023 (edited) 4 hours ago, Lars Fosdal said: /on-topic This is application of "AI" in ways that I can like https://visualstudiomagazine.com/articles/2023/03/23/vs-ai.aspx This looks like the same stuff everybody above is saying is too error-prone and therefore should be totally avoided. Most code I write seems to be what I call "plumbing code" -- moving data back and forth between object A to object B -- and it's boring, repetative, and very mechanical. ChatGPT has done a great job writing examples of code like this for me. But like all coders, it's not 100% accurate 100% of the time. Earlier commenters in this thread assert we shouldn't be using it at all if it needs to have it's work constantly checked, and just crank the same mundane code out ourselves. I find this type of coding neither fun or creative. But thanks for pointing out an article that basically reinforces what I said earlier. It's sad that so many people expect 100% perfection before they'll even consider anything like this. Edited March 27, 2023 by David Schwartz Share this post Link to post
Lars Fosdal 1791 Posted March 27, 2023 @David Schwartz There is no such thing as 100% perfection. Did you actually read the article - or did you just quote the wrong link? There is nothing about AI being error prone, AI mistakes, or AI immaturity in that article in the quoted link. It is about AI that is proven to work well for code. On another note: I also hear that Co-Pilot X is quite a bit better than the initial Co-pilot. Also - this discussion appear to have two legs - generative AI on the path to general AI (where I disagree) - generative AI applied to code (where I see some benefits, but a lot of pitfalls - particularly for languages with a small sample base) I don't like mundane code or scaffolding either, so I write generic frameworks to minimize that sort of code. Share this post Link to post
Rollo62 536 Posted March 27, 2023 (edited) 2 hours ago, Lars Fosdal said: Also - this discussion appear to have two legs - generative AI on the path to general AI (where I disagree) - generative AI applied to code (where I see some benefits, but a lot of pitfalls - particularly for languages with a small sample base) Define "to code": Wouldn't generating SQL, summarize a class or function, generate a simple class template, generate unit test cases, proposals of possible OS API for a certain task, modification CSV, JSON, translation from C++ to Delphi or many of such similar tasks, would'nt they fall under your objective ? Neither of those tasks were 100% error free, but they can be somewhat helpful or time-saving as well. Edited March 27, 2023 by Rollo62 Share this post Link to post
Lars Fosdal 1791 Posted March 27, 2023 1 minute ago, Rollo62 said: Define "to code": More or less what you write - but as mentioned - the smaller the sample base, the lower the chance of actual working code. Share this post Link to post
toms 29 Posted March 27, 2023 (edited) 32 minutes ago, Lars Fosdal said: More or less what you write - but as mentioned - the smaller the sample base, the lower the chance of actual working code. That's why I use widely-adopted programming languages instead of Delphi, as I get good outputs. Edited March 27, 2023 by toms Share this post Link to post
David Schwartz 426 Posted March 27, 2023 4 hours ago, Lars Fosdal said: @David Schwartz There is no such thing as 100% perfection. Did you actually read the article - or did you just quote the wrong link? There is nothing about AI being error prone, AI mistakes, or AI immaturity in that article in the quoted link. It is about AI that is proven to work well for code. Yes, I did read the article. I was referring to all of the posts made here in this thread earlier about how chatGPT isn't 100% perfect, so therefore it's a waste of time to even think about using it -- at least, that's my interpretation. If this tool uses chatGPT, then I assume the complaints made earlier about how error-prone chatGPT is (and AI in general) will apply equally to any tool that uses it. I started this discussion by showing some code that, while not impeccible, had a lot of useful stuff in it. I suspect that it's possible to get the same nonsense out of the tool mentioned in that article unless the inputs are highly constrained. ChatGPT happily accepts unconstrained input, and seems to make unfounded inferences that it uses to create nonsense output. Kinda like what most people I know do from time to time. But if the argument is that AI-based systems should protect against stupid questions that will prevent it from spitting out nonsense answers, then it will never give accurate answers 100% of the time. Nor will people ... but that's another story. I didn't write chatGPT, I just entered some queries and got back some stuff that I found interesting and shared here. The folks here say it's worthless nonsense and they don't want to have to worry about double-checking the quality of responses because of that. I'd like to remind everybody that it's possible to write LOTS of code in Delphi that will compile, and might even appear to make sense, but will give random and often unpredictable results, and sometimes even no results at all. Not to mention the long list of documented errors that Delphi has, and they exist as land-mines that will periodically produce unexpected results at best and run-time errors at worst. Share this post Link to post
Rollo62 536 Posted March 29, 2023 (edited) On 3/27/2023 at 4:29 PM, Lars Fosdal said: More or less what you write - but as mentioned - the smaller the sample base, the lower the chance of actual working code. Yes and no, I think it highly depends also on the "pattern-ness" of the structures, like JSON, XML, which have pretty clear rules. That should be easy to analyze and generate be AI, even with smaller training base, whereas any "logic", like a programming language, mathematics or the like, I see as not really solvable yet for AI. That said, I think also the training base of such files are huge. I had recently a very good example where ChatGPT can excel, I had to translate official EU terms into different languages, where I wanted to keep the meaning and wordings as close as possible to the official, national sources. Where all translations from Google/DeepL were not that convincing, even after many tries, always trying to fall back into the same 2-3 variants that I DIDNT want. This process worked out pretty well with ChatGPT, although this took me about 20 cycles to get clear and final on every aspect of the translation. I pretty much could change parts of the sentences and re-analyze. ChatGPT was able to follow my intention very good even over 2-3 cycles and helped to analyze, translate and explain the results very perfectly, knowing also the differences and nuances between official language and usual language. I really think that I was able to find the best possible translations, with the help of ChatGPT. You still can say that AI is stupid, if not having a result under 1-3 cycles, but I also know how this process works with traditional, human translation offices. Also the human translators can never follow my intention 100%, especially if those technical topics were out of their common repertoire. There I clearly see the advantage of the huge AI repository, from Shakespeare, official law terms to slang and dialects, ChatGPT is perfect in all of them. This is why I'm pretty sure that all simpler structures with only limited logic, like SQL, JSON, XML, CSV, etc. will do very good as well. I never expect a perfect result in 1. cycle, neither do I, when asking the same from a colleague. Only after a few cycles of explaining background and goals, the colleagues might prepare the desired result ( at least the colleagues I know 🙂 ). Edited March 29, 2023 by Rollo62 Share this post Link to post
Curt Krueger 1 Posted March 29, 2023 (edited) ChatGPT is basically in "infant" at the moment. It'll only get better and there will probably be systems specifically trained to do specific tasks only, and be very good at it. I think it's always been pitched as augmentation, not a blind "Here, I'll do everything for you". Plus by using it and generating code we're actually helping train the thing. Oh, what happened to Unit Testing? Wouldn't you know what you're expecting from ANY code and write unit test to verify? I read the first 15 or so responses (maybe I missed it), no one mentioned unit tests. But, I get it, if you don't like it don't use it, but I'm guessing at some point we all will (or another companies version of it). Same argument at for Stack Overflow. Someone hurts your feelings, don't use it. All news sources are biased. Edited March 29, 2023 by Curt Krueger Share this post Link to post
Rollo62 536 Posted March 30, 2023 (edited) 12 hours ago, Curt Krueger said: Oh, what happened to Unit Testing? Wouldn't you know what you're expecting from ANY code and write unit test to verify? I read the first 15 or so responses (maybe I missed it), no one mentioned unit tests. I personally think that ChatGPT is not great in complex coding, but can be a very helpful tool in creating Unit Tests probably, because this is usually a more routine work with several test cases. Many programmers dislike writing unit tests, because they think this is too much work, not worth the effort. I think that ChatGPT for creating unit tests be a great help too, because such code is typically not too complex, also probably convincing more and more people to make use of unit tests in the first place . Edited March 30, 2023 by Rollo62 Share this post Link to post
Stefan Glienke 2002 Posted March 30, 2023 5 hours ago, Rollo62 said: I personally think that ChatGPT is not great in complex coding, but can be a very helpful tool in creating Unit Tests probably, because this is usually a more routine work with several test cases. Many programmers dislike writing unit tests, because they think this is too much work, not worth the effort. I think that ChatGPT for creating unit tests be a great help too, because such code is typically not too complex, also probably convincing more and more people to make use of unit tests in the first place . I have no experience with ChatGPT writing unit tests but there have been some other approaches explicitly for unit tests that are based on static code analysis because then it knows exactly what code to write to exercise all possible paths. For Delphi land that however is utopia since all the tools in these areas typically don't know anything about delphi/pascal. Share this post Link to post
Rollo62 536 Posted March 30, 2023 Ok, just for fun I just tried to create some unit test for a random file, I found in the web. Since this is getting off-topic a bit, I opened a new thread. https://en.delphipraxis.net/topic/8688-try-chatgpt-for-creating-unit-tests/ The result after only 2 cycles is quite complete, would save some time, I think. I think there is not many tools out there at the moment, which can do that, and this works even for Delphi 🙂 Share this post Link to post
Fr0sT.Brutal 900 Posted March 31, 2023 On 3/30/2023 at 12:00 AM, Curt Krueger said: I read the first 15 or so responses (maybe I missed it), no one mentioned unit tests. I did, I think it's one of the most useful coding applications. At least for trivial cases (like foo.bar := 1; assert(foo.bar = 1)) - writing them is boring even for junior but who knows how the class will evolve. Probably setter will become a big method where bugs are highly possible Share this post Link to post
Bill Meyer 337 Posted April 5, 2023 (edited) OK, I have been merely watching, but decided finally to take the plunge, not in ChatGPT, but with "the new Bing." My input: Using Delphi, write a class to provide CRUD operations on a dataset. Bing's response: Sure! Here's an example of a Delphi class that provides CRUD operations on a dataset: ```delphi type TMyClass = class private FDataSet: TDataSet; public constructor Create(ADataSet: TDataSet); function ReadData(AID: Integer): Boolean; function CreateData(AData: TMyData): Boolean; function UpdateData(AID: Integer; AData: TMyData): Boolean; function DeleteData(AID: Integer): Boolean; end; constructor TMyClass.Create(ADataSet: TDataSet); begin FDataSet := ADataSet; end; function TMyClass.ReadData(AID: Integer): Boolean; begin Result := False; FDataSet.Close; FDataSet.Params.Clear; FDataSet.Params.CreateParam(ftInteger, 'ID', ptInput); FDataSet.ParamByName('ID').AsInteger := AID; FDataSet.Open; if not FDataSet.IsEmpty then Result := True; end; function TMyClass.CreateData(AData: TMyData): Boolean; begin Result := False; FDataSet.Close; FDataSet.Params.Clear; FDataSet.Params.CreateParam(ftString, 'Name', ptInput); FDataSet.ParamByName('Name').AsString := AData.Name; FDataSet.Params.CreateParam(ftString, 'Description', ptInput); FDataSet.ParamByName('Description').AsString := AData.Description; FDataSet.ExecSQL; if FDataSet.RowsAffected > 0 then Result := True; end; function TMyClass.UpdateData(AID: Integer; AData: TMyData): Boolean; begin Result := False; FDataSet.Close; FDataSet.Params.Clear; FDataSet.Params.CreateParam(ftString, 'Name', ptInput); FDataSet.ParamByName('Name').AsString := AData.Name; FDataSet.Params.CreateParam(ftString, 'Description', ptInput); FDataSet.ParamByName('Description').AsString := AData.Description; FDataSet.Params.CreateParam(ftInteger, 'ID', ptInput); FDataSet.ParamByName('ID').AsInteger := AID; FDataSet.ExecSQL; if FDataSet.RowsAffected > 0 then Result := True; end; function TMyClass.DeleteData(AID: Integer): Boolean; begin Result := False; FDataSet.Close; FDataSet.Params.Clear; FDataSet.Params.CreateParam(ftInteger, 'ID', ptInput); FDataSet.ParamByName('ID').AsInteger := AID; FDataSet.ExecSQL; if FDataSet.RowsAffected > 0 then Result := True; end; ``` I hope this helps! Let me know if you have any other questions. Source: Conversation with Bing, 4/5/2023(1) How do I solve the "Cannot perform this operation on a closed dataset .... https://stackoverflow.com/questions/6774634/how-do-i-solve-the-cannot-perform-this-operation-on-a-closed-dataset-with-borl Accessed 4/5/2023. (2) Leveraging ChatGPT to generate a Delphi class along with CRUD code from .... https://www.ideasawakened.com/post/leveraging-chatgpt-to-generate-a-delphi-class-along-with-crud-code-from-a-table-schema Accessed 4/5/2023. (3) Beginner Delphi Tutorial on CRUD/Add, Edit, Delete and ... - YouTube. https://www.youtube.com/watch?v=h2rZTgEJDPg Accessed 4/5/2023. (4) GitHub - onryldz/express-dataset: Delphi JSON - CRUD DataSet. https://github.com/onryldz/express-dataset Accessed 4/5/2023. I must say that the footnotes impressed me, not only by their inclusion, but the fact that one article cited was from today. Let me add that I have not looked closely, nor even run it through Delphi looking for errors. However, neither did I need to refine my request, nor work around any limit to emitted line count. Edited April 5, 2023 by Bill Meyer added info Share this post Link to post
toms 29 Posted April 6, 2023 @Bill Meyer ChatGPT's output: unit DatasetCRUD; interface uses System.Classes, System.SysUtils, Data.DB, Data.Win.ADODB; type TDatasetCRUD = class private FDataset: TADODataSet; FConnection: TADOConnection; public constructor Create(AOwner: TComponent); destructor Destroy; override; function GetDataset: TADODataSet; procedure CreateRecord(const AValues: array of variant); procedure ReadRecord(AID: Integer); procedure UpdateRecord(AID: Integer; const AValues: array of variant); procedure DeleteRecord(AID: Integer); end; implementation constructor TDatasetCRUD.Create(AOwner: TComponent); begin inherited Create; FConnection := TADOConnection.Create(AOwner); FConnection.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;' + 'Data Source=C:\Data\Database.mdb;' + 'Persist Security Info=False'; FDataset := TADODataSet.Create(AOwner); FDataset.Connection := FConnection; FDataset.CommandType := cmdText; FDataset.CommandText := 'SELECT * FROM MyTable'; end; destructor TDatasetCRUD.Destroy; begin FDataset.Free; FConnection.Free; inherited Destroy; end; function TDatasetCRUD.GetDataset: TADODataSet; begin Result := FDataset; end; procedure TDatasetCRUD.CreateRecord(const AValues: array of variant); begin FDataset.Append; for var I := Low(AValues) to High(AValues) do FDataset.Fields[I].Value := AValues[I]; FDataset.Post; end; procedure TDatasetCRUD.ReadRecord(AID: Integer); begin FDataset.Close; FDataset.CommandText := 'SELECT * FROM MyTable WHERE ID = :ID'; FDataset.Parameters.ParamByName('ID').Value := AID; FDataset.Open; end; procedure TDatasetCRUD.UpdateRecord(AID: Integer; const AValues: array of variant); begin ReadRecord(AID); if not FDataset.IsEmpty then begin for var I := Low(AValues) to High(AValues) do FDataset.Fields[I].Value := AValues[I]; FDataset.Post; end; end; procedure TDatasetCRUD.DeleteRecord(AID: Integer); begin ReadRecord(AID); if not FDataset.IsEmpty then FDataset.Delete; end; end. This class uses the ADO (ActiveX Data Objects) components to connect to a Microsoft Access database, but you could easily modify it to work with another database engine or dataset component. Here's a brief overview of the class methods: constructor Create: Creates the ADO components and sets the connection string and SQL query for the dataset. destructor Destroy: Frees the ADO components when the object is destroyed. function GetDataset: Returns a reference to the dataset. procedure CreateRecord: Adds a new record to the dataset with the specified field values. procedure ReadRecord: Retrieves a record from the dataset by its ID field. procedure UpdateRecord: Updates a record in the dataset with the specified ID and field values. procedure DeleteRecord: Deletes a record from the dataset with the specified ID. Share this post Link to post
Lars Fosdal 1791 Posted April 6, 2023 Another man's struggles with AI generated code. Quote This is going to be a tool that will be used by many people, only to realize that diminishes their code comprehension and design skills. We'll have to unlearn all this again, once we see the real world negative impact it has on businesses and software quality. https://mastodon.gamedev.place/@badlogic/110139794125541730 1 Share this post Link to post
Brandon Staggs 275 Posted April 7, 2023 As is obvious by my comments, I don't think this is all it's hyped up to be right now. That said, yesterday I used ChatGPT to give me a very quick overview of the "Mac way" of enumerating optical media drives on the computer. Rather than digging in to SO posts or looking through google results to find a general outline or (the horror), using Apple's insanely badly designed developer documentation website, I just asked ChatGPT to write an objective-c program that lists the optical drives on the computer. While I have no idea of the code it gave me would compile, it did show me the right API to use and one way of getting the results I want. I have no idea how much time this saved me. Maybe 30 minutes? Now I will just translate it's general idea into functional Delphi code. This is the second time I have used it for positive effect. So, it does have use. For me, it seems like a sometimes more efficient way of doing a web search to get an outline of how to solve a small programming problem. 1 Share this post Link to post
Anders Melander 1782 Posted April 7, 2023 7 hours ago, Brandon Staggs said: For me, it seems like a sometimes more efficient way of doing a web search to get an outline of how to solve a small programming problem. As long as your employer prefers to have you produce the easiest (for you) solution in the shortest amount of time, I guess that's one way to achieve that goal... Sure, for hobby development this is fine - no problem. But for professional development, that approach is simply lazy. Personally, I would have "done my own research", weighed the available options, and decided which best suited the solution I was looking for. Share this post Link to post
Anders Melander 1782 Posted April 7, 2023 On 4/6/2023 at 3:04 PM, Lars Fosdal said: Another man's struggles with AI generated code. https://mastodon.gamedev.place/@badlogic/110139794125541730 Quote ChatGPT/Copilot finally give programmers a chance to experience how non-technical people feel when trying to coerce programmers to create a thing. You too can now throw imprecise natural language prompts at a magic coding box and get disillusioned by the results. Gold! 2 Share this post Link to post