No code is faster than no code
205 Temporary Placeholder
or something along those lines?From a user perspective, getting a 404 after following a link that previously worked can indicate a couple of things. Like maybe the resource still exists in some other place, but they didn't set up redirects. Maybe it's been "privated" in some way, and I no longer have access to it.
A 410 makes it explicitly clear to me, that the resource has been permanently deleted. It'd also be nice if the response included some metadata as to when the resource was deleted.
5xx is a failure to serve the page, which is not the case if a placeholder is served
5xx still returns content. 5xx can return HTML content. Browser will display it properly.
4xx codes mean client error. 5xx codes mean server error. Server misconfiguration is a server error. Client did nothing wrong.
You can serve a body with a 404, user will see the appropriate message and robot can safely ignore this page until further notice. Search engine will often retry 404 later and slowly reduce crawling if it stays not found.
I mean, the real point is here : nobody cares what your server is answering just after being setup. However I can see how it’s a problem if for any reason, a server loses its configuration and still acts like everything is fine.
(ofc you can bypass this by monitoring a more specific url but it’s not always possible if you are not the one deciding what the server serves)
For your analogy, it’s more like you’d want your compiler to fail if you fed it with no source code.
On the other hand, if there's no page to be served, not even a default one, then it should 404. (Unless the default config is to list the (empty) directory, and it exists, in which case 200.)
There's no need to complicate things beyond that. One thing that I've learned over many years of experience with software is that if at all possible you should never add additional conditions or edge-cases, because they will tend to create more problems than they solve. The server is behaving most consistently if it treats the placeholder page the same as any other.
Would you want a compiler that specifically detects "hello world" programs and compiles them to always return failure, under the similar argument that it's not a "real" program? Because that's the logical conclusion of this sort of inane overthinking.