How test UI elements / get ServiceLoader working?
-
@RaiNova I had an ulterior motive to want a well done view-model design, specifically as a good pattern for UI classes going forward and to retrofit the existing.
Check out this PR which adds one. Of note is how the UI-controller logic is tested: https://github.com/triplea-game/triplea/pull/9665/files#diff-73b2a24d2079dcf7d0b19c8777110b46bbe56a5e97fc9e4e41c875f7b98671cd
-
@lafayette Thanks for pointing me to your PR and giving me an impression how your idea regarding "Presentation Model" can be realized in TripleA! When you pointed me to "TripleA 3.0 - Design Proposal & Discussion", I read your idea to modernize TripleA by moving from Swing to JavaFX. That was a main driver to me writing "How does TripleA 3.0 have to be to attract such a community?" and
3. Technology
- How much is TripleA about the end user product and how much about playing with technology?
- Which technologies do we want to play with?
- Shall we go web?
I am a fan of Google trends, so I looked up some UI technologies:
I recommend a discussion about the questions I posted in "TripleA 3.0 - Design Proposal & Discussion" first, then a choice of candidate technologies and a selection based on how they support a developer community and how they support design patterns and best practices that could further our goals.
Lacking such a discussion, I will have a deeper look into React. I will have your "Presentation Model" in mind as well as UI testing. I am happy to let you know my impressions and hear your opinions about them. First I have to do some programming for work (Kotlin and JavaFX including JavaFX Robot btw). Then I'll finish my PR (I am already testing to make sure my changes don't affect other use cases of UnitChooser). Then I'll look into React. (Or not - depending on what else comes up in my programming interests or my life in general.)
-
@lafayette With all the little technical issues that held me up, I can‘t say I took a dive into react, but only a glance. These are my impressions, and I would be happy to learn your pov about it:
React is technologically so far away from TripleA, that I can‘t see a convincing migration path towards it. However, it taught me some design promising principles:- There are not one but two languages for presentation models on two levels:
++ one level oriented towards the rendering engine (e.g. DOM for HTML or react-three-fiber for three.js); for simplicity I‘ll call it the DOM
++ a domain specific level - the presentation model languages are embedded in the host programming language (typically jsx-Tags which are transpiled into JavaScript; I also found a Koltin-solution using annotations, see React Functional Components with Kotlin/JS). This embedding significantly reduces the amount of code necessary only because a programming language in itself doesn‘t support a particular concept well (do you call that scaffolds?)
- both presentation models are trees
- the render method of the root of the domain specific model updates the DOM
- the render method of each node of the domain specific model calls the render methods of its children and inserts any number of elements into the DOM
- the engine does not directly render the DOM, but compares it with the DOM of the previous render and renders only the differences
This two level presentation model should lend itself nicely to automated testing.
Do you think, these concepts could be introduced into the next generation of TripleA UI? Ontop of which UI technology? Can you imagine something more topical and more attractive to potential new programmers than JavaFx?
- There are not one but two languages for presentation models on two levels:
-
@rainova said in How test UI elements / get ServiceLoader working?:
Do you think, these concepts could be introduced into the next generation of TripleA UI? Ontop of which UI technology? Can you imagine something more topical and more attractive to potential new programmers than JavaFx?
All of those require huge efforts. 3.0 is in some ways a necessary stepping stone before we can do anything else. Our effort to migrate to JavaFX failed because the UI code is too coupled and too tangled to logic and is inseparable.
There is a lot of UI code. Re-writing it is a larger effort than the initial write by an order of magnitude.
As far as adopting concepts from React, IMO we should be looking to 'reactive UI' principles to help. FWIW the new UI event queue is a step squarely in that direction.
-
@lafayette, @ssoloff, @trevan, all other developers: What are your thoughts about attracting developers? What made developers join in the past? What made them leave? Would you see making Triple A attractive for developers as an objective? Would you consider this achievable? (In that case I might start a discussion thread.)