Hacker News new | ask | show | jobs
by exogen 3541 days ago
The archetype terminology comes from the use of Builder; you can get a rundown of what an archetype really is here, independently of its usage in Electrode: https://formidable.com/open-source/builder/

Framework and app generator are really quite far off from what an archetype provides. An archetype is like an npm module template, but not one that is used to generate code files and then discarded, but more like a live "superclass" of a module; think inheritance but for npm modules.

The basic idea is that if you have dozens or hundreds of similar modules (for, say, React components), with similar build + testing needs, you can use the same archetype for all of them. A generator like yeoman could spit out boilerplate for you, but then what if your boilerplate changes? Your packages quickly get out of sync with your latest best practices. Having some components on Babel 5 and some upgraded to Babel 6, for example, was a real pain. You have to go through your dozens of packages and bring them up to date. Archetypes on the other hand are intended to be encapsulated boilerplate that packages basically "inherit" from at runtime.

Hope that helps!

1 comments

That was really well crafted, thank you. Much easier to digest than some of the docs. Though, I'm still not convinced it warrants a new way of describing a collection of patterns for various concerns, e.g. a framework.
Thanks for the feedback about the documentation. We will work on improving it, especially around archetype.

Exogen, hope we can use what you wrote :D