Skip to content

Category: Learning

An Introspection Gotcha

Introspection is a very handy and useful part of the Xojo language.

You can use Introspection to examine many of the objects that are in memory at runtime. You can access the properties in those objects, call methods on those objects and even create new instances- with some caveats of course.

Comments closed

Easily Sorting Arrays of Classes

Sometimes you’re going to need a data structure that is an array of classes and you’re going to want to sort them. The standard array Sort method can only sort simple types (Text, Integer, etc), so what do you do?

The traditional technique has been to use SortWith. You create a separate array of a simple type, populate it and then sort the temporary array using SortWith to sort the class array.

But there is an even slicker way to sort that was added in 2015 Release 3. You can now create your own custom comparison method and use that to sort the class. This custom method returns 0 if the values to compare are equal, a positive if the first value is greater than the second, and a negative value if the first value is less than the second.

Comments closed

Sorry, You’ve Run Out of Memory

Most of us build apps without thinking too much about how much memory the app will need. Sure sometimes you end up creating an app that is a real memory buster but that’s unusual. With virtual memory, gone are the days when your app would just run out of memory and crash, or are they?

Comments closed

Tip: Automatic Reference Counting

As defined on Wikipedia, Automatic Reference Counting (or ARC) is a “memory management enhancement where the burden of keeping track of an object’s reference count is lifted from the programmer to the compiler.”

With object-oriented programming, each new object you create takes up space in memory. This memory needs to be managed somehow. In the beginning, this management of memory was left entirely to the programmer, such as with C++ or originally with Objective-C.

Comments closed

Hour of Code: Cat Pictures

It’s time again for Hour of Code! The Hour of Code is a global movement reaching tens of millions of students in 180+ countries. Anyone, anywhere can participate in Hour of Code, from ages 4 to 104. At Xojo, we are again participating in this wonderful way to help people learn to program.

Comments closed