3 ms·
In some circles, this idea is known as "incremental architecture". The idea is that you should architect and add abstraction layers to solve problems you have /
by makmanalp 9y ago
In some circles, this idea is known as "incremental architecture". The idea is that you should architect and add abstraction layers to solve problems you have /today/, rather than solving problems in the future.
One big reason for this is because we're often wrong about what problems we'll have in the future, or in what way they will manifest. Moreover, often the "bad" solution will work for far longer than we expect, and the day that we're anticipating where we'll be having problem X might never even come.
What's worse is that in the meantime each layer of abstraction adds a tax to how easy it is to fully understand and work with the code, to change things and add new things.
What you do want to do is to write code that is /open to/ being abstracted. E.g. keep things structured nicely, start with a basic function (named similarly) or a few related functions before putting in a full blown class, name things well so it's easy to find them while refactoring, etc.
- robbiep 9y agoThanks. I've done this with iteration 2 (current version) or my backend but now I'm not a one man shop and have a team (well one other junior backend and a senior mobile). And we are architecting for some pretty major new features so it's interesting trying to strike a balance with both what I've learned along the way and what it seems 'best practice' is when it comes to python
- xapata 9y agoCareful with where you read "best practice" from. Some folks like to brag about their new high-scalability architecture, but it's way over-engineered for most software. The pattern I described of using SQLite tables to mimic a message queue will be very easy to switch to PostgreSQL or MySQL. If you hit serious scale you can switch to something like Kafka or Kinesis. That'll be a bit more involved, but hopefully your revenue and team scaled to match the compute needs. When you switch to Kafka, you can use Spark or Storm instead of cron. If you switch to Kinesis, you might choose AWS Lambda. So you're not writing yourself into a corner.
- deckiedan 9y agoFor an instant latency boost, you can also pop the sqlite db directory on to a memory tmpfs.