Hyperapp: Subs or Substitutions?

Created on 7 Feb 2017  路  9Comments  路  Source: jorgebucaran/hyperapp

I really like the API, a complete copy of ElmArchitecture in JavaScript. My only peeve is subs. I think it would be better to use the term subscriptions like Elm and Choo. I remember the first time I looked at the counter example and saw the sub function in the update method. I immediately assumed it was a singular instance of subs, whatever they were. Then when I saw the subs in actions I was thinking, hmmm... substitutions?, subtractions? subordinations? subscripts? or maybe he wants to give us all foot long subs!!! Yay! I'll have two please. OK, I know you used subs to save a few letters typing, but going forward if you want this project to gain traction it would be better to use the more explicit term subscriptions to save people the mental work of constantly translating subs to subscriptions in our heads. Even in your README you describe subs as: Subscriptions are functions that run once when the DOM is ready. Use a subscription to register global events, like mouse or keyboard listeners. I'm suspecting you probably just lobbed off the tail end of pubsub for the term. My point is explicit terms are always better than implicit terms in API design. It's not like people would have to type the term a thousand times. It's just once. Then when you scan the page and see subscriptions it would be immediately clear what you are looking at, even if you were not familiar with this API.

Discussion

Most helpful comment

It's not like people would have to type the term a thousand times. It's just once. T

Good point.

What do you folks think? @danigb @itrelease @maraisr @tzellman @evgenykochetkov @terkelg

I'm 馃挴 with the idea.

All 9 comments

It's not like people would have to type the term a thousand times. It's just once. T

Good point.

What do you folks think? @danigb @itrelease @maraisr @tzellman @evgenykochetkov @terkelg

I'm 馃挴 with the idea.

I think it's a good idea considering that it's inspired by Elm.App it would be nice to go along with same naming for api

I was thinking the same thing. subscriptions is better if you want shorter name subscribes is better than subs too.

I like subs for brevity, but I agree that subscriptions may be more obvious. You could always settle with var subs = options.subscriptions || options.subs || {}.

I agree, good idea!

subs is an array, so its description should be a noun, not a verb. subscribes would indicate a function.

@rbiggs Changed to subscriptions. Code still handles and will handle .subs for a while, at least after >=0.0.13, examples have been updated and due mourn time has been given.

@rbiggs Can this be closed?

@jbucaran Is there anything else to do before releasing 0.0.13? I'd like to have the subscriptions fix available for usage. 馃檪
In addition to that 0.0.12 changed the import to hyperapp/hx and the longer we wait to undo this the more people will use that change just to undo it in 0.0.13.

Shipped. See the release notes.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dmitrykurmanov picture dmitrykurmanov  路  3Comments

jamen picture jamen  路  4Comments

joshuahiggins picture joshuahiggins  路  4Comments

jorgebucaran picture jorgebucaran  路  3Comments

jacobtipp picture jacobtipp  路  3Comments