Top
Best
New

Posted by edent 3 days ago

I Don't Like Magic(adactio.com)
81 points | 58 comments
vladms 1 hour ago|
The advantage of frameworks is to have a "common language" to achieve some goals together with a team. A good framework hides some of the stupid mistakes you would do when you would try to develop that "language" from scratch.

When you do a project from scratch, if you work enough on it, you end up wishing you would have started differently and you refactor pieces of it. While using a framework I sometimes have moments where I suddenly get the underlying reasons and advantages of doing things in a certain way, but that comes once you become more of a power user, than at start, and only if you put the effort to question. And other times the framework is just bad and you have to switch...

sodapopcan 1 hour ago|
The problem with this is that it means you have to read guides which it seems no one wants to do. It drives me nuts.

But ya, I hate when people say they don't like "magic." It's not magic, it's programming.

coldtea 1 hour ago|||
Most however are surely capable of understanding a simple metaphor, in which "magic" in the context of coding means "behavior occuring implicitly/as a black box".

Yes, it's not magic as in Merlin or Penn and Teller. But it is magic in the aforementioned sense, which is also what people complain about.

monkpit 14 minutes ago||||
Magic refers to specific techniques used in programming, an people generally dislike these techniques once they have formed any opinion.
WJW 1 hour ago|||
Oh no! Reading!

Sorry for the snark but why is this such a problem?

fragmede 10 minutes ago||
Because people won't do it.
socalgal2 1 hour ago||
You could walk through the framework so you then understand it. There are several "let's create react from scratch" articles

https://pomb.us/build-your-own-react/

Certain frameworks were so useful they arguably caused an explosion the productivity. Rails seems like one. React might be too.

xp84 5 minutes ago||
Thanks for this! I've mostly avoided getting too into React and its ilk, mainly because I hate how bloated the actual code generated by that kind of application tends to be. But also I am enjoying going through this. If I can complete it, I think I will be more informed about how React really works.
yellowapple 44 minutes ago||
Thanks to that page letting me see how many dozens of lines of code React needs to do the equivalent of

    const element = document.createElement("h1");
    element.innerHTML = "Hello";
    element.setAttribute("title", "foo");
    const container = document.getElementById("root");
    container.appendChild(element);
I now have even less interest in ever touching a React codebase, and will henceforth consider the usage of React a code smell at best.
Mogzol 4 minutes ago|||
The "magic" of React though is in its name, it's reactive. If all you're doing is creating static elements that don't need to react to changes in state then yeah, React is overkill. But when you have complex state and need all your elements to update as that state changes, then the benefits of React (or similar frameworks) become more apparent. Of course it's all still possible in vanilla JS, but it starts to become a mess of event handlers and DOM updates and the React equivalent starts to look a lot more appealing.
htnthrow11220 34 minutes ago||||
To be fair, if all you need is to add elements to a child you don’t need React.

Maybe nobody needs React, I’m not a fan. But a trivial stateless injection of DOM content is no argument at all.

madeofpalk 34 minutes ago||||
All of that is the JavaScript equivalent of

    <h1 title=foo>Hello</h1>
I have even less interest in touching any of your codebases!
fragmede 10 minutes ago|||
Given the verbosity of Java's hello world vs Python's, you'd walk away with the conclusion that Java should never be used for anything, but that would be a mistake.
ZeWaka 5 minutes ago||
Clearly Java only belongs on things like credit cards and Minecraft /s
SirMaster 47 minutes ago||
So you don’t like compilers? Or do you really full understand how they are working? How they are transforming your logic and your asynchronous code into machine code etc.
mgaunard 45 minutes ago||
I think most traditional software engineers do indeed understand what transformations compilers do.
advael 25 minutes ago|||
Yea, the pervasiveness of this analogy is annoying because it's wrong (because a compiler is deterministic and tends to be a single point of trust, rather than trusting a crowdsourced package manager or a fuzzy machine learning model trained on a dubiously-curated sampling of what is often the entire internet), but it's hilarious because it's a bunch of programmers telling on themselves. You can know, at least at a high level of abstraction, what a compiler is doing with some basic googling, and a deeper understanding is a fairly common requirement in computer science education at the undergrad level

