WebExpress 0.0.11‑alpha – Why WebExpress Moves from Static Values to Render-Time Delegates
Web applications are inherently multi‑user systems that must respond to different contexts simultaneously, which made the need for a more flexible, render‑time evaluated property model increasingly clear. The transition from value‑based to delegate‑based properties in WebExpress represents a fundamental architectural advancement that changes how controls obtain their values. Until now, properties were assigned fixed values during control initialization, which worked well as long as those values were static. However, as soon as values needed to be derived from context at render time, such as from the current request or other dynamic runtime conditions, the previous model reached its limits. In these situations, developers had to derive custom control classes and override the render function to compute the required values during the rendering process. This approach introduced additional complexity and reduced reusability.
With version 00.11‑alpha, WebExpress introduces a new property model based on delegates, allowing values to be computed dynamically at render time. Instead of storing a fixed value, each property now accepts a function that determines the value when the control is rendered. This makes it possible to define dynamic properties even in constructors or other early execution paths without bending the architecture or bypassing caching mechanisms. Static values remain fully supported by using a delegate that simply returns a constant value. The difference becomes clear when looking at the code. Previously, a button with a static text was defined as:
new ControlButton() { Text = "Hallo WebExpress!" }
The same static value is now expressed through a delegate:
new ControlButton() { Text = _ => "Hallo WebExpress!" }
As soon as a value depends on the render context, it can be expressed directly through a delegate that receives that context, for example:
new ControlButton() { Text = renderContext => I18N.Translate(renderContext, "Hallo WebExpress!") }
This new model applies to all controls and enables a fully dynamic, context‑aware UI system that no longer requires subclassing or render overrides. The separation between initialization and rendering becomes clearer, the architecture becomes more flexible, and handling dynamic values becomes significantly simpler. Because this change affects all control components and replaces the previous property model, version 00.11‑alpha introduces a breaking change. Developers are therefore encouraged to migrate their existing code to the new delegate‑based model to benefit from greater flexibility, improved maintainability, and a cleaner structure.
The further development of this new property system thrives on community involvement and the diversity of practical experience from real‑world projects. Anyone with ideas for improvements, newly discovered use cases, or potential extensions is warmly invited to contribute. Every form of participation helps refine WebExpress, strengthen its architecture, and shape a modern, open, and collaboratively developed framework that can be used and expanded by many in the long term.

Comments
Post a Comment