Webinar dealing with Dictionaries

Hi folks,

Anyone know of a particular webinar dealing with dictionaries and their usage?

Cheers - hope you all had fun #XDC2015

There is no webinar on Dictionary. I’m not sure Dictionary has enough material for a webinar. What sort of questions do you have?

Thanks Paul,

I don’t have any real specific questions, but here’s my long answer… I watch a lot of your webinars online and find them very informative, and presented in a fashion that I can take my time and experiment with many of the things that you do. I often end up rewriting lots of code when I discover a more elegant/efficient way to accomplish something, and that has made my code much better.

In general, I am particularly interested in data structures, and learning the ‘best’ or or most effective ways to structure/process/store sets of data. I use lots of arrays and build many objects which have properties as arrays, and have many look-up tables to represent the data. (I try to avoid multi-dimensional arrays). Dictionaries and Pairs etc interest me, but I don’t know enough about how/why/when to use them, or why them over arrays etc.

Similar in object creation - I can easily envision creating objects that might have 3 or 4 layers of objects nested within. This seems too complex, and begins to defeat the purpose (in my mind) of OOP… so it is hard for me to know how to best structure my classes, and their relationships to each other.

If it helps - I am use Mac/Desktop, my field is music - not in the audio/MIDI way, but in a more academic/analytic application. My objects are: notes, intervals, chords, keys, scales, time, events, durations, etc.

So that’s my thing. Thanks for your webinars - I like them lots.

Hi Doug,

handling data structures is something that is unique to every application. You need to ask us more specific questions :slight_smile:

Simple rule of thumb: if you think that something is complex, if you dread changing something then you got a code smell and it’s time to investigate a different solution.

From your description I’d say that you could have a look at Json, xml or even databases.

Thanks Beatrix - I know… much of it depends on the tasks at hand. (Which is why I was asking about a webinar.)

And yes, JSON looks very promising too. Will be looking into that some more for sure.


At first blush, I would expect to see arrays and nested classes with these kinds of objects. Dictionaries may or may not help. Dictionaries are great for quick access by value. Arrays are better suited to an ordered list and access by index.

Or another idea, Doug: Try to break down your classes into the most fundamental things and build a custom class hierarchy upon it.

As a rough sketch: The most fundamental thing in music is a timespan – and without any more information, that’s simply a pause.This would give you the first class. A timespan with a pitch is a note, so that could be the first subclass of it. An interval could be a class of two notes. A chord is a collection of three or more notes, looks to me like a case for an array of note, or a class holding such an array. A scale is another array of notes. And so on …

There are, literally, hundreds of ways to implement your data types, each with its own pros and cons of course. In the case of dictionaries, they are excellent for high-speed lookups of values for certain keys. If you plan to include localized note names or solmization, they could come in handy. Instead of walking though a case/select loop, you simply let the dictionary return the value for a certain key. Or in Xojo terms:
Instead of

Select Case NoteName Case "C" SolmizationName = "Do" Case …

you simply use

Tim and Ulrich - thanks for your input. It makes me realize that I am (probably) on the right track.

Ulrich, your advice is very close to the path I am following and the use of the dictionary is very much as I had imagined that it would be useful. I will continue to work on this project and will probably be asking more questions as it progresses.


Happy to read your reply, Doug!
Please keep us informed on your progress. Music is one of my fields of interest too, and I’ve been thinking about a music learning app some day. Maybe I don’t have to, depending on what you’re planning?

As a last word about the dictionary: Like Paul said, that simple thing is basically what Dictionaries are all about: Putting in a value for a key and retrieving it later. Would not give enough food for a whole webinar, but maybe it’s a good idea to make one about basic programming strategies, with topics like “what can I do if I want to get a value for a key?” – thanks for inspiration!

And good progress to you. Keep questions coming whenever you need help!

@Paul Lefebvre - Just saw the new webinar schedule. June 9 & 16 looks to be right up my alley. :slight_smile:


@Paul Lefebvre;

Maybe a webinar which contains subjects, which are too short on themselves to be covered in one webinar.

When I think on such subjects, I think of :

Computed properties
Interfaces (I think together with me, many people do not understand them

These are only suggestions. I love to watch (in my case recorded) webinars. I agree with Dough, I always learn something new. You have a very clear and human way of teaching. Thank you very much Paul for your excellent work.


Thanks, Chris.

I thought the Cool Language Features webinar covered computed properties, but a quick scan does not look like it does.

Structures are an advanced feature and unless you are using Declares, there is little reason to worry about them.

Dictionary is coming up in June.

I covered some interface examples in my OOP part 2 webinar.

Thank you Paul for listening to us, which is very much appreciated.

I look forward to your webinars. Keep up the great work!