DEV Community

Discussion on: Where do you stand on "magic" within languages and frameworks?

Collapse
 
tbroyer profile image
Thomas Broyer • Edited

The way I use the term "magic" is whenever there's implicit behavior (generally based on naming rules, but sometimes on introspection/reflection, scanning, etc.) that generally cause "action at a distance"; it can probably be generalized as "too much abstractions, more than you can comprehend". "Convention over configuration" is different from "magic"… until there are too many such conventions.

As long as it works, "magic" feels great, boosts your productivity, etc. The moment it breaks, good luck finding why it broke and then how to make it work the way you want/expect. And of course, just like a framework, the moment you need to do differently and "escape the magic", you're likely going to hack around and start depending on internals/implementation details ; a bit like any kind of framework.

That's one reason I don't like frameworks: you built a blog in 10 minutes and 30 lines of code? great, but did you realize you're using a gazillion lines of code you didn't write? Yet you're liable for them once you push them to production. Write a bit more code you fully understand, to glue together fewer dependencies (easier to debug, easier to update, smaller, probably faster too), and always be explicit (don't write "magic" yourself).

Collapse
 
manuartero profile image
Manuel Artero Anguita 🟨

can't agree more actually

Collapse
 
mordechairoth profile image
mordechairoth

Well said.