4 ms·
> The other thing for which OO works much better than plain data is GUIs This cannot be further from my experience. Switching from Java/AWT/Swing to ClojureScr
by divs1210 5y ago
> The other thing for which OO works much better than plain data is GUIs
This cannot be further from my experience. Switching from Java/AWT/Swing to ClojureScript/Reagent/Re-frame has been suoer liberating.
Every GUI programmer must fiddle with reagent once:
https://reagent-project.github.io/ https://reagent-project.github.io/
- iforgotpassword 5y agoWell, you really picked the worst representative with awt/swing. I'd say Qt or even classic VB6/Delphi are great examples for OOP gui development.
- MaxBarraclough 5y agoHow about JavaFX? Swing has been old hat for years now.
- iforgotpassword 5y agoI haven't touched java gui code in almost a decade, but didn't they suddenly pull a 180 on JavaFX a few years ago?
- MaxBarraclough 5y agoNot exactly, they moved it out of the core Java standard library. The main effect of this seems to have been that many developers are now uncertain of whether JavaFX can be relied on, but it is still maintained.
- astrange 5y agoCocoa has been a great OOP-based UI framework forever. The key is that it doesn't use inheritance and has messaging (https://wiki.c2.com/?AlternateHardAndSoftLayers https://wiki.c2.com/?AlternateHardAndSoftLayers).
- jcelerier 5y ago> The key is that it doesn't use inheritance Cocoa is literally based on inheriting from NSView (which itself inherits from NSResponder) https://developer.apple.com/documentation/appkit/nsview https://developer.apple.com/documentation/appkit/nsview
- astrange 5y agoThat's if you want to make a custom view, which very often you don't. Placing default views in a window and receiving events/values from them doesn't use inheritance, instead using composition and delegate patterns. UIKit lost some of the convenience features like bindings when it shrunk to fit on phones, which might be why people got annoyed enough to invent entirely new UI frameworks.
- jcelerier 5y ago> That's if you want to make a custom view, which very often you don't. I have never seen any non-trivial software not have custom-drawn widgets - grepping for `: NSView` in my ~ gives me a few thousand matches (and it's not even a mac) > Placing default views in a window and receiving events/values from them doesn't use inheritance, instead using composition and delegate patterns. ... but you can't have composition without at least interface inheritance, and in this case you really want access to the parent methods & properties of NSView when creating your own widgets (e.g. bounds, rects, tooltips, etc) so you also want implementation inheritance.
- XorNot 5y agoI just...I really want to like Clojure, but I cannot get past the brackety notation of lisp-likes. Surely there's a way to do it where I'm not in bracket hell?
- grzm 5y agoUse tools like paredit that support structural editing. There are tools like this for all major editors. https://calva.io/paredit/ https://calva.io/paredit/
- BlueTemplar 5y agoBut you're super limited if you're trying to make a GUI inside a browser, how is this a good example ?
- divs1210 5y agoThe same technique can be used outside the browser with Clojure + JavaFX [0] and even at the terminal [1]! [0] https://github.com/cljfx/cljfx https://github.com/cljfx/cljfx [1] https://github.com/eccentric-j/cljs-tui-template https://github.com/eccentric-j/cljs-tui-template