Posts

Showing posts with the label Programming

Ordering pages in a coding challenge scrambled my preconceived notion about "natural ordering"

Image
We have a notion that there is a natural order of things.  I'm talking about ordering, and sorting, by convention as a mental aid or for product reasons.  Everyone is familiar with ordering products by weight, pieces by size, and names by alphabetical order.  We are so used to some types of ordering that it seems like the natural way when there is nothing natural about it. A common example is the "order of assembly", the order of parts installed onto the device.  The reason for the order on the direction sheet may not be immediately obvious.  The order takes into account the ease of assembly or the reliability of putting it in at that point in the cycle. This caused me to waste over an hour during a recent programming challenge while implementing an arbitrary set of ordering rules. Eventually, I realized that the notion of order is arbitrary and that I could change the standard to fit my problem space.  Let's go to the programming challenge. An example from...

Generate Model schemas from JSON and JSON Schemas in 20 languages using quicktype.io

Image
Sometimes you just want to create Model objects around some type of JSON payload of schema definition.  It seems like you either end up building your own tool, doing the conversion manually, or hunting around to find some schema generator.  Sometimes there just isn't a tool that you want to use and sometimes there is. I'm working Dart where we want to create immutable objects from deserialized JSON schema for AdaptiveCards.  I ran across an open-source tool, quicktype.io, that can generate JSON serializable model classes for over 20 different languages. There are several different settings that let do some customization.  You can then consume those classes/functions as is  or tune them to your needs. It is a great learning aid even if you don't use it for your models.  I really like how it lets me compare how different languages handle models and JSON. Disclaimer:  I have no idea who created https://quicktype.io or how it is run.  Pull down...