Xojo Design Mistakes Video

Xojo released my 2019 Xojo Developer Conference video on Xojo Design Mistakes on YouTube a few weeks ago at https://www.youtube.com/watch?v=s-FOUxAtK7I&feature=youtu.be.

I liked my alternate title better: Thankfully time travel hasn’t been invented otherwise my future self might come back to murder me because of stupid decisions.

Based on feedback many people found the video to be useful. Hopefully you do too.

The reason I brought this up today is that I’ve spent the last week working on optimizing several large Xojo projects. I’ve identified several areas to look at and if I think it’s it might be worthwhile to look at (after using Instruments and Profiling) I will create a small sample project proving if I can make it more efficient. There are several things that I believed to be true that are not. Here is my initial list:

NthField is Slow: It’s not fast and I wouldn’t recommend using it in a huge loop but it’s not *that* bad. Converting a project that uses it a lot to use Split and then bounds checking just isn’t worth the overhead and hassle of screwing up the code. Plus, it’s one-based whereas Split creates a zero-based array.

String Concatenation is Slow: Again, it’s not exactly speedy in loops but we’re talking ticks if the strings are relatively short. If you use something like this:

dim someString as string = "First line " + _
" second line" + _
" third line"


it is way faster than:
dim someString as string = "First line "
someString = someString + " second line"
someString = someString + " third line"

MBS Functions are always faster: Sometimes MBS *is* faster but not always. Things like picture saving is actually pretty efficient in Xojo. Directory scanning *is* faster using MBS but only in classic API. If you’re using API 2.0 use the FolderItem iterator in a directory and it’s as fast as FileListMBS.

Anyway, that’s a quick and dirty summary of things I’ve learned. Some times it’s good to challenge your assumptions. Happy coding!

4 thoughts on “Xojo Design Mistakes Video

  1. “Thankfully time travel hasn’t been invented otherwise my future self might come back to murder me because of stupid decisions.”

    🙂 Very well said, Bob. I don’t think I would live either 😉

  2. Great video. Looking forward to see you at another conference!
    I think I watched it live at the conference.

    And if you need something, I’m always there to help with a new function in our plugins.

  3. Very good Bob. Think I got most of your coding advises already in my system, as I value quality in coding. In long ago project we had “code-review” sessions which in the end saved us from a lot of trouble harder to fix late state.
    About the video: I would save up questions from the audience rather than letting them timing out your presentation and, even more important, as a viewer of this video I just can’t hear the questions at all, so it get’s a bit annoying.
    Despite the fact that you have found a new challenge, I still hope to see an occasional presentation from you. London 2021 ?

Comments are closed.