Article Preview
Buy Now
FEATURE
Maps Part 2
Implementing Maps in Xojo desktop apps with the MapKitMBS plugin
Issue: 17.6 (November/December 2019)
Author: Markus Winter
Author Bio: Markus is a Molecular Biologist who taught himself REALbasic programming in 2003 to let the computer deal with some exceedingly tedious lab tasks. Some call it lazy, he thinks it smart. He still thinks of himself as an advanced beginner at best.
Article Description: Number>
Article Length (in bytes): 17,875
Starting Page Number: ea
Article Number: 17604
Related Link(s): None
Excerpt of article text...
I love code examples—following the code and especially seeing how somebody much more advanced than you solved a particular coding problem is a great way of learning how something functions.
That is also the reason why I gripe a lot about examples—because they often could be so much better.
For one thing, they could be
much better documented: a method should have a comment at the start explaining what the method does, and code should be well-documented throughout.For another, code examples should not crash. Code examples are supposed to teach you how to use something. But what if they also teach you bad programming habits? Wouldn't it be much better to learn from good code than from bad code? Wouldn't it be good to have defensive coding (like checking for
Nil
, checking that a row's index is larger than -1, etc.) become the norm and any beginner becomes immediately aware of it?And finally, I also feel that with a bit more effort, code examples could be made much more re-usable. Imagine, if all the code examples in Xojo or MBS were written with re-usability in mind, where you could simply copy and paste a
ContainerControl
into your project? Where, thanks to the extensive comments, it would be easy to integrate that particular functionality into your app—now how would that increase productivity and value for a user?This MapKit project is a perfect example—I will try to implement two ready-to-use ContainerControls that you can simply copy into your own projects. Which then begs the question: couldn't it have been like that in the first place? And I suspect the same could be true for many (most?) other example projects.
...End of Excerpt. Please purchase the magazine to read the full article.