Hacker News new | ask | show | jobs
by blargwill 696 days ago
If you don't want people to use the internals, why not make them `__private`?

Cool project!

1 comments

> 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.
I 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.
They want people to learn not to mess things up. You learn not to mess up by trying things out and messing up.
That'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.
I 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.

Games 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.
Oh, certainly. That's much more reasonable than what this project claims to be trying. :)
Yeah, you learn valuable lessons like “don’t mess with the code this guy makes, he puts traps on it”
They 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.
"I left this shotgun here, kids need to learn that shooting yourself in the foot really hurts."
This is parenting 101 for anything non-permanent. For a piece of software it's basically common sense.