Has anyone Gotten usable code from Chat GPT?

MrKim

Well-Known Member
Licensed User
Longtime User
I certainly haven't. I just spent 3 hours trying to get a workable VBA JSON parser. I GAVE it the string to parse and it couldn't do it. I have tried before with even simpler projects and I always wind up down a rabbit hole with chat GPT saying "Oh, sorry about that I see the problem let me fix it." And it MIGHT fix the problem but it creates another one. More than once it has gone back to code that failed before to try to fix the new problem. I thought it was supposed to learn from its mistakes.

What is your experience?
 

mcqueccu

Well-Known Member
Licensed User
Longtime User
I certainly haven't. I just spent 3 hours trying to get a workable VBA JSON parser. I GAVE it the string to parse and it couldn't do it. I have tried before with even simpler projects and I always wind up down a rabbit hole with chat GPT saying "Oh, sorry about that I see the problem let me fix it." And it MIGHT fix the problem but it creates another one. More than once it has gone back to code that failed before to try to fix the new problem. I thought it was supposed to learn from its mistakes.

What is your experience?
I have built a whole backend with PHP
- Database Connection
- Registration
- Login
- Pulling all users
- And other Queries which it has successfully executed.



For B4X, I ask simple things and success rate is 80% - A bit complex ones you have to do a bit of modification to get the desired result.
 

JohnC

Expert
Licensed User
Longtime User
Also, what version of ChatGPT are you using (3.5 or 4.x)?
 

JohnC

Expert
Licensed User
Longtime User
In my experiance, 4 and especially 4"o" are much better than 3.5, but a lot has to do with your prompt.
 

hatzisn

Well-Known Member
Licensed User
Longtime User
I have created with ChatGPT 3.5 outlook vba code to add a button in my outlook to send fax with e-mail.
 

LucaMs

Expert
Licensed User
Longtime User
I noticed that when you ask ChatGPT to generate B4X (or even B4A/B4J) source code, it is very influenced by other languages, it inserts code with Java syntax and sometimes VB Net.

However it can be of help; let's hope it doesn't improve too much, otherwise the unemployment of "simple" programmers (not analysts) will increase a lot.
 

AnandGupta

Expert
Licensed User
Longtime User
I have mostly got correct codes for my app development in C#.
Yes sometimes there are mistakes, but trial and error solves most codes.
I use the free 3.5

Though I am noticing that after 4-o, 3.5 behaves a little less knowledgeable in similar matters.
 

JohnJ

Member
Licensed User
Longtime User
I just used it to write a small piece of code in Lazarus (Pascal), it was 100% correct.
 

epiCode

Active Member
Licensed User
Your experience is no different than any other. They are yet to come of age, esp in B4X context, since B4X does not have as much documented code as other mainstream programming languages. I use it to write small mundane code / easy to write logic, which it does really well and fast, then correct the errors myself. It is also wonderful if you use to put comments/ document code so that when you come back to your code it will be easier to understand.
 

cklester

Well-Known Member
Licensed User
Yes. I just used it today for a couple of functions. In a couple of cases, there were easy-to-fix bugs in the provided code. No big deal. Saved me multiple minutes of work, especially since the IDE spots bugs instantly.

After, I asked it to optimize one of the functions I was using (processing a list of 350,000+ English words), and it was able to. It suggested I put the list into a map (using true as the value for each word), turning an O(n) search into an O(1) search (its words, not mine). My initial processing of the list was taking at least 15-20 seconds (probably 30+ if I had ever let it complete). This new function did it in less than half a second.

Clever girl.
 

MrKim

Well-Known Member
Licensed User
Longtime User
Your experience is no different than any other. They are yet to come of age, esp in B4X context, since B4X does not have as much documented code as other mainstream programming languages. I use it to write small mundane code / easy to write logic, which it does really well and fast, then correct the errors myself. It is also wonderful if you use to put comments/ document code so that when you come back to your code it will be easier to understand.
As I mentioned I was looking for VBA which has been around forever. That is actually why I made this post. My prior experiences were with B4x and I didn't expect it to know much and, indeed it mad a lot of syntax errors because it didn't know the language. I expected better with VBA but it just couldn't handle the logic. In my prior experience with GPT and B4A what was most annoying is that it would fix mistakes, then when you tried to correct other mistakes it would go BACK to code that was wrong before showing that it did not learn at all.
 

MrKim

Well-Known Member
Licensed User
Longtime User
I have mostly got correct codes for my app development in C#.
Yes sometimes there are mistakes, but trial and error solves most codes.
I use the free 3.5

Though I am noticing that after 4-o, 3.5 behaves a little less knowledgeable in similar matters.
It IS less knowledgeable 4 has 3 or 4 years newer data.
 

MrKim

Well-Known Member
Licensed User
Longtime User
I have created with ChatGPT 3.5 outlook vba code to add a button in my outlook to send fax with e-mail.
Yes, what it did do well was give me code to post and get to php from VBA. Where it got lost was handling the returned data.
 

epiCode

Active Member
Licensed User
As I mentioned I was looking for VBA which has been around forever. That is actually why I made this post. My prior experiences were with B4x and I didn't expect it to know much and, indeed it mad a lot of syntax errors because it didn't know the language. I expected better with VBA but it just couldn't handle the logic. In my prior experience with GPT and B4A what was most annoying is that it would fix mistakes, then when you tried to correct other mistakes it would go BACK to code that was wrong before showing that it did not learn at all.
I have used it with VBA to successfully create many small 'utilities', Transliteration tool (using LLM), Regex based Find/Replace for Excel and many more for my projects. I can say that it has a good understanding of VBA but bad understanding of approach.
I feel that 'how can we retain the value of variable outside of this function' or "how can this code be optimized?" kind of questions work better than - make a vba code to do xxx...

It does at times get really annyoing and keeps repeating what it says it will not repeat (sorry for the misunderstanding, I understand you do not need a loop so here is your code without the loop: (gives the code with loop)).
This mostly happens when chat session becomes too long. I start a new session when it starts go nuts.
 

Daestrum

Expert
Licensed User
Longtime User
I tend to not ask for code in B4X.
I will ask things like "Is there a algorithm to do xxx", then I ask for example code in Java or C, then convert that to B4X myself.
 
Top