• Что бы вступить в ряды "Принятый кодер" Вам нужно:
    Написать 10 полезных сообщений или тем и Получить 10 симпатий.
    Для того кто не хочет терять время,может пожертвовать средства для поддержки сервеса, и вступить в ряды VIP на месяц, дополнительная информация в лс.

  • Пользаватели которые будут спамить, уходят в бан без предупреждения. Спам сообщения определяется администрацией и модератором.

  • Гость, Что бы Вы хотели увидеть на нашем Форуме? Изложить свои идеи и пожелания по улучшению форума Вы можете поделиться с нами здесь. ----> Перейдите сюда
  • Все пользователи не прошедшие проверку электронной почты будут заблокированы. Все вопросы с разблокировкой обращайтесь по адресу электронной почте : info@guardianelinks.com . Не пришло сообщение о проверке или о сбросе также сообщите нам.

The Real Truth About AI, With David Cornelius. “Read The Webinar” Series

Sascha Оффлайн

Sascha

Заместитель Администратора
Команда форума
Администратор
Регистрация
9 Май 2015
Сообщения
1,368
Баллы
155
Embarcadero webinars and online coding events are a treasure trove of priceless insights into the professional lives and experience of Delphi developers around the world.

To make sure those insights are available in multiple formats to suit everyone’s preferred way of connecting to our content, we’ll be publishing select webinars as blog posts on the Embarcadero blog.

We’re launching this series with the readable version of a session from AI Codecamp 2025 with Embarcadero MVP David Cornelius titled “The Real Truth About AI: What Worked, What Didn’t Work, And Are We All Doomed”.

video04 1


The original session is available here:

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



The Real Truth About AI: What Worked, What Didn’t Work, And Are We All Doomed


Welcome to Embaradero’s AI Codecamp.

This session is a collection of experiences I’ve had and how I’ve used AI in a variety of ways to increase my productivity as a programmer.

It will include links to a few blog posts I’ve written and some of the AI chat conversations I’ve had. The agenda will go through some tasks I’ve selected from daily work, and how AI has helped in different ways for each.

All of these are tasks I could have done on my own, but AI either helped me past a mind block, offered suggestions I had not thought of, wrote tedious code for me, or assisted in my research.

At the end I’ll mention a few miscellaneous things that don’t really fit into these categories and finally share a link to one of my main sources of AI inspiration, a newsletter called Superhuman.

First a little history about myself, like many of the older Delphi generation. I started with early versions of Tubo Pascal. Both in college and in my first long-term job I used several other programming languages, either for work or as a side interest, or in the case of PHP to build dynamic websites.

When Delphi came out in 1995 I quickly threw out the Object Windows library I was struggling with, and joined a few others in the Portland Oregon area to discuss this hot new RAD tool for Windows.

We decided to meet monthly and called ourselves the Oregon Delphi user group. When the leader moved to the east coast I was the most enthusiastic and frequent attendee, and became the default coordinator.

Despite my best efforts I’m still the coordinator to this day. I’m currently using both Delphi 5 and Delphi 12 in my day job, migrating a suite of several hundred programs up to modern code. On the side I maintain some old programs in Delphi 7 and XE for a few clients I’ve had over several years, and always start new projects in the latest versions of Delphi.

A few years ago I wrote a book called “Fearless Crossplatform Development with Delphi” to help those like myself upgrade their VCL skills to work with FireMonkey to develop for platforms other than Windows.

Finally I’m happy to be considered an Embarcadero MVP and do my best to support these products.

So without further delay, let’s jump into it. A quick note: to increase clarity and in the spirit of using AI, several parts of this presentation use AI narration generated at

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



The first task involved writing a DLL in a modern version of Delphi to call a SOAP web service from an application built with Delphi 5, which does not have the necessary components or security protocols to support SOAP web services.

I noticed the XML to send was prepackaged with the SOAP envelope. Usually I would start Delphi’s SOAP importer to get it set up and then use the generated class. But looking at this, my mind went blank. It seems silly now that I have the simple solution, but I decided to give AI a try.

