4 ms·
If you don't want people to use the internals, why not make them `__private`? Cool project!
by blargwill 2y ago
If you don't want people to use the internals, why not make them `__private`?
Cool project!
- FergusArgyll 2y ago> There is little protections against messing up with the internal. This is on purpose, I want the kids to learn to use the API not mess up with the internals of every single class.
- setr 2y agoI don’t understand the reasoning; you’d add protections if you wanted them to learn to use the APIs. You’d remove them if you wanted them to mess with the internals of each class.
- ncphillips 2y agoThey want people to learn not to mess things up. You learn not to mess up by trying things out and messing up.
- andrewflnr 2y agoThat's a bad strategy. The reason people are tempted to mess with internals is that it works most of the time. Unless the library has some way of punishing people who use them, then they'll just do it without regard for, as far as they're concerned, arbitrary toothless restrictions. Sure, some stuff will break, but that's true even if they're respecting the API boundary too, especially for a beginner. There will be zero learning about API boundaries in particular.
- maxbond 2y agoI think it's fine to encourage beginners to engage with the internals of an API and do things that are unwise. The goal is educated pupils, not successful or maintainable projects. Let them play in the mud and get dirty. I think the idea that code is something that can be experimented with is one of the most valuable lessons, and breaking things is frequently the path to learning how they work. Maintainability is one of the finer points that can come later.
- andrewflnr 2y agoOh, certainly. That's much more reasonable than what this project claims to be trying. :)
- fbdab103 2y agoGames are notorious for vendoring a dependency and never upgrading it again. If you use an internal API, it is not like you are forced to be on the upgrade treadmill where the sands suddenly shifted and the secret API does something different.
- otikik 2y agoYeah, you learn valuable lessons like “don’t mess with the code this guy makes, he puts traps on it”
- Nab443 2y agoThey mean that their code is written with strong assumption everything is written the way it is. If you make modifications to the internal or push an unexpexted type in it, they expected it to fail. There's no guardrail that everything is in a right state.. well, standard internal code.
- jon-wood 2y ago"I left this shotgun here, kids need to learn that shooting yourself in the foot really hurts."
- lofenfew 2y agoThis is parenting 101 for anything non-permanent. For a piece of software it's basically common sense.