Hacker News new | ask | show | jobs
by Too 1688 days ago
Local variables inside a function are very much encapsulated.

Unless you need to keep state between two distinct actions on the same object, but in that case a single run() entry point will not be sufficient anyway.

Inheritance can be replaced by just calling a common function.

There are many “what if” here, which will likely never happen and until they do it’s premature abstraction. Most likely some other abstraction is needed by the time script grows.