ChatGPT 4o

I’ve been using chatGPT for a while to help code and debug SQL statements with a lot of JOINs - really helpful. I had thought that it wasn’t up to scratch for Xojo based on the forum last year but I just tried 4o on a problem with a mix of SQL and Xojo code and it got me to the right answer pretty quickly.

Well worth a try if you get stuck with bugs. Its amazing how much code it can handle and infer from snippets you put in.

3 Likes

It does a really good job these days. And if you run into issues you can copy and paste the Xojo documentation for the class it’s getting stuck on into your prompt.

I’ve also found Claude to be extremely good at creating lean, efficient Xojo, especially once you’re a few prompts in. I had a very long, complex method and it refactored it for me in one pass in a way that I wouldn’t have thought of on my own.

Obviously you need to audit each and every line of code before putting it into production and test for edge cases, but that’s hardly any different than doing code review as part of a team anyway.

1 Like

I also find ChatGPT a very useful tool to accelerate the development of Xojo applications with.

It isn’t that smart when it comes to doing very low level or advanced stuff, such as using custom declares to access less known OS/library functions, but still a huge time saver non the less (even if just to bounce ideas off).

Maybe Xojo Inc could implement this for free?

And lost the hard work they’ve done these last months ?

I do not hink so or a great change appeared…

It would be really great if we could integrate Copilot & Co. into the IDE via API. But Xojo is either sitting it out or trying to overengeneer it… :person_shrugging:

An example: https://tracker.xojo.com/xojoinc/xojo/-/issues/59619
and another one: https://tracker.xojo.com/xojoinc/xojo/-/issues/77950

1 Like

Not sure implementing chatgpt in Xojo would destroy the hard work?

What are you talking about?

What we want is nothing more than an API (a channel) through which external tools can read and write the editor text…

What hard work would that destroy?

1 Like

I remember that Geoff is working on the subject. No more than that. This dates from 8 months ago or so.

Or… was I dreaming ?

Personally I’d rather that Geoff and the team focus on using AI to fix bugs and add promised features, rather than adding AI to the IDE - as we can still get that in another app.

There’s a benefit of having a GPT that is trained on a variety of languages as I’m sure few of us use only Xojo for creating apps - mine include elements of php, sql, python, html, json, regex, Swift, C etc - in none of which I’m very proficient.

But it does beg the question, what is chatGPT trained on to get the Xojo data? Aren’t the manuals and forum behind password protected areas?

So ChatGPT answered that question for me:

1. Official Xojo Documentation

Xojo Docs – The official documentation provides details on classes, methods, and best practices.

Xojo Blog – Sometimes has deep dives on new features or tips.

2. Xojo Forums & Community

Xojo Forum – The most active place for troubleshooting, where Xojo developers share solutions.

Xojo Feedback Tracker – Helps check for known bugs or feature requests.

Forum: one must register (apparntly no need to have a license)
Manual and Documentation are free for all…
You can see that by yourself by going there with a different browser (one you are not registered)…

There are some forum areas that needs login, but many sections are public.

One could argue that the forum is not a good place to get examples from for training as it has no way to know if the code it finds is good or not. It’s not uncommon for bad code to be presented with a query of “why doesn’t this work” or code snippets off the top of one’s head without first testing in the IDE.

2 Likes

This is something I was trying to say in this other thread (TL;DR)

This is a very good point.

But the training also includes the context and the subsequent replies with suggested fixes. Presumably, the generative algorithms are able to take all that into account when rendering an answer.

What I didn’t share was the rest of ChatGPTs’ response which was:

3. SQLite Documentation (For Database Issues)

SQLite.org – Since Xojo uses SQLite as a built-in database, referencing SQLite’s official documentation helps solve issues related to SQL queries and performance.

4. My Own Knowledge & Experience

• I synthesize solutions based on programming logic, past knowledge, and general best practices from working with similar languages (VB, Python, JavaScript, etc.).

• Since Xojo has a VB-like syntax, experience with Visual Basic (VB6, VBA, .NET) is also relevant.

Just like any responses from the forum it’s important to check out, understand and test the answers, not simply deploy. But ChatGPT’s broad training does make it an excellent guide and it has raised issues for me that I wouldn’t have found by surfing or on the forum. EG how many would know that when using a temporary SQL table and applying an ORDER BY xxx SQL doesn’t necessarily keep the same order if you do a subsequent SELECT from the same table.

Not entirely sure what you are saying here. Without an ORDER BY on a SELECT, SQLite is allowed to return the rows in any order it likes. If you are saying that when doing a SELECT from a temporary table, an ORDER BY is not necessarily respected, then please supply a reference.

2 Likes

Well, it’s a bit off topic, but I had a temp table created with an ORDER BY. I then wanted a listing in the same order using a SELECT. Didn’t realise that subsequent SELECT would also need an ORDER BY to ensure the correct order.

When creating a new table, generally an INDEX (or PRIMARY KEY) is used to keep the order of a table’s column (or columns) in a particular order.

If you’re always going to apply the same ORDER BY, an INDEX could potentially replace the need for the ORDER BY.