r/JavaFX • u/ThreeSixty404 JavaFX Dev • Oct 09 '24
I made this! Feedback Request: ArchitectFX - A Modern JavaFX View Builder
Hello everyone,
I'm Alex (aka palexdev), and today I'm here to ask you some feedback about my latest project.
Overview
ArchitectFX aims to replace SceneBuilder for quickly building/prototyping JavaFX views It's not intended to be an exact clone, but the core functionality should be pretty much the same. The goal is to have a flexible and customizable tool with an elegant and modern UI, which offers equal support for JavaFX and third-party libraries. (By the way, progress is tracked on Trello)
Current Focus
Given the project's scale, my current focus is not to offer the functionalities of an editor such as SceneBuilder, but rather a mode that doesn't allow direct edit. This mode (which I still don't know how to call, “Live Preview” perhaps?) would just parse the view from a file and shows it to the user. By changing the document, the preview auto-reloads. It's designed for a split-view setup, where you have your editor on one side and ArchitectFX on the other. I just finished implementing the document loader, which leads us to…
One key difference
Unpopular opinion warning, please don't blast me: XML sucks, I hate it so much you have no idea. Which is why ArchitectFX does not use FXML to define views, but rather YAML. It may not be ideal for tree structures of this kind, but I like the concise syntax.
I called this format: JDSL (Java Deserialization Language). While it's true that I'm developing this format specifically for this project, I'm also quite confident in saying that with some minor adjustments it could be used to recreate any kind of Java object. Check this test document for a preview of its capabilities.
Tests
I did not run extensive tests on performance, all I can say is that JDSL appears to be 2/3 times slower in loading the same FXML view I posted above. I’m working on parallelizing some tasks to improve the situation, but this part of the code is still experimental and untested. That said, JDSL is a bit more powerful and flexible than FXML, you can literally call methods and build objects with factories lol.
The Community
This project is fairly complex, especially considering that I'm relatively new to some of the techniques and mechanisms used ArchitectFX (for example reflection, class loaders, I have never worked with them before). I would really appreciate receiving some constructive feedback about the current work and the format. If you have some spare time, it would be great if you could either:
- Try converting some of your views in JDSL, loading them and report back for pros and cons, issues and whatnot.
- Inspect my code for bad patterns, potential fixes and improvements. Report back or…
- Contributions would be extremely valuable. After all, ArchitectFX is a tool built by the users, for the users.
I’m eager to hear your feedback. Thanks in advance for your time and insights!
— Alex
18
u/pron98 Oct 09 '24 edited Oct 09 '24
You may want to reconsider. Not only does XML have a lot of parsers and excellent editing tools, but it has staying power if only because a variant of it, HTML, is the #1 markup language for GUIs and there's no second place (YAML certainly doesn't enjoy a better reputation). Most people who use markup to describe GUI are used to working with something that's HTML-like.
If you just want to work on a project that reflects your personal preferences and allows you to learn and experiment -- do what you like. But if you want to maximise its chances of success (or at least not place more impediments to success), it's best to only go against the grain when you absolutely must, considering the preferences of your intended target market over yours (especially since you don't have an established user base). It's not a matter of criticising your personal aesthetic preferences only your priorities if success is your goal.
Java's entire concrete surface syntax draws mostly on C and C++ not because its original designers liked it, but because they correctly realised that it would increase Java's chances of success, and insisting on a "better" surface syntax is not the hill to die on when success is the goal. Similarly, when we recently added another markup language to JavaDoc, we didn't pick Markdown because we thought it was the best but because it so clealy dominates all other text markup languages (for similar purposes).
4
u/[deleted] Oct 10 '24
This sounds really good, but I'm not about to lock a project in to using the FXML replacement format you've made for this project, since that means if you stop developing the project then my project dies too.
Also, I don't love FXML, but for what it is, it's fine. I don't love HTML either, but it's a perfectly functional language that doesn't really need replacing.
3
u/_INTER_ Oct 09 '24
Better yet, abstract the logic / parser so that any format can be plugged.
4
u/BlueGoliath Oct 09 '24 edited Oct 09 '24
Task :javadocsrc\main\java\io\github\palexdev\architectfx\model\Document.java:33: warning: no @param for root public record Document(It doesn't even build. And can people stop using Gradle.
2
u/jvjupiter Oct 10 '24
Perhaps instead of YAML, you should resurrect JavaFX Script. It’s declarative and looks like SCSS and QML.
1
u/dhlowrents Oct 10 '24
Hi,
You're link doesn't work https://github.com/palexdev/ArchitectFX/blob/main/src/test/resources/assets/TextFields.yaml
The idea of having a different format is kind of cool! One of the concepts of separation of concerns in JavaFX is to be able to use other formats than FXML.
Can you provide better instructions on how to run this? I got gradle setup (which sucks btw Maven is much simpler)
WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @27d6ac28'
Caused by: java.lang.NullPointerException: Cannot invoke "java.net.URL.openStream()" because "url" is null at io.github.palexdev.architectfx.yaml.YamlLoader.load(YamlLoader.java:104)
Why is the Launcher in the test package? - that should be for unit tests...
1
u/Frosty_Garden6755 Oct 10 '24
Add converting from the declarative design language to Java Code i.e FXML, YAML, JDSL, etc to Java Code
3
u/hamsterrage1 Oct 11 '24
Everyone probably knows that I'm not a SceneBuilder/FXML user. But as a professional programmer with decades of experience I feel I can weigh in with some conceptual thoughts about this project...
I find this to be a less than compelling reason for this project. SceneBuilder is just a programmers tool, so an "elegant and modern UI", seems like a low priority to me. I don't care what colour the handles of my screwdrivers are, (unless they're Robertson screwdrivers, where the handle colour indicates the size of the bit), and I'm not sure why I'd need an "elegant" interface for SceneBuilder.
Is there a demand for an "elegant and modern UI"?
This is even less compelling, troubling even. Abandoning FXML as the storage/interchange format ditches any hope of compatibility with SceneBuilder and it's output, and the existing in-code ecosystem supporting it.
And the thing is, if SceneBuilder is doing its job, you should never, ever have any reason to look at the FXML.
Somewhere else, the OP says that his YAML format allows for extended functionality. This worries me a bit. SceneBuilder is a "layout creator", and that's a fairly limited scope - which is a good thing. As a matter of fact, if your intention is to use FXML as the "View" in MVP, you have to avoid using a fair number of the features of FXML to keep your View a totally passive/dumb layout. Not that you should waste time with MVP, but just to make a point.
At some point, your layout generator output has to intersect with real Java code in order to work - and this is, IMHO, where SceneBuilder or anything like it falls flat. Because the entire ecosystem absolutely encourages excessive coupling and a bunch of bad programming practices.
It feels to me that if you try to load more functionality into your layout designer, that you'll just make this situation worse.
The question about whether developers are going to want to hitch their applications to a third party tool/library which may, or may not, continue to develop is most probably a, "No".
JFX23 has a new property added to
Labeled. It's calledtextTruncatedand it's aReadOnlyBooleanPropertythat tells you if the text in aLabeledsubclass - likeLabel- has been truncated. I went and looked at the changelog for SceneBuilder 23, and there's no mention of this new property. I don't know if they plan to support this newPropertyor not, or if they just haven't gotten around to it. I assume that they'll add it if they feel that it's relevent to layout design.But this is the kind of ongoing support that you'd need to commit to before programmers are going to want to switch from SceneBuilder.
And that's where I think that the decision not to support FXML is going to kill this project - at least as far as being a viable tool that other programmers are going to want to use. Because if you can't easily flip back to SceneBuilder when the project gets abandoned and ultimately out of date, you're screwed.
4
u/_INTER_ Oct 09 '24
How about abstracting the logic / parser so that any format can be plugged.
3
u/OddEstimate1627 Oct 10 '24 edited Oct 10 '24
Application / UI
testRuntarget in the gradle file, but that doesn't work due toapp.TestAppnot being available.app.Launcherfrom IntelliJ fails due to a missing resource (assets/TextFields.yaml)Overall Goal
Format
1
u/brunocborges Oct 10 '24
YOLO
1
u/chokebtc Oct 13 '24
Are you going to create the java class based on descriptive UI? One problem that fxml has is that it is slower for rendering than defining the layout in a class.
2
u/[deleted] Oct 09 '24
[removed] — view removed comment