Posts

Image
Hello, welcome, and thank you for your interest in Munchy Beta. Munchy is an iPhone app that uses AI to analyze diet. It is primarily designed with two goals in mind: • To give the user a better understanding of the food we eat • To help the user with long-term diet tracking If you’re interested in trying Munchy Beta, you’ll need an iPhone with at least iOS 16. Sorry, Android users. You can contact me through the platform where you’re reading this or send an email. Once you’ve done that, you’ll receive a reply within a few days with more details. And now you’re probably wondering: - Does it even work? Yes, it does. If you take a picture of what you’re eating, I believe I can demonstrate that the accuracy over time is better than 20%. In reality, I think it’s better than 10%, but I’d rather under-promise than over-promise. - And is 20% good? Yes, it is. Manual diet tracking takes time and always depends on either weighing the food or making a personal judgment. B...

Data Driven Programming.

Image
Back in the days when real men programmed assembler , and the interwebs were nothing but a wet dream, data-driven programming (DDP) was a big thing. It was one of the most important ways of improving the capabilities of crappy assemblers and compilers and enhancing the performance of slow computers. Imagine doing a sinus calculation on a 1MHz 8-bit Motorola MPU without floating point.  Then you would know what one flop is.  The solution was to replace the insanely costly math with a sinus table, thus replacing code with data. If you wanted an arcTan function instead, it just required a new table.

Examples Available On GitHub

Image
So, I've opened a GitHub repository .   The idea is to provide some real code to back up my claims about building larger applications. I put a lot of thought into the platform, language, etc., that I wanted to use.  I finally settled on:

The Basics Of Event Handling

Image
As I mentioned in my first post about building classes , I try to enforce a software design where classes are arranged in a pyramid-like hierarchy , with methods only trickling downwards and data only trickling upwards. This approach may seem a bit restrictive initially, as you often encounter situations where lower classes need to inform higher classes that something has happened. Since lower classes cannot directly call higher classes under any circumstances, this is often addressed in games by simply polling the lower classes for changes. A classic game loop would look something like this:

Remove Error Handling From Your Code

Image
There are two main ways of directly dealing with error handling in modern programming: exceptions and error codes. Unfortunately, neither of them is any good. Although various techniques exists to aid in debugging - like asserting and logging - these methods are not really great for catching unexpected behaviour or the user being a douche. Essentially we are stuck with the two bad ones.

Why Wrappers Are So Useful

Image
Now, if you read my previous posts, you will know that I have mentioned wrappers several times, and said that they are a very powerful but underrated tool. If you have never used wrappers before, this might seem like a fuzzy statement, because at first glance it might look like a lot of wasted work.

Building Classes Part One

Image
As I mentioned in the post about The Lego Principle , I regard the main bulk of classes as self-contained and unitform building blocks, put into a pyramid, and only knowing about classes in the layer immediately below them. As methods can only travel downwards and data only can travel upwards, classes have no need to know about classes above them. This is an extremely important point. A class should be 100% self contained, and only use functionality from classes below it and expose data to classes above .