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

docs: add a new section on content organization #5659

Merged
merged 1 commit into from
Jun 9, 2020
Merged

Conversation

bajtos
Copy link
Member

@bajtos bajtos commented Jun 4, 2020

Based on the discussion in #5550, I am updating the documentation for developers with the definition of "building-blocks", a list of packages considered as building blocks, and finally instructions on how to treat these packages in our docs, CLI templates and examples.

After this PR is approved, I'll created follow-up stories to ensure proper use of the following packages:

The following packages are already not exposed:

  • packages/http-server
  • packages/repository-json-schema

Checklist

👉 Read and sign the CLA (Contributor License Agreement) 👈

  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Documentation in /docs/site was updated
  • Affected artifact templates in packages/cli were updated
  • Affected example projects in examples/* were updated

👉 Check out how to submit a PR 👈

@bajtos bajtos added the Docs label Jun 4, 2020
@bajtos bajtos requested review from raymondfeng, dhmlau and a team June 4, 2020 12:25
@bajtos bajtos self-assigned this Jun 4, 2020
@bajtos
Copy link
Member Author

bajtos commented Jun 4, 2020

Please note this PR is just a small incremental step on a longer journey, I expect us to do more doc-related improvement in follow-up stories and pull requests, depending on how the discussions in #5113, #5550 and #5549 evolve.

package should be moved to "building blocks" and our documentation should be
updated to reference the higher-level "framework" instead.

List of packages that are considered as building blocks:
Copy link
Contributor

Choose a reason for hiding this comment

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

And the rest are framework-level pacakges? If yes, we should mention that, else it feels like the list of framework-level pacakges is missing.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done in 69dcaa6

There is one thing that bugs me a bit: we also have utility packages like @loopback/build or @loopback/testlab that are technically not part of the framework, but they are not building blocks either in the sense that they should be mentioned in our framework documentation.

I guess "framework-level" is not the best term to use. Can we come up with a more accurate name?

Copy link
Member

Choose a reason for hiding this comment

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

What about the extensions and examples packages? Those seem more like an adds-on.

Copy link
Member Author

Choose a reason for hiding this comment

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

What about the extensions and examples packages? Those seem more like an adds-on.

Sure 👍

What I am trying to accomplish here is to distinguish between "building blocks" packages that should not be referred to in our docs, CLI templates and example apps; and everything else.

I used the term "framework-level" for "everything else", which is clearly misleading based on your feedback.

So, what would be a better term?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess "framework-level" is not the best term to use. Can we come up with a more accurate name?

They need not belong in the framework packages. They can be classified as helper/utility packages.

Copy link
Member Author

@bajtos bajtos Jun 8, 2020

Choose a reason for hiding this comment

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

I am adding the following clarification to the docs:

#### Framework-level packages

All packages not listed above are considered as framework-level.

We consider utilities like `@loopback/testlab` and example projects like
`@loopback/todo` as framework-level too.

Copy link
Contributor

Choose a reason for hiding this comment

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

We consider utilities like @loopback/testlab and example projects like
@loopback/todo as framework-level too.

Doesn't feel right. Anything that LoopBack developers would not (maybe even never) use in their project feels very odd to be classified under framework-level packages. We need a third category - helpers, utility, along that line.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess this is subjective.

Let's land my PR as the first step, and then you can open a follow-up PR to discuss how to improve this initial categorization.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good.

groups:

1. Building-blocks are lower-level packages that are typically not consumed by
LoopBack projects directly, instead there is a higher-level package exposing
Copy link
Contributor

Choose a reason for hiding this comment

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

LoopBack projects -> LoopBack applications or LoopBack application projects.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, I think this applies to most extension projects too, but let's not dwell on details. I am going to use "LoopBack applications" for now, we can improve this later as we get a better picture about the documentation for extension authors.

writing docs. While this is good for capturing the knowledge in a text form, it
also makes the documentation difficult to follow by people new to LoopBack.
Newcomers get quickly overwhelmed by the amount of concepts they need to
understand and all the different packages they need to know about.
Copy link
Contributor

Choose a reason for hiding this comment

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

We should also mention the balance between modular design and ease of use.

  • Module design leads to great flexibility and composability. As the number of modules grows, it also increases the complexity as developers need to know what to choose and how to use.
  • We need to target high-level packages for application developers without dragging in lower-level details.

Copy link
Contributor

Choose a reason for hiding this comment

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

We may want to identify several personas of different interest/entry to LB here:

  • Platform/extension developers
  • Application developers

Copy link
Member Author

Choose a reason for hiding this comment

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

We may want to identify several personas of different interest/entry to LB here:

  • Platform/extension developers
  • Application developers

Yeah, I agree that at some point, we need to step back and reorganize our docs to cater for different personas. As I see it, our current docs is mostly aimed at application developers. In this pull request, I am proposing how to make the docs easier to read for app developers. We can discuss how to better address other personas in #5113.

To prevent that issue, we have categorized all monorepo packages into two
groups:

1. Building-blocks are lower-level packages that are typically not consumed by
Copy link
Contributor

Choose a reason for hiding this comment

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

not consumed -> not directly consumed or not explicitly consumed?

Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we can find a better name for building blocks. Maybe foundation-level packages to be symmetric with framework-level?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or library-level?

Copy link
Member Author

Choose a reason for hiding this comment

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

not consumed -> not directly consumed or not explicitly consumed?

English is not my mother tongue, but I believe that my current version is grammatically correct while conveying the same meaning.

lower-level packages that are typically not consumed by LoopBack projects directly

Copy link
Member Author

Choose a reason for hiding this comment

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

I wonder if we can find a better name for building blocks. Maybe foundation-level packages to be symmetric with framework-level?

I like "foundation-level" + "framework-level".

In #5659 (comment), we were discussing with @hacksparrow that "framework-level" may not be the best description. However, I think with building blocks renamed to "foundation-level", the term "framework-level" is ok.

@bajtos bajtos force-pushed the docs/package-layers branch from 69dcaa6 to 8368999 Compare June 8, 2020 08:15
@bajtos
Copy link
Member Author

bajtos commented Jun 8, 2020

@hacksparrow @dhmlau @raymondfeng thank you for the suggestions. I rewrote most of the new content to incorporate your feedback, does the new version LGTY now?

@bajtos bajtos requested review from raymondfeng and hacksparrow June 8, 2020 08:16
@hacksparrow
Copy link
Contributor

How do we handle "breaking changes" in docs organization? For example a framework-level package underwent some refactoring and ended up becoming a foundation-level package.

@bajtos
Copy link
Member Author

bajtos commented Jun 8, 2020

How do we handle "breaking changes" in docs organization? For example a framework-level package underwent some refactoring and ended up becoming a foundation-level package.

At the moment, we have a single version of docs only ("the latest").

I think we will eventually need to introduce versioning (e.g. docs for @loopback/rest version from 2020 vs. version from 2021`), especially once we introduce LTS versions (see #4398). Perhaps such versioning would help?

In the current state, where there is a single version of docs only: When a framework-level package becomes foundation-level, I am envisioning the following process:

Is there any specific concern you have, @hacksparrow?

@hacksparrow
Copy link
Contributor

My concern was looking at outdated references. Versioning should help.

docs, CLI templates, example apps are updated to use framework-level APIs instead of referring to he package that was moved to foundation-level
if & where appropriate, we may add additional sections to explain how to migrate from the "old" to the "new" style - see e.g. https://loopback.io/doc/en/lb4/DataSource-generator.html#legacy-json-based-configuration

Sounds good for now.

Copy link
Member

@dhmlau dhmlau left a comment

Choose a reason for hiding this comment

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

LGTM.

- [packages/http-server](https://github.com/strongloop/loopback-next/tree/master/packages/http-server)
- [packages/metadata](https://github.com/strongloop/loopback-next/tree/master/packages/metadata)
- [packages/openapi-v3](https://github.com/strongloop/loopback-next/tree/master/packages/openapi-v3)
- [packages/repository-json-schema](https://github.com/strongloop/loopback-next/tree/master/packages/repository-json-schema)
Copy link
Contributor

Choose a reason for hiding this comment

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

This package depends on @loopback/core and @loopback/repository. It should be moved out.

Copy link
Member Author

Choose a reason for hiding this comment

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

This package depends on @loopback/core and @loopback/repository. It should be moved out.

Please note the criteria is not whether a package depends on something else from @loopback/* namespace, but whether LB application developers should depend on that package directly.

Both @loopback/repository-json-schema and @loopback/openapi-v3 are not meant to be used directly. They are building blocks used by @loopback/rest. Applications are importing their APIs and functionality from @loopback/rest, as can be seen e.g. in examples/todo/src/controllers/todo.controller.ts

- [packages/express](https://github.com/strongloop/loopback-next/tree/master/packages/express)
- [packages/http-server](https://github.com/strongloop/loopback-next/tree/master/packages/http-server)
- [packages/metadata](https://github.com/strongloop/loopback-next/tree/master/packages/metadata)
- [packages/openapi-v3](https://github.com/strongloop/loopback-next/tree/master/packages/openapi-v3)
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure about this one either:

"dependencies": {
    "@loopback/core": "^2.7.1",
    "@loopback/repository-json-schema": "^2.4.3",
}

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

Successfully merging this pull request may close these issues.

4 participants