Recent

Author Topic: AI interactions  (Read 687 times)

Weiss

  • Full Member
  • ***
  • Posts: 224
AI interactions
« on: December 01, 2025, 01:43:04 pm »
I am changing my opinion on employing AI in code writing. It allowed me to venture into the language areas I have little knowledge, practically did not know exist. AI-generated code, though heavily soiled with corrupt syntax, appear cleaner and better structured than what I usually wright. AI is good teacher too, explains every step in clear language, highlights key points etc. It is like a team work. Amazing. Like an extension to my own brain, with vast knowledge base I have instant access to.

cdbc

  • Hero Member
  • *****
  • Posts: 2506
    • http://www.cdbc.dk
Re: AI interactions
« Reply #1 on: December 01, 2025, 01:45:50 pm »
Hi
Nice for you my friend, just don't pick up all of its bad habits..... %)
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

Khrys

  • Sr. Member
  • ****
  • Posts: 366
Re: AI interactions
« Reply #2 on: December 01, 2025, 01:53:08 pm »
AI is good teacher too, explains every step in clear language

Current AI is also very confidently incorrect. And if you don't already know the topic (as is the case when learning), you won't even notice that you're being fed pure slop.

440bx

  • Hero Member
  • *****
  • Posts: 5884
Re: AI interactions
« Reply #3 on: December 01, 2025, 02:18:00 pm »
Current AI is also very confidently incorrect.
I have to second that.

A.I can be useful to _get an idea_ about something but, it is _crucial_ to keep in mind that it is _very often_ wrong, sometimes in obvious ways and sometimes in very subtle ways (which is a lot worse.)

Yes, A.I can help but, it cannot and must not be trusted to provide correct answers.  Sometimes it does but, more often than not, there are problems in the answer that range from obvious (which is great) to subtle (which is difficult to catch even for someone who knows the area because, something subtle is easy to overlook.)

Bottom line: A.I is a know-it-all that _never_ says it doesn't know, will answer no matter how preposterous and ill-conceived the answer is. Conclusion: use A.I with _extreme_ care. 

BTW: no matter what the answer is, it stole it from someone out there, reworded it and it is now assertively passing it as its own. 
« Last Edit: December 01, 2025, 02:20:08 pm by 440bx »
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

LemonParty

  • Sr. Member
  • ****
  • Posts: 388
Re: AI interactions
« Reply #4 on: December 01, 2025, 03:22:33 pm »
I found AI is very useful too. Especially when you need to build something from sketch. But AI is week when you trying to dive into niche theme. I guess that is happened because AI had small amount of training data for this themes. So we may say AI will not replace experience programmers soon.
Lazarus v. 4.99. FPC v. 3.3.1. Windows 11

Zvoni

  • Hero Member
  • *****
  • Posts: 3164
Re: AI interactions
« Reply #5 on: December 01, 2025, 03:44:09 pm »
No A.I. whatsoever for me.

Using AI to get "ready-to-use" code (though, as said above, often enough wrong), is like asking a teacher "what's the value of 0! ("Zero Factorial")?", and he answers "1"
WITHOUT explaing, why it is that result.

Meaning: If you don't understand the algorithm/code-flow, the best AI will not help you understand it.
Because an algorithm/code-flow is Language-agnostic
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Hansvb

  • Hero Member
  • *****
  • Posts: 863
Re: AI interactions
« Reply #6 on: December 01, 2025, 06:45:08 pm »
I use ai sometimes. For Pascal I use it more as a kind of disguised search engine. I program just a bit as a hobby and do it sometimes a lot and then a little at times. As a result, I have trouble keeping an overview of something I make. And then AI is very useful. I'm currently trying to build an export tool and when I ask ai what is being done when I click on the export button in form I get a pretty nice overview. That is enough for me to know how it works again.

The layout is a bit broken here but it's all about the idea:

┌─────────────────────────────────────────────────────────────┐
│                    UI LAAG (FormMain.pas)                                                                    │
└───────────────────────────────┬─────────────────────────────┘
                                │
                                ▼
                    btnExportFromQueryClick()
                    ├── IF NOT SQLQuery1.Active THEN ShowMessage
                    ├── SaveDialog1 configureren
                    ├── IF SaveDialog1.Execute THEN
                    └── TOroxExportPresenter.Create(Self)
                                │
                                ▼
