1,789 karma · joined July 17, 2008
I have fallen into that trap myself. I have read about some exciting new tech in a blog and want to try it out in a POC. There may be some excitement around it and suddenly it becomes a MVP and placed into production. Eventually it evolves into "legacy code" that developers hate to touch. The right approach is sometimes to step back, and rewrite the POC in a language/framework that can be supported by others.
if (o instanceof String s) {
var foo = s.indexOf("bar");
}
Java 17 introduced a preview of the same feature for switch statements return switch (o) {
case Integer i -> String.format("int %d", i);
case Long l -> String.format("long %d", l);
case Double d -> String.format("double %f", d);
case String s -> String.format("String %s", s);
default -> o.toString();
};
Future versions will have improved support: http://openjdk.java.net/jeps/420) void foo(Duration duration);
var result = foo(Duration.ofHours(2));
You can also do simple calculations easily var bar = Duration.ofHours(2).plusMinutes(30);You can get the same problems with GraphQL or stored procedures too of course, if the queries are not optimized correctly
It's always a risk to make assumptions, but I don't think this specific assumption was unreasonable.
This could be solved by only exposing stored procedures, but that just moves the code to the database server instead of the REST service with the same problems as before.
I agree that there are many cases where managing the state in the frontend is the preferred solution. Multi-page forms add complexity for both frontend and backend. Sometimes frontend is less complex, and other times the backend is simpler.
I'll add some comments on your statements regarding backend. I'm not saying it is a better solution than managing it on the frontend for all cases. My point is that although it adds complexity on the backend, it does not necessarily mean that managing state on the frontend is simpler. That depends on the use case, but I think a lot of developers "default" to handling state on the frontend that adds much more complexity than a simple backend solution.
> "rerender previous form pages over and over again, except hidden"
In that case, you would only render hidden <input> fields with the values, and not the complete form. The code for receiving "step x" of the flow, would simply read the parameters from the request and include the values in the html code.
> "have some token to track partial form data"
Using <input> fields for this is much simpler. The final page would just read all variables as if they where posted from the same form, without requiring to generate/parse any tokens
> "build up a DB to store a partially complete form"
Most frameworks have a built in "session" that abstracts this away. It may be stored in a database, file, memory etc. If you require distributed sessions, the framework often handles this transparently by just configuring the session manager to use something like Redis to store the data.
Header levels would have been derived from the document structure.
<section>
<h>Hacker News/h>
<section>
<h>Guidelines</h>
</section>
<section>
<h>FAQ</h>
<section>
<h>...</h>
</section>
</section>
</section>There is a need for these services, but we also need to think about all those who are negatively impacted by this.
By placing the warehouse outside the residential area, they may increase the delivery time by 15-20 minutes. Isn't that a good enough compromise for the customers? Saving 20 minutes on grocery delivery is not worth the human cost.
Even for static content, the date may be wrong as the output may have been generated multiple times since it was first created.
Another advantage is his big network that he can ask for help. There's also a chance that his blog post will reach the right person in Azure and he'll get a reduced bill.
As someone who doesn't have the same network or the "fame", I am concerned about what would have happened to me in that situation.
1. Due to demands from marketing/sales, the supplier tends to increase versions for what is actually a minor feature, just to justify a new payment.
2. A subscription process is the most honest way of selling software. Jetbrains is a good example of this, where you get to keep your "fallback" version when you stop the subscription.
3. You often have to wait a long time for the next release, if you don't want to register in an "early access" program with versions that break constantly (basically providing free test resources).
4. You need to justify the new version to your boss, so that you can get it covered and start the approval process higher up in the hierarchy.
5. Approval processes in large Enterprises are often complex and time consuming. This not only applies to approving the payment, but often need to involve central IT. With a subscription model, this is only done once.
There is a limit to how large the deposit can be for stores without a machine. If you come with a big trash bag with bottles/cans, they have the right to refuse and refer you to a place with a machine (most grocery stores have machines)
The air near ice free water will feel much colder due to the increased humidity.