Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prop: naming inconsistencies #24

Closed
slimsag opened this issue Feb 13, 2016 · 11 comments
Closed

prop: naming inconsistencies #24

slimsag opened this issue Feb 13, 2016 · 11 comments
Assignees

Comments

@slimsag
Copy link
Member

slimsag commented Feb 13, 2016

Creating this as an issue and not a PR because I'm not sure we should do anything about it..

We might consider renaming these to match the elem and style naming schemes (of not using short-hand versions or acronyms):

  1. prop.Href -> prop.HypertextReference
  2. prop.Id -> prop.Identity
  3. prop.Src -> prop.Source

The first two are by far much less digestible to me as an end-user.

@dmitshur
Copy link
Contributor

How does the recent Element -> Elem and Property -> Prop change tie in here?

I might be missing contedxt, but Href, Id are much more readable to me (being familiar with HTML lingo) than HypertextReference and Identity... Unless they're supposed to represent something else?

@slimsag
Copy link
Member Author

slimsag commented Feb 13, 2016

For example, we rename the <h1> tag to become elem.Header1 here: https://github.com/gopherjs/vecty/blob/master/elem/generate.go#L34

I agree that Href and Id are more readable.. and that makes me uncertain of the naming scheme/remapping used by the elem event and style packages.

@neelance
Copy link
Contributor

Rob Pike: Length is not a virtue in a name; clarity of expression is.

For example Header1 instead of H1 conveys a lot more information. But what the heck does a HypertextReference do? ;-) I think href is so common, everyone knows it.
However, it might be good to stay consistent, at least inside of each package. I opted for longer element names because the acronyms of HTML tags are really bad and some of them already have longer class names in the DOM API. Properties and styles however already have proper names in the DOM API, so I think we should keep them.

@bep
Copy link

bep commented Feb 13, 2016

Go's vet tool will complain about Id and suggest ID, at least in vars like elementID.

@slimsag
Copy link
Member Author

slimsag commented Feb 13, 2016

@neelance thanks for clearing this up :) I think what you said makes sense, and from creating this issue that is exactly what I wanted to find out: what exactly is the name remapping pattern? I think you answered that clearly and I'm happy with it 👍

@neelance @bep maybe we should Id -> ID and Href -> HRef ?

@bep
Copy link

bep commented Feb 13, 2016

I watch this repo with interest as this is something I need and want, so I have no strong meaning about this. But getting the names right before people start using it saves a lot of trouble in the long run. I did a major naming cleanup of the API of Hugo a couple of months ago ... A lot of work with all the themes etc ...

@slimsag slimsag self-assigned this Feb 13, 2016
@dmitshur
Copy link
Contributor

Id -> ID

Definitely. Consider honnef.co/go/js/dom a good example (/cc @dominikh). It has GetElementByID not getElementById.

About Href, I'm unsure that HRef is better. I consider "href" to be one weird word. Also see https://godoc.org/honnef.co/go/js/dom#HTMLLinkElement.Href.

@slimsag
Copy link
Member Author

slimsag commented Feb 14, 2016

About Href, I'm unsure that HRef is better. I consider "href" to be one weird word. Also see https://godoc.org/honnef.co/go/js/dom#HTMLLinkElement.Href.

FWIW I agree with your stance and think that Href reads better than HRef. But, we're being inconsistent, because href does stand for Hypertext Reference (two words), so... maybe we can blame HTML naming horror 😱

@neelance
Copy link
Contributor

I also consider Href as a weird word, same as @shurcooL.

@dominikh
Copy link

Generally speaking, I'm 👍 for ID and Href. Yes, Href technically stands for two words. However, ID technically stands for one word, yet is treated like an acronym. We have some freedom in mangling names ;)

slimsag added a commit that referenced this issue Feb 21, 2016
@slimsag slimsag mentioned this issue Feb 21, 2016
@slimsag
Copy link
Member Author

slimsag commented Feb 21, 2016

Sounds like we all agree to go with ID and Href, I've created #32 to switch to ID. PTAL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants