You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently, the header parsing system creates an object for each header, which might involve parsing headers that aren't used or read. This could result in unnecessary overhead, especially in scenarios where headers are only partially consumed. Additionally, there is no mechanism to restrict users from implementing header-related classes, which might limit the ability to extend these classes in the future.
Describe the solution you'd like
Extension Types:
Use extension types to reduce the need for object creation for each header. This can improve performance and potentially allow for a more dynamic and efficient design.
Class Modifiers:
Apply class modifiers (e.g., sealed or final) to prevent direct implementation of header-related classes by users, ensuring controlled extensibility of these interfaces in the future.
Describe alternatives you've considered
Continuing with the current approach, where objects are created for each header. While straightforward, this may not be as efficient as using extension types.
Relying on documentation or usage conventions to discourage direct implementation of certain classes instead of using class modifiers. However, this lacks enforceability.
Additional context
This suggestion originates from feedback pointing out potential optimizations and maintainability improvements. It may also help align the design with best practices for API extensibility.
klkucaj
changed the title
Consider Extension Types and Class Modifiers for Header Design
RELIC: Consider Extension Types and Class Modifiers for Header Design
Dec 9, 2024
Is your feature request related to a problem? Please describe.
Currently, the header parsing system creates an object for each header, which might involve parsing headers that aren't used or read. This could result in unnecessary overhead, especially in scenarios where headers are only partially consumed. Additionally, there is no mechanism to restrict users from implementing header-related classes, which might limit the ability to extend these classes in the future.
Describe the solution you'd like
Extension Types:
Use extension types to reduce the need for object creation for each header. This can improve performance and potentially allow for a more dynamic and efficient design.
Class Modifiers:
Apply class modifiers (e.g.,
sealed
orfinal
) to prevent direct implementation of header-related classes by users, ensuring controlled extensibility of these interfaces in the future.Describe alternatives you've considered
Additional context
This suggestion originates from feedback pointing out potential optimizations and maintainability improvements. It may also help align the design with best practices for API extensibility.
Feedback: serverpod/serverpod#2744 (comment)
The text was updated successfully, but these errors were encountered: