3 ms·
I personally follow a rule called “simplest model that explains foreseeable reality”. So at first you really have to dig into what “reality” is .e.g if you are
by nojvek 6y ago
I personally follow a rule called “simplest model that explains foreseeable reality”.
So at first you really have to dig into what “reality” is .e.g if you are building an auth system, how many ways do you login? Login page for customer, login via sso, login via google auth federated etc.
Now foreseeable reality is what is most likely going to happen. YAGNI proponents would say don’t do this but I’ve found that thinking through future scenarios that competitors are doing or customers asking for (even though you don’t have time to do it) should be taken into account. You realize it would be nice to support auth via personal tokens restricted to certain api calls.
Having a solid understanding about foreseeable future is paramount. Task #1
Then it’s understanding what pieces need to be stitched together to make it happen. What changes together, what changes independently. What are the separation of concerns between the pieces?
You need to represent different auth types in db. A central place that takes a request and it’s headers to authenticate. Also authentication and authorization are different things and shouldn’t be bolted in the same place.
Having an in-depth understanding of separation of concerns and boundary contracts is Task #2.
Nailing 1 and 2 down usually leads fo clean implementations.
Also huge believer of continuous refactoring. Sometimes reality changes. Focus on a small thing you understand for sure. Incrementally add things and re-think the separation of concerns and how reality is represented in datastructures. If that needs a change, make it happen. Building on wrong level of abstraction and working around it has caused a great level of pain.
- Person5478 6y agoThere are a lot of things that go into the decision to future-proof (and how) vs doing the absolute simplest thing and moving on. One of the things that goes into it is how clear the direction the business is headed in and how experienced you are with both the tech stack and solving the specific problem.