edit: tell claude not to use the artifact (the right panel with all scrolling code) and it will give you each section of your code to modify. it’s less easy than a global copy-paste, but it’s faster and it works in the end…
As said, by default it creates understandable code that you can maintain and debug yourself.
But even for finding bugs, AI is way better in doing this and faster (even for code you wrote yourself).
About commenting code: Claude does this too by default.
Side note:
You can ask Claude to write code in your own style. For example if you want to add something to your own written code and ask it to do this in the same coding style, it will just do that.
Recently I got a mail of a custumer who had an odd issue that was not that easy to find/fix. I copied his mail to Claude and it (she?) found and proposed options how to fix it in seconds. Including why it happens and which options are best.
AI is fantastic but does make you a lazy coder.
1500 of html ? in a xojo html viewer ?
yes… and room for more ! I did not count the included libraries
And here lies a problem, It will make several devs who have tendencies to laziness, mediocre devs, to the point of not being able to solve anything without help. And as I said, AI commit errors. Not all errors can be pulled back without irreparable damages.
https://m.youtube.com/watch?v=6epzmRZk6UU&pp=0gcJCdgAo7VqN5tD
Applicable (and good track)
Take a rest Chris. Paranoimia was a term invented to describe a state of paranoia induced by not sleeping (insomnia).
I like this version a bit more:
I’ve been spending some quality time with ChatGPT to start a project I’ve been thinking about for a long time but haven’t got round to realising. Namely, a collection of code that can be reused in my future projects.
https://github.com/o3jvind/XOJO-AppUtils
I’ve started with a preference class and I think the result has turned out OK.
I have subsequently asked Claude to evaluate the code and Claude is very kind. This what Claude thinks of ChatGPT’s (and mine) code:
I’ve reviewed your Xojo preferences class, and overall it’s a well-structured and comprehensive solution! Here’s my evaluation:
Strengths
Excellent Type Support: Your class supports a wide range of data types (String, Boolean, Integer32/64, Double, Single, Color, DateTime, Array, Dictionary, Picture) - this covers most application needs.
Smart Caching Strategy: The memory cache (
mPrefsCache
) is a great performance optimization. Loading all preferences into memory at startup and keeping them synchronized is efficient for most use cases.Cross-Platform Path Handling: The
GetPlatformSpecificPath()
method properly handles different OS conventions for storing application data.Robust Error Handling: Good use of try-catch blocks and the
LastError
property for debugging.Database Safety: Using parameterized queries prevents SQL injection, and the type-specific storage approach is clean.
Areas for Improvement
1. Memory Management for Large Data
xojo
// Consider adding size limits or lazy loading for large objects If data.Length > MAX_PICTURE_SIZE Then // Handle oversized pictures differently End If
2. Thread Safety
Your current implementation isn’t thread-safe. Consider adding:
xojo
Private mLock As CriticalSection // Add to properties // In methods that modify cache: mLock.Enter Try // Your cache operations here Finally mLock.Leave End Try
3. Database Connection Management
The connection stays open for the app lifetime. Consider adding:
xojo
// Add periodic connection health checks Function IsConnectionHealthy() As Boolean Try mDatabase.SelectSQL("SELECT 1") Return True Catch Return False End Try End Function
4. Enhanced Error Recovery
xojo
// In LoadPreferencesIntoCache, handle corrupted entries better Catch e As RuntimeException System.DebugLog("Corrupted preference key: " + key + " - " + e.Message) // Continue loading other preferences rather than failing completely rs.MoveToNextRow Continue End Try
5. Performance Optimization
Consider adding bulk operations:
xojo
Sub SetMultiple(preferences As Dictionary) // Begin transaction // Set multiple values // Commit transaction End Sub
6. Schema Versioning
Add a version table for future schema changes:
xojo
// In CreateTablesIfNeeded mDatabase.ExecuteSQL("CREATE TABLE IF NOT EXISTS schema_version (version INTEGER)")
Minor Issues
- Color Parsing: The color parsing assumes 6-character hex. Consider validation.
- DateTime Handling: SQLDateTime format might have timezone issues across platforms.
- Picture Format: Hardcoded PNG format might not be optimal for all use cases.
Testing Suggestions
Your test suite is good, but consider adding:
- Stress tests with large datasets
- Concurrent access tests
- Database corruption recovery tests
- Migration tests when you add schema versioning
Overall Assessment
This is a solid, production-ready preferences class that demonstrates good Xojo practices. The caching strategy and comprehensive type support make it very usable. With the thread safety and enhanced error handling improvements, it would be excellent for any Xojo application.
Rating: 8.5/10 - Well architected with room for some robustness improvements.
Just got asked by claude to migrate to a Max plan after a day of heavy coding …
lucky me my Pro plan resets in an hour only… this is reasonable.
Impressive! Is the GUI QT or Tkinter? Or something else?
it’s tkinter
here is the app for arm mac, you may test it !
USB Monitor.zip (10.8 KB)
ps: it’s worth saying that I don’t know python at all…
I made it to detect new usb devices easier than with other tools like usbprober
if you plug an usb device, it appears in top of the list, and flashes in red !
Do you used Customtkinter too??
I am strictly a dabbler of python GUI “stuff”. Yes, some Customtkinter, but not much. I have played a bit with PySimpleGUI too. Personally I feel like the GUI side of python is too fragmented for any one GUI toolkit (?) to really make solid advances and come out on top as the clear winner. I could be wrong though. I would certainly love to be wrong.
One thing worth pointing out to users of Ai - if you use the public versions (ie non paid for) your data will become part of the Ai’s dataset, not good if you are working on confidential products or products for clients. Paid for versions also do this unless you go and check the correct privacy features in the Ai’s settings.
My experience has been that they’re not very good at “remembering” things I’ve tried to teach them. No idea how the whole training thing works, but it has often made the same mistake I corrected it on just a few days earlier. So I’m not sure how compromised any proprietary info shared actually is.
ChatGPT’s response is:
If you have sensitive or proprietary data, it’s best to use ChatGPT Enterprise, ChatGPT Team, or API access with clear data-use guarantees.
GP-s should do that, but you need subscription, i read some use case , seems to work
well from european point of view, i wouldn’t trust open ai to keep data. nobody is caring about Palantir,
but you can self host mistral AI on mac mini 4 for sensitive data, i plan to do that, it’s open source