-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
doc (book): add "Getting Started" subsection: "Essential Terminology" #8855
doc (book): add "Getting Started" subsection: "Essential Terminology" #8855
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Thanks for the PR! Given the prominence of this in the documentation I'd like to consider this carefully since it has the potential to affect many newcomers. To me this seems a bit out-of-place in the documentation and has a bit of a "bolt on after the fact" kind of feeling. I think ideally we would introduce these terms and explain them as part of the natural process of learning Cargo, not necessarily introducing what we might talk about later before we get there. Did you find the existing intro docs lacking? Are terms introduced or used without much explanation as to what they are? If so could those locations perhaps get fixed? |
In general, I find the Rust documentation to be excellent, and am often impressed with the clarity with which specific topics are explained. But I do think The Cargo Book could benefit from conceptually "picking up from" where the section 1.3. ("Hello, Cargo!") leaves off in The Book, as I'll elaborate on more below. Before I get to that, though, I'll mention that I'd like to rescind this PR in its current form. Thanks for your comments, @alexcrichton. The process of responding to them has lead me to reconsider the "Essential Terminology" section. I agree that it does have a "bolted-on" feel, which is not the way to go. Over the next few days I'd like to rework the PR to introduce the terms where they are first used, but point the reader to specific entries in the glossary within The Cargo Book to get the full definitions. I'll also revisit the definition pieces from my initial PR; I'll drop those bits that are redundant with the material already present in the glossary, and maybe patch-in any remaining tidbits that might enhance the existing definitions. With that said, allow me to provide some additional context around where I see a gap in the docs. I think the motivation can best be understood from the perspective of an experienced developer who has worked with the tooling in other language ecosystems, and wants to kick the tires on Rust. Such a user is not necessarily committed to using Rust, and may be somebody who has looked at it before and is now circling back to get a sense for how it has matured since "the last time". Such a user will likely start with The Book, the beginning of which is structured like this:
As likely as not, section 1.1 ("Installation") was merely skimmed or even skipped if the user was able to obtain Rust and Cargo from the system package manager (e.g., Section 1.2 ("Hello, World!") does a good job of bootstrapping the developer on the base-level essentials by creating a source artifact by hand and compiling it with Though it could be said that the user has compiled a binary crate, that terminology is not yet introduced. It is instead referred to only as a "program" and a "binary executable", terms familiar to the reader, without any ambiguity or loss of meaning. All good. Section 1.3 ("Hello, Cargo!") does a good job of mapping the manually created artifacts into the conventional structure expected by Cargo and achieving the same results as the earlier steps that used It also mentions the familiar term "libraries", and that the Cargo-specific term "dependencies" means (apparently) the same thing thing that it means in casual developer-to-developer conversation. No surprises there; good. Section 1.3 does a good job of motivating the need for a tool like Cargo to manage dependencies and to make build commands the same across projects ( Note that 1.3 is (appropriately, IMO) still using the generic term "project". The term "package" is mentioned only in passing, and reader gets the impression that it has something to do with specifying the metadata (name, version, etc) of a project. The "Creating a Project with Cargo" section contains the first example the user sees of the So far, so good. 1.3 notes that the rest of the book assumes the use of Cargo, and the section ends by pointing the reader at The Cargo Book to learn more. So the developer decides to get more comfortable with Cargo before proceeding with the rest of The Book, and heads on over to The Cargo Book. So now the user is looking at the beginning of The Cargo Book:
The "Introduction" page introduces the common term "package manager", and describes what that means more specifically for Cargo. This statement keeps the user comfortable in the knowledge that experience with other language-specific package managers seems to have an analogue in the Rust ecosystem. The "Introduction" mentions that the "Getting Started" chapter will "set up your first crate". This is the first time the user has seen the term "crate". Aside from that one mention, however, the word "crate" is not used anywhere else in the "Getting Started" chapter. The "Introduction" also mentions that the "Cargo Guide" chapter "will give you all you need to know about how to use Cargo to develop Rust packages". This is the second time the user is seeing the term "package", but it has not yet been defined. The user may have a rough notion about its meaning, as mentioned above. If the user peeks ahead at the first two sections of the "Cargo Guide" chapter, the word "package" is used as if the user already knows what it is. So the user thinks, "Alright, it must be defined somewhere between the Introduction and here", and goes back to the Introduction. The curious (or skeptical) reader would be well served by peeking ahead at the glossary at this point, but may think that is "too into the weeds" at this stage. In any event, it doesn't happen. From this point forward, the scenario is the same as noted in the "Motivation" section of the description of issue #8854, so I'll just quote it here (with the obsolete bits struck):
In general, if the prose within the sections in the "Introduction", the "Getting Started" chapter, and the "Cargo Guide" chapter were to provide links into the glossary upon the first mention of a given terms on a given section page, that would both answer the user's question about what a given term means and also inform the user that "Hey, there's this great list of definitions over here (that you may have otherwise missed)". Such links would also avoid the user needing to go hunt down the terms manually. Instead of providing a new cheatsheet in the form of an "Essential Terminology" page (as this original PR did), we would be pointing the user to the existing list of definitions (no cheatsheet needed). |
aaa87d6
to
5a299bf
Compare
Add a handful of entries to the glossary of The Cargo Book, and add intra-glossary hyperlinks for terms. A full catalog of the specific changes follows. Glossary entries added: + 'Cargo.lock' -- just points to the 'lock file' entry + 'Cargo.toml' -- just points to the 'manifest' entry + 'Module' -- explained in relation to 'crate' + 'Package manager' -- first term in the Introduction + 'Package registry' -- Another term from the Introduction. This entry just points to the 'registry' entry Glossary entries modified: + 'Artifact' - Extend def. to include generated docs. + 'Crate' - Refer to a "Rust crate" as a hint that it is a term that exists outside of Cargo. - Refer to a "Cargo package" (rather than just "package") to reflect the fact that the term is a concept introduced by Cargo (as opposed to being inherent to Rust). - Link to related terms: 'module', 'package', 'registry', and 'target'. + 'Edition' - Link to related term: 'manifest'. + 'Feature' - Link to related term: 'manifest'. + 'Index' - Markdown: add emphasis to first mention of term "index". - Link to related terms: 'crate', 'registry'. + 'Lock file' - Link to related terms: 'package', 'workspace'. + 'Manifest' - Link to related terms: 'package', 'workspace'. + 'Member' - Link to related terms: 'package', 'workspace'. + 'Package' - Note that every target is a crate, and that the type (library or binary) is determined by the Cargo.toml file. - Note relationship to workspaces. - For "package root", add "compare to" note referencing "workspace root". - Link to related terms: 'crate', 'manifest', 'target', 'workspace'. + 'Registry' - Link to related terms: 'crate', 'index', 'package'. + 'Source' - Link to related terms: 'crate', 'package'. + 'Target' - Link to related terms: 'artifact', 'manifest', 'package', 'workspace'. + 'Test Targets' - Link to related terms: 'crate', 'manifest'. + 'Workspace' - For "workspace root", add "compare to" note referencing "package root". - Link to related terms: 'lock file', 'manifest', 'member', 'package'.
No language changes; just make these existing terms link to their corresponding entries in the glossary: - crate - package - package manager - package registry
5a299bf
to
c69618e
Compare
In the "First Steps with Cargo" section, add a short introductory paragraph informing the reader what to expect from the page. This provides a transition for the reader who may not yet know what a package is. Rather than jump right into "To start a new package with Cargo, ...", we now set the context for the purpose of the page, and also provide hyperlinks into our Glossary for the terms 'package', 'manifest', and 'crate'.
The "Why Cargo Exists" section of the "Cargo Guide" is here split into two subsections: "Preliminaries" "Enter: Cargo" The content in "Preliminaries" is new, and provides a transition that motivates the need for a package manager rather than using 'rustc' directly. It provides footing for the reader that knows very little about Rust and nothing about Cargo. The "Enter: Cargo" subsection contains the previous content, augmented with a new paragraph explaining how the conventional list of build targets simplifies working with Cargo packages: "...once you know how to build one Cargo-based project, you know how to build /all/ of them." The following terms are linked to their Glossary entries: - artifact - crate - package - package manager - registry
…lossary The following terms are linked to their Glossary entries: - crate - manifest - package Also note that the generated "hello world" program is known as a "binary crate".
…ossary The following term(s) are linked to their Glossary entries: - package
The following term(s) are linked to their Glossary entries: - crate - package - package registry
…sary The following term(s) are linked to their Glossary entries: - module - package
…ossary The following term(s) are linked to their Glossary entries: - manifest - package
The following term(s) are linked to their Glossary entries: - package
… to glossary The following term(s) are linked to their Glossary entries: - package
The following term(s) are linked to their Glossary entries: - crate - package - registry
The following term(s) are linked to their Glossary entries: - workspace
c69618e
to
ab78221
Compare
I've reworked this PR as described in my last comment and the newly updated PR description; please take a look when you can:
The idea with the last item is that new users that have already read through the "Cargo Guide" are likely to be coming back to it for reference as they work with Rust. The links into the Glossary make it easier to jump into a certain section and remind oneself of what a given term means. It also serves as a reminder that the Glossary exists, which is a nice reminder that good definitions can be had from something more authoritative than a random web search. Any feedback much appreciated. I'm happy to rework this based on suggestions for improvements. Am also fine with just dropping it if this kind of thing just isn't wanted; just let me know. Thanks, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. @alexcrichton did you have any concerns?
📌 Commit ab78221 has been approved by |
☀️ Test successful - checks-actions |
Update cargo 12 commits in bfca1cd22bf514d5f2b6c1089b0ded0ba7dfaa6e..63d0fe43449adcb316d34d98a982b597faca4178 2020-11-24 16:33:21 +0000 to 2020-12-02 01:44:30 +0000 - Add "--workspace" to update command (rust-lang/cargo#8725) - Add an FAQ for "Why is my crate rebuilt?" (rust-lang/cargo#8927) - Set docs.rs as the default extern-map for crates.io (rust-lang/cargo#8877) - remove extra whitespace when running cargo -Z help (rust-lang/cargo#8924) - Remove version from dev-dependencies to make it easier to publish. (rust-lang/cargo#8920) - update dependency queue to consider cost for each node (rust-lang/cargo#8908) - Fix some rustdoc warnings. (rust-lang/cargo#8911) - Bump miow dependency to not invalidly assume memory layout (rust-lang/cargo#8909) - Remove unnecessary trailing semicolons (rust-lang/cargo#8906) - Fix custom_target_dependency test. (rust-lang/cargo#8907) - fix: we don't ignore `version` for `git`/`path` deps now (rust-lang/cargo#8900) - doc (book): add "Getting Started" subsection: "Essential Terminology" (rust-lang/cargo#8855)
Reworked PR (2020-11-21)
Fixes #8854
In The Cargo Book, beef-up the glossary, and provide hyperlinks to the definitions of key terms through both the "Getting Started" and "Cargo Guide" chapters.
In addition to the links, some transitional text (two sentences) has been added to the beginning of "First Steps with Cargo", and somewhat more to "Why Cargo Exists" in the guide. The intent is cater to readers jumping into this book cold, or perhaps coming from the "Hello, Cargo!" section at the beginning of The Book. The changes assume a knowledgeable but skeptical user, so take pains to justify the reader's attention. A developer that knows very little about Rust and nothing about Cargo and can follow the text and map Cargo-specific concepts to analogues in other language ecosystems.
Within the glossary many terms are touched-up, as described in the commit message for the first patch in the series. Intra-glossary links are added between all terms.
In the "Getting Started" and "Cargo Guide" chapters, terms are linked to their glossary entries throughout, for the first mention of a term within a given section. The first time a term is seen in the chapter, the markdown syntax for italics is used. In "First Steps with Cargo", both italics and bold markdown are used, in keeping with the existing styling.
Orig PR (2020-11-12) -- obsolete
Insert short terminology cheatsheet page to explain these terms:packagecratelibrary cratebinary cratemoduleworkspaceImportant in these definitions is the fact that a single package is defined bya single 'Cargo.toml' file, and that a non-workspace Cargo.toml package
contains one or more crates.
The last two terms in the list are just glossed over, as it is more importantthat the user know that the terms exist, and that there are both lower-level
(module) and higher-level (workspace) concepts than the organizational units
(a package and its crates) that feature most prominently in basic cargo
builds.
With the addition of this new "Essential Terminology" page, the structure atthe beginning of The Cargo Book is:
The terms in the above list are all well defined elsewhere in the Rust andCargo documentation, but a new user encountering them for the first time
should not need to hunt them down.
Since the opening sections of the Cargo book are among the first documents anew user is likely to encounter, we are providing a little cheatsheet of the
essentials at this stage. Defining the above terms gives the reader a good
foothold to map concepts they may be familiar with from other languages onto
their Rust counterparts (roughly speaking).
Closes #8854