#ExplicitOverImplicit

Why @Annotations Will Eventually Burn You.

Preach annotation voodoo or embrace explicit method calls? Too many still cling to @PreAuthorize, entrusting their fate to framework black magic. But such blind faith is brittle. One innocent Spring Boot update, and suddenly your security vanishes unless you summon an obscure @Enable... incantation.

Prefer the custom preauthorize() method: it’s concrete, predictable, and the compiler screams when something breaks as it should. Just like how constructor injection finally defeated the field-injection cult, it’s time to retire annotation worship elsewhere too.

Consider @JsonProperty("fieldName"): sure, the object mapper might infer names correctly without it, until one day it doesn’t, because the naming strategy changes behind your back. It’s happened. It will happen again. That’s the price of depending on invisible magic. Unreadable, unpredictable, unmaintainable. Same applies to reflection.

Frameworks and their “best practices” are relics of the monolith age. Java has evolved: threads, HTTP services, logging,… all can now be built functionally, fluently, and natively. It’s not Java vs Kotlin or some trendy syntax candy. Languages, especially those that compile, already give you more than enough. The bottleneck isn’t the tool, it’s the one holding it.

#Java #SpringBoot #CleanCode #SoftwareEngineering #CodeQuality #Programming #ModernJava #DeveloperExperience #DevMindset #NoMoreMagic #ReadableCode #ExplicitOverImplicit #SayNoToAnnotations #SeparationOfConcerns #FunctionalProgramming

A medieval wizard casting spells over a confused developer — Caption: “@PreAuthorize… trust me, it just works.” In the background someone continues “until it doesn’t”
Jan :rust: :ferris:janriemer@floss.social
2023-08-03

#Rust's explicitness is more profound than you might think:

A #ProgrammingLanguage is a tool for #communication, so this actually tells us how communication (in software projects) should happen in general - which is: in an _explicit way_.

Implicit communication is the actual billion dollar mistake!

#SoftwareEngineering #ProjectManagement #RequirementEngineering
#RustLang
#ExplicitOverImplicit (funny - i've apparenly used that hashtag already in some other toot)

Jan :rust: :ferris:janriemer@floss.social
2022-11-29

@danielzenzes I never had a need for breaking out of nested loops.

On a related note: when you want to break out of a control flow, e.g. when traversing a tree structure with a visitor, you can also use

std::ops::ControlFlow

doc.rust-lang.org/std/ops/enum

It makes breaking out of control flow much more explicit.

And it can also be used with `?` operator in order to return early when it's value is ControlFlow::Break. :awesome:

#Rust #RustLang #ControlFlow #ExplicitOverImplicit

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst