Entity Framework in .NET also uses magical names. Just recently I was trying to set up things with foreign keys, and it took me way too long to find the documentation explaining how to name all your properties in the entity classes so it can relate the properties and objects. I still haven't figured out how you're supposed to use the annotations when your database design/access pattern doesn't fit into the world view EF has.
|
|
# ? Apr 29, 2024 06:02 |
|
|
# ? May 4, 2024 16:24 |
|
code:
For beginners, this is basically "uh I Guess I read and write by doing these weird arrows? Not sure why but ok?" And then you learn about manipulators you can use for clever programming tricks, but with No Idea what's even happening there. "Why does the magic word endl work, but also you're calling some kind of function called setw? I thought functions returned values, but I guess I can tell it to use a function or something?" And then you find out that cout and cin are the only places these <<s and >>s seem to work, except for maybe a couple other places where they mean Something Else? Straight up inscrutable, I have absolutely no idea why someone decided "let's give new developers this magical footgun so they learn JUST ENOUGH to do stupid tricks, but don't know what is actually happening." They're powerful tools but they shouldn't be beginner tools.
|
# ? Apr 29, 2024 06:43 |
|
Cmake is designed to find dependencies by "magic" through functions like find_package, which basically end up looking for a hand rolled script for each package or else searching in a few standard folders like /usr/lib etc Getting that poo poo to work on windows which has no standard folder structure anywhere for libs, includes, etc is a pain in the rear end, and because of all the "magic" involved specifying the folder locations explicitly ends up being more verbose and much less obvious than it would've been with a dumb non-magical build system like a plain makefile. And yes the documentation is really poo poo for this with a lot of super general detail on how the various functions work and no simple hello-world examples for "holy poo poo I just wanna link to a library it's RIGHT THERE please just show me three lines of code/config that will do this" it seems like a pretty good system as long as you (a) never touch windows and (b) never have to actually write the drat cmake files yourself
|
# ? Apr 29, 2024 06:50 |
|
nielsm posted:Entity Framework in .NET also uses magical names. Just recently I was trying to set up things with foreign keys, and it took me way too long to find the documentation explaining how to name all your properties in the entity classes so it can relate the properties and objects. I still haven't figured out how you're supposed to use the annotations when your database design/access pattern doesn't fit into the world view EF has. you can override a bunch of stuff in OnModelConfiguring if you need to. ef's model really just has to be close enough to work, but it really really wants to be in control of your schema
|
# ? Apr 29, 2024 07:28 |
|
RPATDO_LAMD posted:Cmake is designed to find dependencies by "magic" through functions like find_package, which basically end up looking for a hand rolled script for each package or else searching in a few standard folders like /usr/lib etc Cross platform support is the whole reason of being for cmake. I never touch the stuff on linux-only projects. A lot of cmake's weirdness and complexity is exactly because it has to support windows.
|
# ? Apr 29, 2024 07:47 |
|
RPATDO_LAMD posted:Cmake is designed to find dependencies by "magic" through functions like find_package, which basically end up looking for a hand rolled script for each package or else searching in a few standard folders like /usr/lib etc If you're compiling on Windows then you're probably using Visual Studio or VS Code, which both have CMake extensions that you're supposed to be using to tell cmake where your dependencies live. Then stuff like find_package just works, because you've given it a standard folder structure for things like libs, includes, etc. that us linux developers get to take for granted (although not always, which is why cmake also supports non-standard paths)
|
# ? Apr 29, 2024 08:15 |
|
darthbob88 posted:The thesis of the presentation at time of posting is mostly this koan, plus leaky abstractions and possibly this XKCD. "Magic abstractions are very useful, but they will trip you up if you don't know about them and a little about what they do under the hood". It's early and I will probably think of more interesting examples when I've had some coffee, but how about : string concatenation in languages like C# where strings are immutable? The language seems to promise that you can just go around using += to build your big string. But once you understand a little about what's happening under the hood, you know enough to realise when you actually shouldn't do that.
|
# ? Apr 29, 2024 08:53 |
|
darthbob88 posted:And most relevantly here, the fact that 0.1 + 0.2 != 0.3 is the sort of breaking abstraction I can use in my presentation. I don't think floating point is particularly magic. The cause-and-effect chain is perfectly clear, and most floating point problems are due to bad education. More generally, just because something is unintuitive or complicated, I don't believe it qualifies as magic. In programming, "magic" to me is when cause and effect is decoupled. The magic Spring method names are a good example. A similar (but more benign) example is the Unix design pattern of having directories full of shell scripts that are automatically run by some hidden agent at various times. One piece of magic that often bites me is when hidden files in the local directory have an effect on the commands I run, especially when those hidden files are silently created by the tool the first time it is run, and then freezes some bit of configuration or state that eventually becomes stale. I had some such problems with GHC environment files.
|
# ? Apr 29, 2024 08:58 |
|
Magic comments are literally lovely magic. Go has never found lovely idea it didn't like, so of course it is full of them.Go code:
Same for magic function names. Go code:
|
# ? Apr 29, 2024 10:03 |
|
Beef posted:Cross platform support is the whole reason of being for cmake. I never touch the stuff on linux-only projects. QuarkJets posted:If you're compiling on Windows then you're probably using Visual Studio or VS Code, which both have CMake extensions that you're supposed to be using to tell cmake where your dependencies live. Then stuff like find_package just works, because you've given it a standard folder structure for things like libs, includes, etc. that us linux developers get to take for granted (although not always, which is why cmake also supports non-standard paths) code:
code:
code:
You can argue "oh well one of those environments is doing it wrong and they should fix it". Well that's the problem, find_package is trying to apply standards where there are none. What find_package inputs and outputs varies wildly based on the environment, libraries, package managers, versions, etc. You might as well just have a separate command for each use-case. This is not entirely CMake's fault, because there's no such thing as "just drop in a dependency" in C/C++. But trying to paper over it with a magic command that keeps changing every version, just makes it more confusing when it doesn't work and you have to dig through CMakeLists to find out what's really happening.
|
# ? Apr 29, 2024 12:06 |
|
I have no idea how that is supposed to be an abstraction leakage. You want Boost.DateTime, you ask for DateTime subpart of Boost project.
|
# ? Apr 29, 2024 12:28 |
|
Want to talk about CMake abstractions leaking? Try doing anything with nested lists.
|
# ? Apr 29, 2024 12:29 |
|
Since Java is so verbose and tedious compared to newer languages it seems to have created a culture of relying on a lot of magic stuff to avoid as much hiring boiler plate as possible. To me coming from frontend and C# starting to contribute to our Spring based backend felt like a lot of magic incantations. There is a similar problem with C#, certainly when it comes to EF and asp.net, but it doesn’t feel like it’s being taken as far as Lombok for example.
|
# ? Apr 29, 2024 12:42 |
|
Yeah lol like find_project is complicated but it’s not magic. It does what it says on the tin: find stuff. That’s a complicated task so it has complicated behavior.
|
# ? Apr 29, 2024 12:47 |
|
A good example imo is coroutine transformations in languages like python and javascript where you add a magic tag and the function's behavior completely changes. Async is ok-ish because there's a signature-level tag. In python, Python code:
JavaScript code:
The awful brother in python of course is the generator coroutine. Python code:
Type annotations don't even necessarily save you, because "a function that is a generator" and "a function that builds a generator from elsewhere and returns it" are typed identically: Python code:
fake e: it's not that it's leaking an abstraction; it's that the abstraction is presented non-obviously, especially in the case of generators since there's no signature-level tag. I think if the psf was approving a generator pep now, they would have had a top level tag; the async def tag was the first new token added to python in like a decade or something, they pushed back hard against it before (and the original async coroutine implementation was done with annotations that wrapped generators haha) Phobeste fucked around with this message at 13:15 on Apr 29, 2024 |
# ? Apr 29, 2024 13:12 |
|
Xarn posted:I have no idea how that is supposed to be an abstraction leakage. You want Boost.DateTime, you ask for DateTime subpart of Boost project. It's unreliable. If you look at most CMakeLists, they will either have platform-specific dependencies, or stick to simpler (to understand) abstractions like find_library or manually specifying paths.
|
# ? Apr 29, 2024 14:23 |
|
The javascript one is not quite accurate: any sync code is executed immediately when an async method is called, regardless of await. It does go off into the event loop until something actually async occurs.JavaScript code:
quote:async hello 200 This tends to surprise people, but that's exactly what happens in the Promise style: JavaScript code:
|
# ? Apr 29, 2024 14:27 |
|
zokie posted:Since Java is so verbose and tedious compared to newer languages it seems to have created a culture of relying on a lot of magic stuff to avoid as much hiring boiler plate as possible. To me coming from frontend and C# starting to contribute to our Spring based backend felt like a lot of magic incantations. You're absolutely correct that it's a pain in the rear end, and you have to work around it. I was going to suggest Google Guice, but I don't know how widely that's actually used. Dagger is a nice DI framework for Java / Kotlin that performs compile-time injection, which may well be much nicer depending on whether you actually need to be able to add/remove modules at runtime
|
# ? Apr 29, 2024 14:56 |
|
Xarn posted:Magic comments are literally lovely magic. Go has never found lovely idea it didn't like, so of course it is full of them. My favorite golang lovely idea is the magic date you use for date formatting. They could have used an unambiguous date like December 31st, but because it was created by techbros who can't see past their own nose you have to remember whether it's January 2nd or February 1st.
|
# ? Apr 29, 2024 15:11 |
|
What about COM. Anyone remember COM? Or DCOM, or COM+. It was supposed to be this magical technology where you could register a COM object and then any program would use it. And when you update with a new version it would automatically work. And you could move those COM objects to a remote server and your program would just magically keep working the same. And any update on the server would be automatically be picked up by the local program. Except that poo poo didn't work. It was a pain in the rear end. You'd update version and the program keeps picking up the wrong one. And you'd pull your hair out trying to find the right incantation to make it work. Any type of remote COM had to be carefully designed to be called remote. So that's a leaky abstraction. poo poo was worse than what we had, which was just shared libraries resolve by PATH. Which is what we have now, which shows you how lovely com was. Of course I haven't worked with COM in like 20 years So I may not remember the specifics, but I do remember COM sucking poo poo, and having to pierce the vale of magic was often needed to get poo poo to work correctly.
|
# ? Apr 29, 2024 15:16 |
|
Jen heir rick posted:What about COM. Anyone remember COM? Or DCOM, or COM+. It was supposed to be this magical technology where you could register a COM object and then any program would use it. And when you update with a new version it would automatically work. And you could move those COM objects to a remote server and your program would just magically keep working the same. And any update on the server would be automatically be picked up by the local program. My favorite part of COM was working with BSTR. It's a special string type that was used for com interfaces, as many different programming languages could interop with COM so you couldn't use, say, a std::string. This doesn't sound so bad, but in the early days of windows, ms did performance profiling and found out that string allocations involving BSTR were slow - so MS built a BSTR cache into Windows - e.g. https://devblogs.microsoft.com/oldnewthing/20150107-00/?p=43203. One of the issues with this cache is that it covers up issues involving string allocation across COM boundaries. For instance, say you have the audacity to return a bstr_t (which is a smart pointer to a bstr) from a COM interface. What will happen is that your program will work fine for about ten minutes, and then randomly crash with a heap corruption issue - this is because the BSTR cache will cover up that the bstr_t deallocated the string when it went out of scope, but once the BSTR is evicted from the cache you are hosed. In order to catch an issue like this, you can set OANOCACHE=1 - this turns off the BSTR cache in the oleaut32.dll, so your program will crash immediately if you return a bstr_t instead of after ten minutes. This is also why you need to set OANOCACHE=1 when using mallocspy, as otherwise it may report bstr leaks erroneously.
|
# ? Apr 29, 2024 15:33 |
|
Xarn posted:Want to talk about CMake abstractions leaking? Try doing anything with nested lists. This is a great example. Lists in cmake are actually just space delimited strings. Good luck if you want to use strings that already have spaces in them, lol.
|
# ? Apr 29, 2024 17:55 |
|
Ralith posted:This is a great example. Lists in cmake are actually just space delimited strings. Good luck if you want to use strings that already have spaces in them, lol. (Insert everything involving shell programming here)
|
# ? Apr 29, 2024 18:02 |
|
Athas posted:I don't think floating point is particularly magic. The cause-and-effect chain is perfectly clear, and most floating point problems are due to bad education. More generally, just because something is unintuitive or complicated, I don't believe it qualifies as magic. quote:In programming, "magic" to me is when cause and effect is decoupled. The magic Spring method names are a good example. A similar (but more benign) example is the Unix design pattern of having directories full of shell scripts that are automatically run by some hidden agent at various times. Unfortunately, as much as I would like to just reduce the various development tools discussed in this thread to "magic black boxes", I need to understand, at least a little bit, how they work in order to do my job. I need to be aware that Go cares about my comments, that Spring cares about my method names, or that the build tool my project uses also reads a config file to determine what dependencies are available to each component.
|
# ? Apr 29, 2024 19:50 |
|
Copying richly formatted text from one application to another is magical, and often works, but sometimes your blog post will appear in a new font, and for a non-technical audience it’s hard to understand why it went wrong.
|
# ? Apr 29, 2024 20:13 |
|
Default parameters in Python might qualify? It's more "surprising" than "magical," but it trips people up.
|
# ? Apr 29, 2024 20:50 |
|
Ralith posted:This is a great example. Lists in cmake are actually just space delimited strings. Good luck if you want to use strings that already have spaces in them, lol. Dehumanize yourself and face the [==[[=[]=]]==]s
|
# ? Apr 29, 2024 22:35 |
|
Xarn posted:Dehumanize yourself and face the [==[[=[]=]]==]s These loss edits have gotten very abstract
|
# ? Apr 29, 2024 22:45 |
|
Is Perl cheating? Because I just unblocked the memories of the ten+ years of experience I have with Perl. There’s an implicit variable $_ , and some subroutines that return a value will implicitly set the $_ variable, if you decline to specify anything else to catch the return. Then there are some subroutines that take in a parameter, and if you omit it, they will implicitly take in $_ . It’s all a lot of magic to let you write code that appears to not work even when it does.
|
# ? Apr 29, 2024 23:44 |
|
Perl is a devious creation by man, the pinnacle of our ingenuity and hubris, to create technical debt at a rate heretofore unseen and never to be outmatched.
|
# ? Apr 30, 2024 00:18 |
|
Is Perl one of the languages with a runtime configurable array base index?
|
# ? Apr 30, 2024 00:19 |
|
necrotic posted:Is Perl one of the languages with a runtime configurable array base index? Not anymore, apparently. Although there does appear to be a module for that.
|
# ? Apr 30, 2024 00:27 |
|
necrotic posted:Is Perl one of the languages with a runtime configurable array base index? Good news! There's a module in CPAN for that!
|
# ? Apr 30, 2024 00:28 |
|
Clanpot Shake posted:Default parameters in Python might qualify? It's more "surprising" than "magical," but it trips people up. Maybe, yeah. I don't know anyone who uses Python who understood the mutable default argument problem the first time that they encountered it, the behavior is not intuitive.
|
# ? Apr 30, 2024 02:21 |
|
necrotic posted:a runtime configurable array base index? What an incredibly cursed concept
|
# ? Apr 30, 2024 02:35 |
|
One of my favorite manpage quotes is from perl:man Switch posted:If your source file is longer then 1 million characters and you have a switch statement that crosses the 1 million (or 2 million, etc.) character boundary you will get mysterious errors. The workaround is to use smaller source files.
|
# ? Apr 30, 2024 03:23 |
|
Oh it's characters and not lines. I have some (autogenerated) source files like that.
|
# ? Apr 30, 2024 06:46 |
|
|
# ? May 4, 2024 16:24 |
|
A million characters is probably pushing it on account of average line length of source being pretty low (whitespace lines, brackets, etc), but I've definitely worked in (non-generated) files that were 50k+ lines, so I could see that biting you. It's funny that it's exactly 1,000,000 and not 2^20 though.
|
# ? Apr 30, 2024 15:30 |