Summary
Shared libraries often document guiding principles to describe the paradigms followed when designing, building, collaborating on, and sharing the library. These can include many different things depending on the purpose of the library and the priorities of the maintainers: visual design paradigms, code design patterns, collaboration principles, etc.
Some examples:
Defining and documenting guiding principles for the future Vue component library could help us in the following ways:
- Communicate to our end users who the library is for: which users we intend to prioritize and what we intend to provide them
- Communicate to our collaborators how we intend to work with them
- Be a resource for resolving issues or conflicts when they come up
- Document high-level principles of the kind of code we want to write
Proposal
The Wikimedia Design Style Guide captures design-specific principles. In the shared component library, we could cover the following (note: these are some initial ideas and the wording will need work):
Who we're serving
- Prioritize end-user developer experience: we want the library to make building user interfaces straightforward and fast. We aim to serve users of varying levels of experience and to stick to existing patterns as much as possible so the library to facilitate developer onboarding.
- Accessibility and internationalization: Wikimedia intends to serve every human being, eventually. We will follow Wikimedia's accessibility principles and aim to support many languages.
- Designed and built for the wider MediaWiki ecosystem: we intend to serve developers working both within MediaWiki (core, skins, and extensions) and in the larger ecosystem, including web-based tools, static web applications, Jamstack applications, and some of our mobile apps. Platform-agnosticism will enable us to use this library as we continue expanding this ecosystem.
- To keep our code as flexible as possible, we will aim to avoid entirely MediaWiki-specific components. When they can't be avoided, we will clearly label them as such and abstract out as much of the MediaWiki-specific code as possible in order to sequester it and aim to make it optional or configurable.
- Components should be thoughtfully designed and developed to work across device widths
Collaboration principles [1]
- Transparency: We work in the open and aim to provide consumers as much information as possible about what we're working on and how we're prioritizing that work.
- Enable rather than enforce: The library maintainers welcome contributions from others and wish to collaboratively build resources to enable others to easily contribute to the library.
- Knowledge sharing rather than knowledge silos: Contributors should have support and access to resources that allow them to understand and influence the system's workflows, methodologies, standards, and infrastructure.
Code design patterns
- Composition over complexity: Smaller components are easier to understand and more reusable.
- Clarity over brevity: It's better for code to be easily understandable than to be as short or as clever as possible.
- Use existing patterns: Sticking to patterns established in the greater front-end community enables more people to contribute. Following consistent patterns within the library makes the code easier to write, review, and maintain.
- Keep the template simple: The template within single file Vue components can be a tool to clearly illustrate what a component is and does. Consider moving everything but the most basic JavaScript code to the script tag.
Please feel free to comment on these principles or suggest additional ones in the comments!
[1] Notes on collaboration principles:
- These came from Sarai and Volker via T287535.
- There are additional, more specific collaboration guidelines in WVUI: contributing and WiKit: Contributing, modifying existing components, creating reusable components
Acceptance criteria
- Propose an initial list of guiding principles at the Vue.js Developer Summit, or shortly afterward if there isn't time at the summit
- Solicit feedback on additional principles to include
- Discuss principles within this task
- Document them in the shared library, ideally in a way that's visible in Storybook