At the time AI tools were still fairly new and ChatGPT was what everyone was talking about, so I opened it up and simply asked “How do I call a SOAP web service from Delphi without using the WSDL importer?”

david cornelius 02


The response was a great explanation of how to call SOAP web services, from creating the request XML to sending, receiving and parsing the response, and even handling errors.

It was a little overkill for what I needed, but it got me started. It suggested using the indie libraries. I wanted to use the newer net HTTP client ones instead and it rewrote the code for me, albeit with a syntax error.

In the end I ended up with exactly what I needed without wasting too much time, because I had drawn a blank on how to perform this simple task.

This is an elementary example but I want to point out a couple of things. One, AI can help jog your memory of things you already know. Two, AI can offer solutions that aren’t always what you want, but leads you to correct it sometimes, unlocking new ideas within yourself and coming up with a better solution.

In this case my use of AI is like using a rubber duck, someone to talk to that by merely voicing your problem helps you realize the solution. You can read about this experience and see the code that evolved on my blog.

The next task involved fixing a Firebird database for a customer. A friend of mine wrote an insurance agency management system over 20 years ago and still maintains it for customers around the US. He’s nearing retirement and doesn’t want to rewrite the Delphi 2007 app to support multiple platforms or to make it a web-based app.

david cornelius 03


So I worked with him to set up a couple of servers in the cloud into which his customers can log in via RDP and run the program. There the application uses the Firebird database, with the server easily handling all the database requests for each agency.

This has been in place and running quite well in the cloud for over 5 years. Once in a while the program loses its connection to the Firebird server. Usually it can quickly reconnect and continue without anyone noticing. Rarely, though, Firebird still thinks the client application is connected and refuses a second connection.

When this happens the easy fix was to simply reboot the Firebird server. That’s fine for an InOffice installation, but is not okay when it will affect 22 other offices and dozens of other users in the cloud.

I used to be quite familiar with all its command line tools, but I don’t use Firebird very often anymore. Neither he nor I could remember how to address this problem, nor could we come up with the right keywords to reveal the answer with a Google search.

Finally I asked “how do you tell Firebird 2.15 to clear connections from a database?”. The response was quick and exactly what I needed. It listed the exact tool and the parameters that solved the problem perfectly and the customer was up and running in no time. This use of AI is what I’d put in the instant recall category. Again you can read about this on my blog if you’re interested in the details.

One common task often attributed to AI when coding is refactoring. I have two examples to share. This first one takes a look at a long set of “if” statements, each based off the first character of a string variable.

The solution was pretty simple, and the task was given to AI to retype it for me with the following prompt: “Refactor the following Delphi structure using a case statement on Trans[1]. It did exactly what I asked and the code was perfect, but I got to thinking “how would AI solve this if it wasn’t told how to optimize?”, so I tried a slightly different prompt: “How would you refactor the following Delphi if-structure?”.

david cornelius 04


There were three options presented: the first one was very similar to my approach. Since I had not told AI that Trans was a string, it assumed it was a char. We had a short discussion about case statements being based off ordinal values, and it gave me both the indexed string version and the single char version.

The second option presented was using a TDictionary. I could see how this option would be useful if it was pulling these values out of a database, or if there was a long list of entries added at various points throughout the program. But in this case it wasn’t what I was looking for.

The third option was touted as being the fastest and most compact solution using an array lookup with all the key characters in a string, their position being an index into a corresponding array containing their descriptions. While this might be arguably the fastest method, I could see it also being the most error-prone if someone had to modify the list. Later these AI conversations were done with Claude in its web browser chat window.

I did try Delphi 12’s Smart CodeInsight feature also using Claude, and its suggestion was very similar to the first option. Here’s a short recap of how that worked: In Delphi 12 it puts the modified code in a comment below your section of code that was highlighted. Word wrapping needs to be fixed.

The benefit of using AI in this example was to improve code by taking something ugly and turning it into something beautiful, and while this exercise was simple it was also an interesting learning experiment that illustrates two things: first, AI will try to do exactly what you tell it; second, if you’re not specific it might come up with a different solution that might surprise you.

