Question

I have always advocated the use of standardized api, and currently use it on my code. However i always get very strong resistance when it comes to code review, even on projects i have designed and built from scratch which there is no existing code that i will conflict with.

I use standardized API to insure that i am in complete control of the architecture.

One example is the use of JSR-330 inject, i use @inject, @named, etc... Instead of spring specific @autowire and @qualifier, this is to insure that my business code remain as immutable as possible.

They could not seem to pick up when i explain, their arguments are usually:

  • Spring is a lot more modern, or that's 2009 according to my Google search.

  • If they get cornered, it becomes: Well just use code we already use, so we can understand it quickly.

I'm not discounting that i may be wrong, so i am interested in hearing other people's opinions.

No correct solution

OTHER TIPS

The most important thing in any project is consistency. If your entire project is build around JSR-330, is consistently using it, and it is not introducing unnecessary work to program using it (having to remember to use Inject instead of Autowired does not count as unnecessary work), as compared to e.g. direct Spring annotations, then one should stick to JSR-330 annotations. And forcing to mix them up just because I'm used to other type is a very weak argument.

Unless there's a collective effort (which is agreed upon) to globally change JSR-330 annotations to those of e.g. Spring, the JSR-330 should stay. But this applies vice versa: if a project is using Spring's annotations, it should keep using those.

Components such as CDI are components which are extremely unlikely to change over time. E.g. if your project is running on Spring, the chance you would migrate to a completely different framework (pretty much the only situation where you would benefit from using JST-330 instead of Spring's CDI annotations) is close to 0. And even if such migration to a completely different project happened, having to change the used CDI annotations would be the least of your troubles.

Additionally, if you're a sole developer building a project from scratch, it's your decision which approach you choose. And if a certain developer joins the projects after a substantial development period, the developer should acknowledge your decision and use the approach you've chosen.

On the other hand, if you're building a project from scratch and you're not the only developer working on it, the project is a team effort. The approach should be discussed among all participants and based on that the approach the most comfortable to the majority of developers should be chosen (unless a certain individual can present an extremely strong argument in order to use a different approach - and this usually does not happen).

Licensed under: CC-BY-SA with attribution
scroll top