I think my message drowned, so I'll repost - hope ...
# tornadofx
s
I think my message drowned, so I'll repost - hope that's ok:
Hi everyone! Soo, you seem to just use the normal read/write properties for data classes. Can’t that lead to some issues? The flux idea (similar concepts are available), where there’s only one class that can update the data, seems more structured. That way the whole encapsulation also makes more sense to me.
I’ve written some code with read only properties (objects and primitives / not sure about lists and maps), but what’s your view on it as (more) experienced programmers?
👍 1
r
..., but what’s your view on it as (more) experienced programmers?
Do you mean in general or specifically with regard to TornadoFX? If you want TornadoFX specific, @carlw's answer is top. If you mean in general, well, it depends. Flux, MVC, MVVM, <insert architecture here> can be great and solve various problems, but that doesn't make them universal solutions to every problem (which is why there are so many at all).
s
Well, I imagine either way, if your data class has openly accessible setters, that might make it harder to keep an overview. Or have you made a different experience?
r
It depends on the complexity of the app. For a number of quick utilities I've made (especially for work), keeping all the possible states and interactions in your head is simple enough to guarantee the logical flow, so wrapping it in some architecture just add needless complexity and cognitive overhead. If TornadoFX forced some such architecture, those kinds of simple utilities would be a PITA.
As the complexity grows, I think it's important to let the user decide what architecture they want to use. Usually the various architectures have more in common than they do different, and TornadoFX comes with a number of components that are abstract enough to build up most of them (Controller, ViewModel, Command, EventBus, etc.)
I'm not at all against including helpers to make the different ideologies easier, just against imposing them on the users.
s
Yeah, I wouldn't want to force anyone to go one way or the other, just add ways to make them easier.
👍 1