The second example I have for using refactoring with AI is to remove duplicate code .As I was working with a custom table component I found a function in the class to get a datetime string with user initials embedded that looked familiar, and sure enough there was a utility class with identical code in another unit.

This was another case where I knew exactly what I wanted and did not take the time to ask AI how to solve it. I just wanted the work done for me. This required several edits to both units, which I supplied to AI and its response pointed out all the places to make the changes. Once again I used AI to improve my code, this time removing duplicate code.

A great use of AI for coding is writing unit tests. As mentioned previously, a large part of my job is migrating hundreds of programs from Delphi 5 to Delphi 12. This includes a great many library units. Of course there were no unit tests for any of them, and I wanted to not only verify the migrated code but also document their use for better understanding.

My first prompt when starting this was simply “please write unit tests for the Delphi classes in the attached unit using DUnit”. The explanatory response was rather long. You can check it out at

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

if you’re interested. As I looked at the generated code I realized the prompt needed lots of clarification and refinement. The first thing I decided to change was to use DUnitX because it’s a more modern syntax and provides greater flexibility with less code.

david cornelius 05


By adding test cases using attributes instead of writing additional procedures, however, I found that Claude was better with DUnit tests than DUnitX. So that required a little reworking after every unit test produced. It also put a lot of assert tests in each procedure. I had to specifically request smaller test case procedures and it still lumped too many together in my opinion as I developed tests for more library units.

I found that passing data parameters needed to be type specific. Test cases that passed in zero treated the parameters as floating point instead of data time, and needed to be corrected to prevent type mismatch error. After several unit tests and several iterations of the prompts, I finally used this one for all subsequent requests, and it worked really well.

This was definitely a case of learning how to write a better prompt to get a better answer. The use here, of course, is to reduce the tedium of writing all this code myself. Sure, there are tools and templates that jumpstart unit test writing, but using AI was quicker. Plus, it wasn’t constrained by knowing the typical use of these units, so it added tests I would not have worried about. This actually revealed some problems with the libraries that may have been hard to track down later, if ever encountered.

david cornelius 06


This is probably the most fun use of AI, because it generates a lot of code in real time. You can just sit back and watch it fill up your screen, and that’s what we’ve all wanted from the beginning. Isn’t it to make our computers work for us? The lengthiest AI chat conversation I’ve had was to research and prepare a presentation I plan on giving on Rad Server. I had given an introduction on the topic several months ago to the Oregon Delphi user group that came together fairly easily because it covered basic things like the software and licensing required, how to install it and how to write a simple hello world module, and see it working in both the debug server and deployed to production.

The next session though, needed to dive deeply into security and authentication methods. I wanted code examples in areas for which I was less familiar. This resulted in a conversational iterative process where AI presented several suggestions, then I picked various topics for more information and told it to skip others. It was very much like I was chatting or perhaps texting with a fellow programmer.

I had been reading sample AI prompts in blogs and articles, and noticed many times the prompt will start off by declaring you are an expert, and you fill in whatever topic you want to discuss. I thought I’d try that approach. “You are an expert at Delphi, and using Rad Server to build REST services, prepare a presentation on the subject to fellow Delphi programmers, where they already know a little about RAD Server but want to go deep on the following topics.”

david cornelius 08


Then I listed the topics I wanted to focus on, and instructed it to create a set of slides for me. This resulted in an amazing, fully-prepared presentation with 28 slides and even speaker notes. It was in text format so I had to copy and paste to PowerPoint, but the sections of text for each slide were clearly identified and even contained the sample code I wanted.

I then proceeded to pick and choose certain slides to either skip or provide greater detail and asked questions of some of the topics it suggested. This saved a lot of time in organizing my thoughts and putting together an outline to share with the group. It was like collaborating with a colleague at a whiteboard. What’s more is that the conversation is saved and I can pick it up later to finish it, continuing right where we left off.

Here are a few more things for which I’ve used AI that aren’t necessarily related to my day job. Image generation has been around for a few years. Now all the images I use on my blog and that I added to this presentation were built with AI prompts.

