What is a Seed in Agile UI
developA Seed is a shorthand syntax (using strings or arrays) used to represent an object before it is actually instantiated. Instead of manually creating an object instance, you provide a seed that Agile UI uses to dynamically locate and load the correct class only when it is needed.
Advantages of using Seeds:
- Readability: Shorter and cleaner syntax.
- Performance: Objects are only initialized when required.
- Recursive Injection: Allows for nested property and constructor argument injection.
- Flexibility: Can be namespace-specific and allows application logic to enhance mechanics.
// Manual object creation
$icon = new Icon('book');
$button = new Button('Hello');
$button->icon = $icon;
// Using a Seed (string/array) instead of an object
$button = new Button('Hello');
$button->icon = 'book';