┌─────────────────────────────────────────────────────────────┐
│                 PRESENTER LAAG                                                                                 │
└───────────────────────────────┬─────────────────────────────┘
                                │
                                ▼
              TOroxExportPresenter.ExportToOroxFromQuery()
              ├── FView.ShowMessage('Bezig met exporteren...')
              ├── FModel.ExportToOroxFromQuery(Query, FileName)
              └── TRY...EXCEPT voor error handling
                                │
                                ▼
┌─────────────────────────────────────────────────────────────┐
│                  MODEL LAAG (OroxExportModel.pas)                                                    │
└───────────────────────────────┬─────────────────────────────┘
                                │
                                ▼
                 TOroxExportModel.ExportToOroxFromQuery()
                 ├── DataProvider := TQueryDataProvider.Create(Query)
                 └── ExportToOrox(DataProvider, FileName)
                                │
                                ▼
                   TOroxExportModel.ExportToOrox()
                   ├─────────────────────────────────────┐
                   ▼                                          ▼
         MapDatabaseToGWSW()                     GenerateOroxTurtle()
         │                                                     │
         ├── ClearAllLists()                            ├── @prefix declarations
         ├── DataProvider.Open()                   ├── FOR Stelsel in FStelselList
         ├── IF DataProvider.First THEN            │   └── ExportStelselToTurtle()
         │   └── REPEAT                            ├── FOR Put in FPutList
         │       ├── ObjectType := GetObjectType() │   └── ExportPutToTurtle()
         │       ├── CASE ObjectType:              │       ├── AddPutKenmerken()
         │       │   ├── 'STELSEL' →               │       └── AddPutOrientatie()
         │       │   │   MapStelselFromProvider()  ├── FOR Leiding in FLeidingList
         │       │   ├── 'PUT' →                   │   └── ExportLeidingToTurtle()
         │       │   │   MapPutFromProvider()      │       ├── AddLeidingKenmerken()
         │       │   └── 'LEIDING' →               │       └── Geometrie verwerking
         │       │       MapLeidingFromProvider()  └── SL.SaveToFile()
         │       ├── Toevoegen aan betreffende lijst
         │       └── UNTIL NOT DataProvider.Next()
         └── DataProvider.Close()
                                │
                                ▼
┌─────────────────────────────────────────────────────────────┐
│                 SUB-MAPPING PROCESSEN                       │
└───────────────────────────────┬─────────────────────────────┘
                                │
               ┌────────────────┼────────────────┐
               ▼                ▼                ▼
     MapStelselFromProvider()   MapPutFromProvider()   MapLeidingFromProvider()
     │                          │                    │
     ├── GetFieldValue('ID')    ├── GetFieldValue()  ├── GetFieldValue()
     ├── GetFieldValue('NAAM')  ├── Geometrie parse  ├── Topologie
     └── StelselType mapping    ├── Materiaal mapping├── Afmetingen
                                ├── Vorm mapping     ├── Materiaal mapping
                                ├── PutType mapping  ├── Vorm mapping
                                ├── Hoogte waarden   ├── Status mapping
                                ├── Datum velden     ├── Stelsel info
                                ├── WijzeInwinning   ├── Bob waarden
                                └── Stelsel relatie  ├── Datum velden
                                                     ├── WijzeInwinning
                                                     └── WKT Geometrie
                                │
                                ▼
┌─────────────────────────────────────────────────────────────┐
│                 MAPPING MANAGER                             │
└───────────────────────────────┬─────────────────────────────┘
                                │
                                ▼
               FMappingManager.GetGWSWURI() calls:
               ├── mtMateriaalPut → 'Materiaal_Put' sheet
               ├── mtMateriaalLeiding → 'Materiaal_leiding' sheet
               ├── mtVormPut → 'Vorm_Put' sheet
               ├── mtVormLeiding → 'Vorm_Leiding' sheet
               ├── mtStatusFunctioneren → 'StatusFunctioneren' sheet
               ├── mtStelseltype → 'Stelseltype' sheet
               ├── mtObjectType → 'ObjectType' sheet
               └── mtWijzeInwinning → 'WijzeInwinning' sheet
                                │
                                ▼
┌─────────────────────────────────────────────────────────────┐
│                 PROGRESS CALLBACKS                          │
└───────────────────────────────┬─────────────────────────────┘
                                │
                                ▼
               DoProgress() → OnProgress event
               └── FOnProgress(Current, Total) in Presenter
                                │
                                ▼
┌─────────────────────────────────────────────────────────────┐
│                 PRESENTER TERUG NAAR VIEW                   │
└───────────────────────────────┬─────────────────────────────┘
                                │
                                ▼
               Succes: FView.ExportComplete(FileName)
               Fout:   FView.ExportError(E.Message)
                                │
                                ▼
┌─────────────────────────────────────────────────────────────┐
│                    UI LAAG (FormMain.pas)                   │
└───────────────────────────────┬─────────────────────────────┘
                                │
                                ▼
               ExportComplete() implementatie:
               ├── ProgressBar1 reset
               ├── StatusBar1 update
               ├── Memo1 log entry
               └── MessageDlg "Bestand openen?" + ShellExecute

gidesa

  • Full Member
  • ***
  • Posts: 200
Re: AI interactions
« Reply #7 on: December 01, 2025, 07:58:54 pm »
The LLM (so called "AI") models are good to quick create boiler plate code.  Also to create useful comments/documentation on a piece of code, either to document my code, or to better understand third party code.
You can translate code from a language to another one, too.
All LLM output is never perfect without errors, but could save a lot of time on basic and repetitive task.

NOTE: I use only local LLM  models, not web services as ChatGpt.

Weiss

  • Full Member
  • ***
  • Posts: 224
Re: AI interactions
« Reply #8 on: December 02, 2025, 02:34:51 am »
No A.I. whatsoever for me.

Using AI to get "ready-to-use" code (though, as said above, often enough wrong), is like asking a teacher "what's the value of 0! ("Zero Factorial")?", and he answers "1"
WITHOUT explaing, why it is that result.

Meaning: If you don't understand the algorithm/code-flow, the best AI will not help you understand it.
Because an algorithm/code-flow is Language-agnostic
I hear you all. The code I have gotten from AI doesn't even compile yet. It is heavily soiled by syntax, which, as AI puts it, "leaked from Java code". But I enjoy reading AI-generated code and learning new ways of doing things. The code has value, it will be used as a skeleton for actual code. As some of you put it, AI value is in quick lookup of possible ways to implement something.

Thaddy

  • Hero Member
  • *****
  • Posts: 18483
  • Here stood a man who saw the Elbe and jumped it.
Re: AI interactions
« Reply #9 on: December 02, 2025, 06:41:58 am »
AI assisted coding still needs a programmer that is sufficiently versed in the language to be able to detect and fix the errors.
That implies it is not really suited for beginners yet. Also, always compare output from several engines and make sure you ask the right questions: the better you ask, the better the results. Spending some time to define your problem in detail gives better results with all engines. Also, feed back the errors you find and let the model(s) try and fix them.
« Last Edit: December 02, 2025, 06:48:33 am by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

TBMan

  • Sr. Member
  • ****
  • Posts: 301
Re: AI interactions
« Reply #10 on: December 02, 2025, 05:44:03 pm »
I'm a hobbyist and I have relied on AI heavily in creating a ptcgraph-like graphic library. I wanted to learn a bit about the Windows API and doing this gave me a glimpse into it. BUT, I knew how it was supposed to behave and I knew what things I wanted it to do. I saw where it needed optimization and worked with the AI to do that.

AI for coding is like a toaster without a timer. It works, but you have to keep your eye on it.
I love programming.

Some things I've done using PTCgraph:

NFL Retro Football (almost finished):
https://www.youtube.com/watch?v=78mTtsd7ppk


Solitaire games:
https://www.youtube.com/watch?v=zmtxI7FdWuQ&list=PLa4BPpFl34iVhFwX1JZwVm3vE5ay_i3R2

Weiss

  • Full Member
  • ***
  • Posts: 224
Re: AI interactions
« Reply #11 on: December 03, 2025, 06:58:29 am »
Also, feed back the errors you find and let the model(s) try and fix them.

this is the best part, actually. I find, when I feed errors back to AI, I get detailed explanation what error was, how function supposed to behave etc. A very good brief actually, even if I knew the answer before sending error to AI.

The other good part of letting AI to fix its own errors, is in the fact that it fixes same errors everywhere else in the code. Sometimes there is a repeat pattern, and it is known to have a bug. Saves time of chasing the bug manually.

 

TinyPortal © 2005-2018