2 ms·
I inherited an old java project where all routes were defined in web.xml. One of the biggest productivity drains was to keep having to look back and forth betwe
by lf-non 4y ago
I inherited an old java project where all routes were defined in web.xml. One of the biggest productivity drains was to keep having to look back and forth between the route configuration and the servlet implementation. Over time the route mapping xml had grown to a humongous size. Coming from ruby this kind of indirection was very hard me for quite some time.
When we switched to spring annotation driven configuration it was a breath of fresh air. The mapping of http verbs, params etc. were all colocated with the services and there was no need to keep jumping across files.
Very few people may use sinatra now, but its spirit will live on among countless frameworks that have embraced its minimalism to whatever extent their host platform allow.
- lbhdc 4y agoThat is a very fair reason for structuring it that way. I agree that there is, to some extent, more overhead for the developer who normally works on and maintains the code base. However, I feel like it is easier as a reader to understand what a service does and how to integrate with it having all of the paths in a centralized location. How do you normally think about making that information discoverable in your webapps?
- lf-non 4y agoNow a days I mostly always use either graphql/openapi depending on the history of the project and the preferences of the team. So there typically is a spec for the API. I usually prefer a code-first approach and the open source tooling is able to extract the spec for me from annotations - which becomes a centralized location for exploration or generating clients.