Don't get me wrong, I don't think you need or should need a degree to program, but if your standard of what abstractions you should trust is "all of them, it's perfectly fine to use a bunch of random stuff from anywhere that you haven't the first clue how it works or who made it" then I don't trust you to build stuff for me

fragmede 13 minutes ago||||
Not in any great detail. Gold vs ld isn't something I bet most programmers know rigorously, and thats fine! Compilers aren't deterministic, but we don't care because they're deterministic enough. Debian started a reproducible computing project in 2013 and, thirteen years later, we can maybe have that happen if you set everything up juuuuuust right.
UncleMeat 28 minutes ago||||
I'd wager a lot of money that the huge majority of software engineers are not aware of almost any transformations that an optimizing compiler does. Especially after decades of growth in languages where most of the optimization is done in JIT rather than a traditional compilation process.

The big thing here is that the transformations maintain the clearly and rigorously defined semantics such that even if an engineer can't say precisely what code is being emitted, they can say with total confidence what the output of that code will be.

fragmede 7 minutes ago||
They can't! They can fairly safely assume that the binary corresponds correctly to the C++ they've written, but they can't actually claim anything about about the output other than "it compiles".
mberning 19 minutes ago|||
They also realize that adding two integers in a higher level language could look quite different when compiled depending on the target hardware, but they still understand what is happening. Contrast that with your average llm user asking it to write a parser or http client from scratch. They have no idea how either of those things work nor do they have any chance at all of constructing one on their own.
sigbottle 37 minutes ago|||
[Autovectorization is not a programming model](https://pharr.org/matt/blog/2018/04/18/ispc-origins).

Sure, obviously, we will not undersatnd every single little thing down to the tiniest atoms of our universe. There are philosophical assumptions underlying everything and you can question them (quite validly!) if you so please.

However, there are plenty of intermediate mental models (or explicit contracts, like assembly, elf, etc.) to open up, both in "engineeering" land and "theory" land, if you so choose.

Part of good engineering as well is deciding exactly when the boundary of "don't cares" and "cares" are, and how you allow people to easily navigate the abstraction hierarchy.

That is my impression of what people mean when they don't like "magic".

eleventyseven 45 minutes ago||
At least compilers are deterministic
ZeWaka 4 minutes ago||
mostly
noelwelsh 1 hour ago||
If you have this attitude I hope you write everything in assembly. Except assembly is compiled into micro-ops, so hopefully you avoid that by using an 8080 (according to a quick search, the last Intel CPU to not have micro-ops.)

In other words, why is one particular abstraction (e.g. Javscript, or the web browser) ok, but another abstraction (e.g. React) not? This attitude doesn't make sense to me.

kens 1 hour ago||
Did someone ask about Intel processor history? :-) The Intel 8080 (1974) didn't use microcode, but there were many later processors that didn't use microcode either. For instance, the 8085 (1976). Intel's microcontrollers, such as the 8051 (1980), didn't use microcode either. The RISC i860 (1989) didn't use microcode (I assume). The completely unrelated i960 (1988) didn't use microcode in the base version, but the floating-point version used microcode for the math, and the bonkers MX version used microcode to implement objects, capabilities, and garbage collection. The RISC StrongARM (1997) presumably didn't use microcode.

As far as x86, the 8086 (1978) through the Pentium (1993) used microcode. The Pentium Pro (1995) introduced an out-of-order, speculative architecture with micro-ops instead of microcode. Micro-ops are kind of like microcode, but different. With microcode, the CPU executes an instruction by sequentially running a microcode routine, made up of strange micro-instructions. With micro-ops, an instruction is broken up into "RISC-like" micro-ops, which are tossed into the out-of-order engine, which runs the micro-ops in whatever order it wants, sorting things out at the end so you get the right answer. Thus, micro-ops provide a whole new layer of abstraction, since you don't know what the processor is doing.

My personal view is that if you're running C code on a non-superscalar processor, the abstractions are fairly transparent; the CPU is doing what you tell it to. But once you get to C++ or a processor with speculative execution, one loses sight of what's really going on under the abstractions.

sevensor 23 minutes ago|||
A good abstraction relieves you of concern for the particulars it abstracts away. A bad abstraction hides the particulars until the worst possible moment, at which point everything spills out in a messy heap and you have to confront all the details. Bad abstractions existed long before React and long before LLMs.
kalterdev 1 hour ago|||
You can learn JavaScript and code for life. You can’t learn React and code for life.

Yeah, JavaScript is an illusion (to be exact, a concept). But it’s the one that we accept as fundamental. People need fundamentals to rely upon.

satvikpendem 50 minutes ago||
> You can’t learn React and code for life.

Sure you can, why can't you? Even if it's deprecated in 20 years, you can still run it and use it, fork it even to expand upon it, because it's still JS at the end of the day, which based on your earlier statement you can code for life with.

pessimizer 1 hour ago||
Are you seriously saying that you can't understand the concept of different abstractions having different levels of usefulness? That's the law of averages taken to cosmic proportions.

If this is true, why have more than one abstraction?

selridge 1 hour ago||
I just think everyone who says they don't like magic should be forced to give an extemporaneous explanation of paging.
tokenless 1 hour ago||
The AI pilled view is coding is knitting and AI is an automated loom.

But it is not quite the case. The hand coded solution may be quicker than AI at reaching the business goal.

If there is an elegant crafted solution that stays in prod 10 years and just works it is better than an initially quicker AI coded solution that needs more maintenance and demands a team to maintain it.

If AI (and especially bad operators of AI) codes you a city tower when you need a shed, the tower works and looks great but now you have 500k/y in maintaining it.

james_marks 1 hour ago|
Doesn’t the loom metaphor still hold? A badly operated loom will create bad fabric the same way badly used AI will make unsafe, unscalable programs.

Anything that can be automated can be automated poorly, but we accept that trained operators can use looms effectively.

tokenless 35 minutes ago|||
The difference is the loom is performing linear work.

Programming is famously non-linear. Small teams making billion dollar companies due to tech choices that avoid needing to scale up people.

Yes you need marketing, strategy, investment, sales etc. But on the engineering side, good choices mean big savings and scalability with few people.

The loom doesn't have these choises. There is no make a billion tshirts a day for a well configured loom.

Now AI might end up either side of this. It may be too sloppy to compete with very smart engineers, or it may become so good that like chess no one can beat it. At that point let it do everything and run the company.

sixtyj 1 hour ago|||
Loom is a good metaphor.
thestackfox 27 minutes ago||
I get the sentiment, but "I don’t like magic" feels like a luxury belief.

Electricity is magic. TCP is magic. Browsers are hall-of-mirrors magic. You’ll never understand 1% of what Chromium does, and yet we all ship code on top of it every day without reading the source.

Drawing the line at React or LLMs feels arbitrary. The world keeps moving up the abstraction ladder because that’s how progress works; we stand on layers we don’t fully understand so we can build the next ones. And yes LLM outputs are probabilistic, but that's how random CSS rendering bugs felt to me before React took care of them

The cost isn’t magic; the cost is using magic you don’t document or operationalize.

Klonoar 20 minutes ago||
I feel like a lot of the comments here are from people who either weren't around for, or didn't grow up in, the era where adactio and the wider web dev scene (Zeldman, etc) were the driving force of things on the web.

If you've only been in a world with React & co, you will probably have a more difficult time understanding the point they're contrasting against.

(I'm not even saying that they're right)

insin 11 minutes ago|
I was around for that era (I may have made an involuntary noise when Zeldman once posted something nice about a thing I made), but being averse to "abstraction in general" is a completely alien concept to me as a software developer.
sigbottle 39 minutes ago||
> And so now we have these “magic words” in our codebases. Spells, essentially. Spells that work sometimes. Spells that we cast with no practical way to measure their effectiveness. They are prayers as much as they are instructions.

Autovectorization is not a programming model. This still rings true day after day.

wa008 1 hour ago|
What I cannot build. I do not understand
AlotOfReading 53 minutes ago|
I'm not sure this is a useful way to approach "magic". I don't think I can build a production compiler or linker. It's fair to say that I don't fully understand them either. Yet, I don't need a "full" understanding to do useful things with them and contribute back upstream.

LLMs are vastly more complicated and unlike compilers we didn't get a long, slow ramp-up in complexity, but it seems possible we'll eventually develop better intuition and rules of thumb to separate appropriate usage from inappropriate.

More comments...