About admin

programmer

Validation with Type Guards and Mapped Types

Slightly enhanced version of the code is now on NPM and GitHub.

Having spent a significant portion of my programming career using dynamic languages I understand the value of rapid prototyping and feedback that they provide. I’ve also seen enough dynamic code to know that most dynamic codebases are full of brittle validation logic that our brethren from the statically typed camp don’t have to deal with. Well, that’s not entirely true. They still have to deal with it but I think they have an easier time because the compiler can help them. There are many solutions to dealing with this problem in the dynamic camp in the form of libraries and DSLs but today I’m going to present a solution that uses nothing but TypeScript’s built-in capabilities to help us build validators for POJOs (plain old JavaScript objects). Continue reading

Incremental Compilation with Symlinks

So it turns out that TypeScript doesn’t really have incremental compilation. This means if I rely on some 3rd party modules then recompiling anything that depends on that 3rd party module will transitively recompile everything. I understand that TypeScript is not a build system so delegating those responsibilities to one is a sensible design decision. The trouble with build systems is they can get pretty hairy pretty fast and ideally I want to avoid the overhead of one. Fortunately we can avoid the hairy parts of a build system by using a few symlinks and declaration files. Continue reading

Constraint Solving with Picat

I’ve been playing around with a few multi-paradigm programming languages. The most recent one is called Picat. It’s a hybrid language that is a mix of logic, imperative, actor, and functional paradigms with built-in constraint solvers and planners. That’s a lot to take in so whenever I’m faced with a language with roots in the logic paradigm the first thing I try to do is solve “SEND + MORE = MONEY” cryptarithmetic puzzle. It’s a small and manageable problem and there are at least two ways to solve it so it allows one to exercise several features of the logic and constraint paradigms. Continue reading

More augmentation, less automation

The emphasis in the DevOps ecosystem on automation instead of augmentation annoys me to no end. These people preach culture and enlightenment and yet the most fundamental observation escapes them. Tools must be subordinate to human intentions and not the other way around. This also goes for culture. Culture is another organizational tool. Continue reading

Cargo Cult Saturation

Software is a formal discipline and yet the industry is saturated with cargo cult practices. Most companies are not Google, Amazon, Twitter, Facebook, Netflix, etc. and they never will be but a lot of programmers uncritically internalize and advocate for practices developed at those companies. Let’s try to critically analyze some of the thought leadership and technology that has recently come out of those companies. Continue reading

You don’t need HashiCorp’s Vault

There are a few things I dislike about the programming industry. Much of what programmers do is driven by fads and trends. There is a lot of cargo culting with little critical analysis. This is especially true when it comes to DevOps tools and practices. Today I’m going to argue that you don’t need to deploy and manage any kind of secret token management system, e.g. Vault, if your workloads are already running in the cloud. I’m going to argue that all you need is a set of GPG/AES keys and whatever key management system (KMS) is offered by your cloud provider. Google has Cloud KMS and Amazon has AWS KMS. I’m sure Microsoft has one too but the point is they’re all equivalent and basically have the same API. For the rest of this post I’m just going to generically refer to all these solutions as KMS. Continue reading