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
Current bridge layer & framework itself is not easily extensible via implementing interface. Nette Application itself defines few interfaces, but their design, naming and usage inside the framework is not good.
SnippetBrige contains non-trivial logic, which shouln't be probably in "bridge". Morover, it somehow works with component tree model & IRenderable, but accepts only Control.
IRenderable - somehow it says from its name, that it decides if something will be renderer. However, in the code, isControlInvalid() is used only in AJAX mode, moreover, the second methods is used only with snippets, which makes maily (but not exlusively) sence with snippets names, which are in fact not defined in interface!!! and are marked as optional arguments in control.
Bridge - TemplateFactory also sctrictly accept only Control or null, though, almost no functionality in the factory depends (directly) on it.
Possible solution:
Decouple UI control & link creation. (eg. macro {link} won't be call on object of UIControl.) This should be handled in a different way. I can imagine that some tree structure should be injected into template, and link macro will reuse it, but it should be done in different time and place.
Possible rename IRenderable to IControl, add proper methods for snippets functionality and proper method naming (isInvalidControl vs redrawControl). Eg.
Store snippetMode in snippetBridge, or just outside the Control. If the whole logic is in SnippetBridge::renderChildren(), there is no need to have it in Control.
Rename SnippetBridge::renderChildren() to SnippetBrige::render(). There is no need that SnippetBrige should now about some tree structure, it has nothing to do with snippets.
Move the tree traversal logic of isInvalidControl outside the Control. The logic is currently copy-pasted in SnippetBridge::renderChildren() and could be probably somehow unified in this bridge, or better, extracted to some helper hlass which will do the traversion for IComponent & IContainer.
Basically, let all parts of SnippetBrige, TemplateFactory etc. work with IControl.
It's just a quick bugreport (which took several about hour to write and some others to go through the code), maybe there are some better solutions, the general, or just for some mentioned poits.
I believe it's possible to do it with minimum BC breaks.
The text was updated successfully, but these errors were encountered:
Current bridge layer & framework itself is not easily extensible via implementing interface. Nette Application itself defines few interfaces, but their design, naming and usage inside the framework is not good.
SnippetBrige contains non-trivial logic, which shouln't be probably in "bridge". Morover, it somehow works with component tree model & IRenderable, but accepts only Control.
IRenderable - somehow it says from its name, that it decides if something will be renderer. However, in the code, isControlInvalid() is used only in AJAX mode, moreover, the second methods is used only with snippets, which makes maily (but not exlusively) sence with snippets names, which are in fact not defined in interface!!! and are marked as optional arguments in control.
Bridge - TemplateFactory also sctrictly accept only Control or null, though, almost no functionality in the factory depends (directly) on it.
Possible solution:
Decouple UI control & link creation. (eg. macro {link} won't be call on object of UIControl.) This should be handled in a different way. I can imagine that some tree structure should be injected into template, and link macro will reuse it, but it should be done in different time and place.
Possible rename IRenderable to IControl, add proper methods for snippets functionality and proper method naming (isInvalidControl vs redrawControl). Eg.
Store snippetMode in snippetBridge, or just outside the Control. If the whole logic is in SnippetBridge::renderChildren(), there is no need to have it in Control.
Rename SnippetBridge::renderChildren() to SnippetBrige::render(). There is no need that SnippetBrige should now about some tree structure, it has nothing to do with snippets.
Move the tree traversal logic of isInvalidControl outside the Control. The logic is currently copy-pasted in SnippetBridge::renderChildren() and could be probably somehow unified in this bridge, or better, extracted to some helper hlass which will do the traversion for IComponent & IContainer.
Basically, let all parts of SnippetBrige, TemplateFactory etc. work with IControl.
It's just a quick bugreport (which took several about hour to write and some others to go through the code), maybe there are some better solutions, the general, or just for some mentioned poits.
I believe it's possible to do it with minimum BC breaks.
The text was updated successfully, but these errors were encountered: