Skip to content

Commit 1d977f1

Browse files
committed
Update readme
1 parent 4168b07 commit 1d977f1

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ pattern. Examples of components include tabs, dialog windows, toolbars, image vi
1515
* [Component Structure](#component-structure)
1616
* [Component Lifecycle](#component-lifecycle)
1717
* [Component Hierarchy](#component-hierarchy)
18+
* [When to Create a Component?](#when-to-create-component)
19+
* [When not to Create a Component?](#when-not-to-create-component)
1820
* [Requirements](#requirements)
1921
* [Dependencies](#dependencies)
2022
* [Code building](#code-building)
@@ -195,6 +197,23 @@ between the presentation (View) and logic (ViewModel) layers. This design ensure
195197
across the component tree without violating the Unidirectional Hierarchy Rule (UHR), as the relationships are strictly
196198
hierarchical and non-cyclic.
197199

200+
### When to Create a Component? <a name="when-to-create-component"></a>
201+
* The element has independent testable state or business logic that can exist without a View.
202+
* The element has a distinct lifecycle requiring separate initialization/deinitialization, or can be dynamically
203+
added/removed.
204+
* The element is potentially reusable across different contexts (e.g., dialogs, toolbars, multiple editor types).
205+
* Multiple closely related properties form a logical unit - grouping them into a separate component improves
206+
maintainability and reduces parent component complexity.
207+
* The element manages structural composition - it contains child components or forms an independent subtree
208+
(e.g., containers, tabs, panels).
209+
* State persistence is required - the element needs its own History to save and restore state between sessions.
210+
211+
### When not to Create a Component? <a name="when-not-to-create-component"></a>
212+
* The element’s ViewModel would contain no meaningful behavior or data - making the component redundant.
213+
* The element represents a minor visual part of the interface and does not require its own logic or state.
214+
* The element is simple enough that separating it into its own component would add unnecessary complexity rather
215+
than improving clarity.
216+
198217
## Requirements <a name="requirements"></a>
199218

200219
Java 11+ and JavaFX 19.

0 commit comments

Comments
 (0)