4 ms·
Why is this style of programming frowned upon in Javascript yet idiomatic in Flutter?
by cutler 6y ago
Why is this style of programming frowned upon in Javascript yet idiomatic in Flutter?
- BiteCode_dev 6y agoWidgets are declarative, like in HTML, the nesting is additional information. With callback hell, you nest logic, and actually obfusc information about the control flow.
- imtringued 6y agoI'm not sure what you are talking about. Javascript developers also use HTML and the ability to nest HTML elements is "idiomatic" as well.
- rkangel 6y agoThis is a wonderful answer and much better than what I was about to write. Flutter Widgets, like HTML are declarative. They're just hierarchical information. This works in HTML, and it works in Flutter - there's nothing to get confused about. Nested control flow (if statements, loops etc.) obscures the actual behaviour and so good practice is to break it up until it is clear and understandable.