It’s the first week of the Just Code challenge so I’m starting with something pretty simple. This app lets you choose a color using the system color picker and then shows you the color values in hexadecimal (useful for programming, HTML and CSS), RGB (red, green, blue), HSV (hue, saturation,value) and CMY (cyan, magenta, yellow).
Xojo is an Object Oriented Programming Language and, among other things, that means that it supports Methods Overloading. We have seen in other posts that some of these overloaded methods can be Class Constructors, but, there are others things you can do. For example, we can overload the operators. These are the methods in charge of adding two instances of the same class, subtracting, multiplying or dividing them. But we also have at our disposal another operator we can overload: Lookup. What advantages does this give us and how it does it work? Let’s explore it while building a Preferences class we can use in any of our projects.
In many of our development projects, if not all, we are confronted with situations when we need to test our classes before the final deployment of a project. I’m not talking about Unit Testing here, though I highly recommend the excellent session on that topic from XDC 2018.
For example, it would not be desirable to send hundreds of emails to all the entries in a database simply to test one of the workflow steps or to verify that emails are being delivered as expected. It would be a lot simpler, and less disruptive to those using your app, to test using a few email addresses that are under your control.
So let’s establish a mechanism that allows us tell our apps when to run in a “simulated” mode vs. a “real” mode for all or some of the components that we need to test along the development cycle.
Whether you are using Xojo to create your very first application or if you are coming from other languages, like C# or VisualBasic, customized UI controls are probably one of those things you have in your to-do list. For multiplatform Desktop apps, you will find that the Canvas class offers everything you need. In order to show you how easy it can be, follow this tutorial to recreate the ImageWell UI class control, provided by default in the Xojo framework. Our customized ImageWell will be able to proportionally display any JPEG file dropped by the user on the control, centering it on the available surface.
The linker is not technically part of the compiler, but it is needed to make a completed app. The purpose of the linker is to combine (link) all the various bits and pieces of machine code created by the compiler along with the necessary information to create a runnable app for the OS.
This is the ninth and final post in our Compiler series. Previous posts:
Code generation is one of the last steps of the compiler. This is where the compiler emits actual machine code for the IR that was previously created.
This is the eighth post in our Compiler series. Other posts:
Object Oriented Programming (OOP) puts in our hands the ability to create apps in a flexible and powerful way. Xojo embraces that philosophy in the Xojo language itself, allowing us to implement code in a flexible way for reuse, extension and maintainability that reduces the development cycles. One of these language tools is, in fact, common in other low level programming languages: Casting or type conversion. If you are interested in this (and you should be), continue reading and discover what it is, why you should be interested in it and how can you use it in your next Xojo app!
The last post covered optimization in general. In this post you’ll look at a specific optimization called “loop unrolling”.
This is the seventh post in our Compiler series. Other posts:
Like his father, my teenage son loves video games. The single player games where you take a character through some kind of adventure are the ones I like most. These usually have a fair number of AI-controlled enemies that must be defeated. My son, on the other hand, prefers to play against other human beings. When I asked him why, he said, “The AIs are so predictable.” To prove this to me, he took over when I was having trouble defeating a particularly difficult enemy and quickly dispatched him, narrating his strategy as he went and barely being scratched in the process. My son is an elite player compared to me partially because he puts a lot more time into it than I do but also because he loves video games far more than I do.
Just as people have varying levels of skill and interest in video games, the same is true of app development. There are those that are happy to devote enormous amounts of time to learning everything they possibly can. They don’t care how long it takes. They want to have control over everything and are willing to do whatever is necessary to make that happen. I’m so glad those people exist because there’s a lot of great software that might not otherwise have been created without them. I’m not one of those people. I really want to focus mostly on what makes my application unique, abstracted from the nitty-gritty of app development.
That’s why I have always been attracted to tools like Xojo. I am a citizen developer. Of all the job titles I have had over the years, all of them in tech, none have ever included words like programmer or engineer. I do some software development but it’s just a part of my job. It’s something I do to help me in my work or to help my co-workers.