r/JavaFX • • 9d ago

Discussion JavaFX application by a back-end developer

https://andrej-urvantsev.statichost.page/posts/2026-11-17-javafx/
28 Upvotes

10 comments sorted by

View all comments

Show parent comment

3

u/PartOfTheBotnet 7d ago

What's the advantage?

It boils down to: "Wow, this is incredibly freeing not having to worry about bullshit wiring all over the place. If I want to add a thing, I just add it. I don't have to worry about ceremony."

Bullet points because otherwise this would be an even bigger wall of text:

  • Framework not needed in a small app. Heck, DI principles aren't needed if its a one-and-done.
  • DI principles come into play to keep code clean, extensible, easily testable.
  • Frameworks solve wiring complexity / ceremony + maintenance.

    • In turn, this makes writing features easier, as you just focus on the feature, not boilerplate connecting logic.
  • Frameworks can make writing tests with with mocking relatively easy.

    • At work in a JUnit class, I just do @Mocked IFooService foo and it hooks the creation of that type to use my mock, which I can configure with Mockito.
    • Super useful for swapping out "live" impls with stubs, like a REST client service with test-defined responses
  • Wikipedia discussion points are largely outdated, per the "disadvantages":

    • Demanded configuration: Framework dependent. Most CDI frameworks in java are fine with defaults, so nothing onerous like wiki states.
    • Tracing hard due to separated behavior / construction: Issues generally aren't because of this separation. They generally are logic+behavior problems (not DI's fault) or construction problems (your usage of DI being wrong's fault). In both cases, tracing with a debugger like IntelliJ's has never been an issue. Construction failures are generally clear. Hey, A requires B, and B requires C, but C isn't available because the C failed to initialize (Generally some failure in the class's static initializer)
    • Hindered IDE automation: Exact opposite with IntelliJ. It builds around CDI as a feature, making it rather nice.
    • Upfront effort: Depends on framework. Most of the time, this is handled by creating a project from a template anyways. Its rare for a dev to manually flesh out a full build.gradle or pom.xml.
    • Dependence on framework: For initialization of the CDI container, sure. But outside of that, basic usage can get away with standardized types like those defined in JSR-330.