Repository navigation
HEW general requirements
If this project expands, it will probably need its own group, and commentary like this can move there. But for now this is where it lives.
In a production setting we may assume availability of certain facilities. Attempting to implement those here would tend to stand in the way of people who have them. For now we will assume they exist, and if proven otherwise we might elect to fork a HEW project to layer fallback code on top of them.
Things we assume are handled elsewhere:
- access logs - Every HTTP proxy and load balancer can do this, most can do it better and with higher accuracy
- log collection - we just need to make good logs, let someone else manage them
- fatal errors - we assume health check and auto-restart logic are provided. If we crash, we crash.
- Parallelism, restarts - Orchestration is external. We will not solve this problem, and only basic efforts will be made to ensure that the code does not obstruct people from doing it themselves.
- Stream compression - a load balancer on loopback has more and better options for compressing replies
- Bot detection or mitigation - enjoy your tarpits on your own time
- Caching - cache headers, perhaps. Cache management is for dedicated tools
- session affinity - Please don't. But if you must, we are not going to help you load that footgun
Things we are not particularly interested in at this time:
- authentication and authorization - save, perhaps, SSO integration
- Server-side Rendering for Single Page Apps
Things that are likely "A Bridge Too Far"
- internationalization - i18n concepts trigger Dunning-Kruger in most people. We are sympathetic, but wary.
Everything else is up for consideration, but know that some requirements will be fulfilled by running a separate sub-project, and even then the combinatorics could prove challenging.
These are the things we want to be aware of:
Perhaps more than any project you have worked on, if your goal is to create a project that is permanently forked, then every commit is essentially performance art. Telegraph your intentions clearly. Do not use three commits to achieve one thing. I am not usually a fan of squashing PRs, because they tend to hurt obviousness, but in this case it may be appropriate.
Anyone using this code will pull from upstream from time to time. They need to understand what we have done. They need to figure out how to dovetail it into work they have (after all, they may have already identified and fixed this exact same issue). They need to be able to disagree. We will try to separate optional tools into separate repositories, but eventually someone will want to go a different direction than we have. They may revert a commit or edit it, but still keep pulling from upstream in the future.
Do not use one commit to achieve two things. And as much as possible, put all of the changes in one place. Everyone who uses this project is going to immediately start inserting large blocks of code into the middle of it. Think about the contents of the file from the use-cases of the user, not the author. This may mean that some code for special purposes should be in a separate file. Once the user has avoided the initial namespace collision, there is nothing more for them to do.
For that reason, I'm going to recommend against tracking project changes and documentation in the README. Any user will block-delete that code and put their own documentation in there, which means every subsequent update will have to be resolved manually. Instead, this project will most likely rely heavily on this wiki. This concern is also creating some questions about how to best handle testing.
This is a project about avoiding people having to write the same code over and over. If we insist on further boilerplate from the user, then we have not succeeded. Do not create a template file that has to be copied every time someone wants to implement a feature, add a page, create a test. They cannot merge such solutions from upstream.
Wherever possible, make the setting once at startup, and make it stick. This may affect library selection. For instance, this has already eliminated most of the available logging frameworks from consideration in hew-express, because there is a common philosophy of configuration on use, rather than configuration on startup. This author wonders if in fact these logging frameworks were ever intended for anything larger than small systems, based on the amount of boilerplate they require for anything beyond rudimentary or pre-production use.
On the best of days, a push -f is considered an act of violence. If your project has been forked then it could be an act of war.
Refactoring a piece of code over and over can also be problematic in such a situation. It will lead to merge conflicts. This is yet another way in which getting something right the first time can be important. With that in mind, a prospective contributor may wish to fork this project twice. Once for potential pull requests upstream, and then fork it again in order to use it our project with their changes. This will hopefully give you a better feel for how others will experience the change.
Then there's bootstrapping a project. hew-express has already experienced issues of this flavor, and the current recommendation is that new HEW projects start with an empty master branch, experiment with a few different organizational theories, and not be afraid to use history re-writing to establish a narrative in the code. Only once you're reasonably content with the quality of your efforts should you merge to master. From everyone else's perspective this will represent your initial effort.
For example, adding correlation id tracing when logging is already in place makes more sense from a commit history than adding correlation ids first and logging second. And so the commit history was reworked several times to fix first some formatting issues, then an organizational oversight, a problem with logging of exceptions, and only then were correlation IDs added back in, covering both the in-bound and out-bound scenarios in one go. You will only get to use this once, so make the most of it while you can.