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

Add a glossary #2199

Merged
merged 10 commits into from
Jun 12, 2023
Merged

Add a glossary #2199

merged 10 commits into from
Jun 12, 2023

Conversation

skirtles-code
Copy link
Contributor

@skirtles-code skirtles-code commented Feb 1, 2023

Deployed: https://deploy-preview-2199--vuejs.netlify.app/glossary/

The motivation is to help developers to understand what key technical terms mean in a Vue context. e.g. What is a 'compiler macro' or a 'fragment'? These are intended to be relatively brief introductions to the terms, with links to read more.

The main guide could link to these entries when a term is potentially unclear to the reader, though I haven't currently added any such links.

In some cases, the need for a glossary entry could be an indication that we need to do a better job of explaining a concept in the guide. However, the guide has its own specific role, and trying to clarify the exact meaning of a term can potentially derail the flow or require discussion of topics that haven't been covered yet. The glossary doesn't need to bound by those concerns.


Some open discussion points:

  • How should the page be styled/themed? The ON THIS PAGE list on the right-hand side is far too long.
  • The terms are currently in alphabetical order in English. How will this impact translations?
  • I'm still not really happy with the opening paragraph at the top that explains the page.

Some initial questions I asked when I first opened this PR:

  • Am I defining the right terms?
  • Are they defined in the right level of detail? It is currently quite inconsistent in the level of detail for different entries.
  • What tone should we be aiming for? More formal definitions or chattier descriptions?
  • How advanced or basic should it go? Some of the terms describe advanced concepts, whereas others touch on beginner-level Vue ideas. It's difficult to imagine both extremes having the same target audience.

Some glossaries we might want to use as reference points:

@netlify
Copy link

netlify bot commented Feb 1, 2023

Deploy Preview for vuejs ready!

Name Link
🔨 Latest commit bd1b738
🔍 Latest deploy log https://app.netlify.com/sites/vuejs/deploys/641b9fa605114a00082014f4
😎 Deploy Preview https://deploy-preview-2199--vuejs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@NataliaTepluhina
Copy link
Member

@skirtles-code thank you for working on this! Even in this unpolished state the draft looks very promising.

Am I defining the right terms?

I would say "yes". "What is composable" is probably the most common question I hear about Vue and you started right from it 😅

Are they defined in the right level of detail? It is currently quite inconsistent in the level of detail for different entries.

IMO, they are good enough. Perfect level of detail will come with iteration and community contributions. Different terms will naturally have different level of detail because the scope is very different there.

What tone should we be aiming for? More formal definitions or chattier descriptions?

IMO, glossary should aim for formal definitions

How advanced or basic should it go? Some of the terms describe advanced concepts, whereas others touch on beginner-level Vue ideas. It's difficult to imagine both extremes having the same target audience.

Both! Because there will be both kinds of the target audience.

@skirtles-code skirtles-code marked this pull request as ready for review March 7, 2023 01:53
@skirtles-code skirtles-code changed the title Initial draft of a glossary page Add a glossary Mar 7, 2023
src/glossary/index.md Outdated Show resolved Hide resolved
src/glossary/index.md Outdated Show resolved Hide resolved

Macros have limitations on their use that don't apply to normal JavaScript code. For example, you might think that `const dp = defineProps` would allow you to create an alias for `defineProps`, but it'll actually result in an error. There are also limitations on what values can be passed to `defineProps()`, as the 'arguments' have to be processed by the compiler and not at runtime.

These macros are conceptually similar to dynamic imports using `import()`. While `import()` looks a lot like a function call, it's actually special syntax that gets processed by the bundler as part of the build. Like with `defineProps()`, we can't create an alias using `const myImport = import`. There are also restrictions on exactly what syntax can be used to pass values to the `import()` 'function', so that the bundler can understand the values.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The analogy here isn't 100% correct and might be misleading, since dynamic import() is in fact a native JavaScript feature. It's just bundlers happen to use it (with syntax limitations) as a form of compilation hint.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed this paragraph.

The motivation behind including it was to try to make Vue's macros seem more relatable, and less like 'Vue being weird'. Native import(), used without a bundler, still has some similarities to the Vue macros, in that it isn't a true function and can't be aliased.

But I can see how it could be confusing. Trying to explain one unfamiliar concept by analogy to another unfamiliar concept is probably not going to have the effect I was aiming for.

src/glossary/index.md Show resolved Hide resolved
src/glossary/index.md Show resolved Hide resolved
src/glossary/index.md Outdated Show resolved Hide resolved
Rather than creating DOM nodes directly, Vue components generate a description of what DOM nodes they would like. These descriptors are plain JavaScript objects, known as VNodes (virtual DOM nodes). Creating VNodes is relatively cheap.

Every time a component re-renders, the new tree of VNodes is compared to the previous tree of VNodes and any differences are then applied to the real DOM. If nothing has changed then the DOM doesn't need to be touched.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth adding a note that Vue improves virtual DOM runtime performance with compilers, since many new users nowadays assume virtual DOM to be associated with bad performance due to Svelte / Solid's marketing.

Copy link
Contributor Author

@skirtles-code skirtles-code Mar 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a paragraph at the end about 'Compiler-Informed Virtual DOM'.

@yyx990803
Copy link
Member

Any particular reason why all terms start with lowercase? It feels a bit weird to be honest.

skirtles-code and others added 4 commits March 20, 2023 15:01
Co-authored-by: Evan You <yyx990803@gmail.com>
Co-authored-by: Evan You <yyx990803@gmail.com>
Co-authored-by: Evan You <yyx990803@gmail.com>
@skirtles-code
Copy link
Contributor Author

Any particular reason why all terms start with lowercase? It feels a bit weird to be honest.

Yeah. I was aiming for the kind of casing you'd see in a dictionary, with words written in the case they would usually have if they were used in the middle of a sentence. So Composition API and Single-File Component get capital letters, whereas terms like props are just lowercase.

For reference, the Angular glossary uses this same casing convention, though the React glossary does not.

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

Successfully merging this pull request may close these issues.

3 participants