I blogged about it a few months back. Have you ever written an ISAPI DLL and put it on a Windows web server? The resulting URL can be pretty long and ugly, especially if there are additional paths or parameters. If this is a landing page for a website you may want to clean it up by using rewrite rules. Doing this on a Windows server with IIS is quite a pain. Then again, it’s not easy using Apache web server either, but there seem to be lots of example tutorials out there for that platform.

I could not figure it out on my own, even after waiting through Microsoft documentation and trying several things. Finally, with several iterations under my belt for AI, I was able to get a nice-looking URL. Unfortunately I couldn’t find the chat history for this one. Not too long ago I needed to write a letter to cancel a financial service. I thought about using a template to make sure I got the addresses in the right place, but on a whim decided to just tell AI to write it for me. All I had to do was copy the formatted wording, add in the account numbers and print it out.

david cornelius 09


I have a friend who runs a small tutoring business and writes articles for newsletters and forums where her potential clients frequently use AI to help put out articles far faster than if she had to think up and write all the content on her own limited time.

I decided to try this out the first of April this year, typically known as April Fools, but concocting a new programming language with silly characteristics and ridiculous rules. I had a few ideas but wanted more, and AI suggested several that helped fill out the blog.

All of these uses of AI have a common theme: saving time. Now it could be argued that sometimes code that AI generates takes more time to debug than if you had written it yourself, but for the simple tasks I’ve been using it for thus far it has saved time, especially for those unit tests that I had to write.

I don’t use just one AI tool, and just like tools you’d see on a workbench, different tools have different purposes. There’s a lot of overlap but everyone will have their preference. I first started using ChatGPT like most everyone else but found Claude was a little better at Delphi, so I actually have a paid subscription there now and use its web interface frequently.

david cornelius 10


A few minutes ago I mentioned AI image generation and there are several services out there each with their own unique attributes. I’ve even had a couple on my phone in the past. For now I use the web-based

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

to generate images.

My voice isn’t that great for giving presentations, and so I tried out

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

this week for the first time. I typed in the text of what I wanted to say, selected a voice, then downloaded the .wav file and added it to the slides. I even created a voice patterned after my own voice for one of them. I’d be interested to hear what people think of the different voices for my presentation.

Finally, I’ve recently acquired the domain pnwdelphi.org and haven’t yet had time to build a site there, but went to lovable.dev and typed in a prompt to have it create a complete site for me within seconds. The service still has a few bugs to be worked out and I probably won’t pay to have it hosted there, but you can go to the domain and follow the link to see what it generated, which was actually quite impressive.

All the AI engines are constantly leapfrogging each other with features and capabilities. Claude is the one I’m using the most right now, and is one of the leaders in this field. I don’t know that I’ll stick with it forever or that I’ll ever totally rely on AI. The bulk of my day still involves manual coding and debugging, and I just can’t see how AI will replace many of the functions I perform on a daily basis, but I am using it more frequently and learning how to type better prompts, and I think that’s the key I’d like to leave with you today.

Learn how to prompt AI to get good results, or to repeat a common phrase, “to get a better answer, ask a better question”. Well, that’s all I have to share today. I hope you found some things useful in this presentation, or at least it gave you some ideas. Like I mentioned I have a full-time job, but on the side I still have a small business supporting some legacy code.

david cornelius 11


I also write about Delphi and other tech topics as I can. And if you’re interested in the crossplatform book I mentioned earlier, there’s a QR code to save you from searching for it. If you’re ever in the Portland Oregon area, check out the Oregon Delphi user group website to see when and where we are meeting. It’s usually the third Wednesday evening of every month. Drop in and say hi, we’d love to have you join us.

And last but not least, here’s a link to my favorite AI newsletter

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

that is filled every day with news and tips and interesting stories of how AI is being used and developed around the world. On their website are links to collections of AI tools and sample prompts, a gold mine for the AI enthusiasts.

Thanks again for watching.



Источник:

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

 
Вверх Снизу