Articles & Stories
When starting from nothing, I’m unsure where to begin. When writers have writer’s block, they write throwaway material just to start the creative process. But I won’t code something to throwaway, because that offends my efficiency-nuttiness. After the vanilla starters (create a repository, set-up dev tools, make a landing page), you may have a hazy idea of what to build, and no idea how to get there. “I want to build an app for people to track their diets,” but all you’ve got is a cold landing page.
Coders have a peerless cure for mental blocks. It’s the database schema. SQL lends Structure to your application, so create it first. It reduces the search space of your creative process. Instead of being faced with an intractably vague “build-an-app” problem, writing the schema constrains your thought to the relationships that entwine your app, and naturally discards things that don’t matter.
Create the schema before you flesh out interactions and visuals. Start with a spartan user table:
CREATE TABLE user ( id SERIAL, name VARCHAR(100) NOT NULL, email VARCHAR(100) NOT NULL, created BIGINT NOT NULL );
Now you can start thinking about what a user relates to. For your diet app, maybe a user needs to keep track of their calories. For that, they probably need to keep track of the which foods they’re eating. And how much of it. Great, more tables:
CREATE TABLE calories_per_food (...); CREATE TABLE food (...); CREATE TABLE quantity_food_eaten_by_user (...);
Sow a simple table, like
user, and then grow your schema outward.
Relationships grow like O(n2) weeds, and so you’ll naturally just add the worthy tables. Your coder’s block will vanish along with your app’s vagaries. It’ll hit you, how exactly the damn thing should work.
Then create sample data. You’ll tweak your schema, ‘cause some data won’t fit right. But at the end it’s like you drank your milk. No matter what fiddling you do with the logic and interactions and skin, your app has strong bones.
Berlin-based software engineer building machine learning backends.
If you're in the area, send me an email, auf Deutsch oder in English.
Want updates when I write?