ACM: Admin-UI Component Model [WIP] #463
matheusps
started this conversation in
Technical RFCs
Replies: 1 comment
-
@matheusps Is this discussion still relevant or is this content already in the documentation? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
ACM: Admin-UI Component Model
ACM presents a set of rules and best practices, that describes how Admin-UI components are created and used. It exists to standardize the API surface area of the design system functionalities, reducing the learning curve.
Table of contents
The learning curve theory [WIP]
The learning curve theory explains that as individuals or organizations accumulate experience, they initially experience rapid improvements in performance and cost reduction. However, as they reach higher levels of proficiency, the rate of improvement slows down until it eventually levels off. Understanding and leveraging the learning curve can help individuals and organizations optimize their processes, enhance productivity, and achieve long-term success.
Initially, when people begin a new task or venture, they experience a steep learning curve, indicating a slow rate of progress. This phase is characterized by trial and error, as individuals familiarize themselves with the task's intricacies and develop basic skills. As they gain experience, their performance improves gradually, and they become more efficient in completing the task. This early stage of learning is often associated with significant improvements in productivity and cost reduction.
Grasping the learning curve theory in reusable component API design helps create developer-friendly interfaces, anticipate and address potential challenges, and drive continuous improvement. By reducing the learning curve associated with the API, library creators can foster a positive developer experience and encourage wider adoption of their tooling.
The desing system evolves as people evolves. So, its a learning curve acuulmulator. Its. a shared knowledge enviroment : “/The industrial learning curve thus embraces more than the increasing skill of an individual by repetition of a simple operation. Instead, it describes a more complex organism—the collective efforts of many people, some in line and others in staff positions, but all aiming to accomplish a common task progressively more efficiently/“
How do Components surge [WIP]?
It's important to understand how components actually appear on a shared library, such as Admin UI.
Extraction
The component is data-locked and specialized.
The component gets abstracted and white-labeled.
The component is extracted into a reusable package.
All the instances specialize the abstraction.
Ideation
The component is created and then inserted.
Normally core components surge this way.
Promotion
A compound component exists.
An inner structure gets important.
This inner structure is extracted and then inserted.
The infinite abstraction hell
The solution: Don’t abstract what you don’t reuse in someplace.
The pace: Resolve a real-world example => Abtract => Ship => Do it all over again.
Book: Refactoring, Martin Fowler.
Methodology: AHA - Avoid Hasty Abstractions, Kent C. Dodds.
Component design
Whether you think of component API design, there are two main aspects that you must be concerned are Flexibility and Complexity.
Every component design has its pros and cons. When you're choosing the pattern, try to be intentional, get to know your target audience, and be consistent with your ideas.
Remember that a good component design/API makes it easier for your audience to do the right thing, and harder for the wrong thing.
Stateless Components
Composition
Parent relation: aka Children
Free property: aka Node properties
State hooks
When the state is too complex and you want a deeper level of control over it, you can abstract your state into a state hook that enables the state to be intercepted and changed before passing it to the stateless component. This model creates a good balance between consistency, simplicity, and flexibility.
Another advantage is the reuse of behavior:
Component hooks
Use component hooks whether you need to
💡 They use the prop-getters pattern
Stateful components
Typescript
Extend JSX elements
Styling
The styling model is designed to be agnostic for styling library
🚧 WIP 🚧
Variants
Variants are achieved with the help of class names and data-attributes.
Anti-patterns
Some anti-patterns that you must watch-out
The black box: aka Prop-drilling
Prop-drilling is not necessarily a problem.
This is how de component is used
Data always flows down…
Real case scenario:
Another page was created. It also has a header, but no tabs. In the current solution, you would add a if statement to make it work.
This should do the trick.
TBD
The wizard HOC
TBD
References
Beta Was this translation helpful? Give feedback.
All reactions