If the answer of any of these questions is NO, then we think we could have a big problem sooner or later. If something goes wrong in production, do we have enough clarity and visibility over what this code is doing when is running in production?.Assuming a new joiner doesn’t know what these annotations do, how likely is that they will be able to understand our code quickly?.Do we fully understand all the possible implications in terms of performance, usage of resources or maintainability when we use them?.Do we really understand what Spring is doing under the covers when we use any of these annotations?.The ability to be able to use an annotation and then “magically” get everything we need working is quite tempting and satisfactory, mainly due to the time we save and the feeling of achievement we get almost immediately.Įverything sounds great so far, although we’ll have to remind you that “all that glitters is not gold”!ĭespite of all the benefits we mentioned earlier, a few questions could come to our minds: One more benefit is that it’s easier, specially in large organisations, to achieve some consistency across teams when using frameworks. This simplifies things for some developers that don’t fully understand how to implement these patterns. What do we mean by that? For example, Spring integrates Resiliency4j library into one of its modules to allow developers to configure resiliency patterns by just using annotations. For instance, we could have our persistence layer working in minutes using Spring Data, just an interface and a few annotations and we have our persistence layer ready for testing.Īpart from saving us a very precious time, Spring abstracts (specially for less experienced developers) some of the common issues we normally have to deal with when building software. This means that it’s been throughly tested in production, what gives us a big level of confidence when adopting them into our applications.Īnother big advantage is that we can save plenty of time by configuring everything in our application using annotations. Even the adoption of hugely popular frameworks like Spring! What’s Good About Themįrameworks in general have the benefit that they’ve been widely adopted and utilised in production by thousands of companies nowadays. The question is, do they only bring benefits to our codebase? The big majority of the community thinks that there are no drawbacks most of the times today we are going to try to explain to you that every decision brings advantages and disadvantages. The use of this kind of frameworks brings huge benefits for us, as we save plenty of time when we are creating a new project especially. In the last decade, the use of frameworks like Spring has been widely spread across the software developers community. We will try to explain all the complexities that are inherent to the use of framework annotations, but at the same time trying to keep an objective perspective to avoid influencing your decisions.įrameworks are very useful many times, but as always, everything in excess could be harmful. There are a wide variety of reasons to use frameworks with all of their annotations, although there are also a considerable amount of problems that frameworks could bring to us. What I would like is something like the javadoc tag for annotations, e.g.In this article we will talk about the problems that arise when we overuse annotations in our applications, something we call “annotation-driven development” or also “framework-driven development”. Like that the reason is very close to the annotation itself (less chance to get lost in a refactoring),īut doesn't appear in the generated javadocs. This way the reason appears in the generated javadoc, but not together with the annotation itself. There are two ways that come to my mind, but both are not ideal. When a piece of documented code is decorated with an annotation, thisĪnnotation usually shows up in the generated javadocs (for annotations).īut what if I'd like to add some reasoning to the javadoc? (why is the annotation needed (Note: this is not the same question as to where to put the annotation or how to document the annotation itself)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |