11 Replies Latest reply: May 7, 2012 8:22 AM by David Grieve RSS

    Builder class

    Shlomo belleli
      what is the real benefit of using builder class instead of an ordinary class
      is it for a better look coding style?
      is it true that I can build my program without using any of the builder class?
      what is the different between using it or not?
        • 1. Re: Builder class
          what is the real benefit of using builder class instead of an ordinary class
          is it for a better look coding style?
          For properties, it is largely stylistic. However, for constructors, there are some real benefits:

          is it true that I can build my program without using any of the builder class?
          Yes, (AFAIK) builders are optional.
          • 2. Re: Builder class
            Builder classes are convenience classes that are based on the Builder design pattern.
            They make code more readable and understandable.
            You can develop your program without using any of the builder classes.
            • 3. Re: Builder class
              Shlomo belleli
              • 4. Re: Builder class
                Jeff Martin
                I kind of wish they were all in a separate package though, like javafx.builders. They make the javadoc API look almost twice as complicated for convenience.
                • 5. Re: Builder class
                  Richard Bair-Oracle
                  In fact, they were in javafx.builders until almost the release! The main problem with this approach is that you lose modularity -- when you use a single builder, it requires all other modules. So we could have had javafx.scene.builder, javafx.scene.shape.builder, etc. Or just co-locate the builders. We opted for the latter since they also would have package access if it ever were necessary. But the bloated JavaDoc was the side effect. We had hoped to mitigate this by taking all builders and putting them in their own section -- much like interfaces and enums in the left-column of JavaDoc.
                  • 6. Re: Builder class
                    Created http://javafx-jira.kenai.com/browse/RT-21388 "Seperate builders into their own documentation category"
                    • 7. Re: Builder class
                      Shlomo belleli

                      If I may , I will advice the Oracle team about this issue, and in general
                      don't bother to find the more styled way to give your customers / developers / community as said a better way of writing code
                      please target your efforts on things that will give us (out there in front) the tools to give our customers (the one that pays for application) a real value
                      no one will bother himself if the application or system I delivered him was written with (as an example) 1500 line or 1200 line but he will test me for the Value etc..
                      if builders are with no real value for the last link in the supply chain, then get it out, and put instead more new controls , a much easy way for deployment, a good developer guide for migrating knowledge from other platforms to javaFX
                      even from Swing, our path to dominate this new product must be easy as possible, we (the developers) and the market will not wait for another maturation process
                      I remember well , Java at 1996 with AWT, it tooks 10-15 years for Swing to be a product that one can work with, but still with deployment problem and not nice looking UI
                      please hurry and with the right tools, who cares about code styling?
                      • 8. Re: Builder class
                        I like the builders and was very happy to see them there. Kudos to the JFX team for taking the time to make them.

                        What I especially like is the ability to completely instantiate my class variables when they are declared, versus having to construct them in an initialize method or in the constructor of the class.
                        • 9. Re: Builder class
                          A better way to code is one of many ingredients that leads to better productivity (on the Developers part) which leads to better value for end users.
                          So I disagree with the post about not finding better way of coding. I think the builders are excellent, by the way.
                          • 10. Re: Builder class
                            Shlomo belleli
                            In principle I agree with you
                            But not when it is necessary to prioritize the contents of a product that comes late to market, I do not think that writing sites with HTML5 is easier , and as I mentioned earlier it is better if a product is easy, quick, precise, with less features that are double within the product, improving the style of writing can and should be at Version 3.0 , with JavaFX 1.0 -1.3 someone at SUN made a huge mistake, and now we are recovering from it.
                            take the time invested with Builders and Instead of give us Bidi controls like entry field & combox & radio button , as a start and you will expand the use of JavaFX much more, or give Linux support now, not at 2013.
                            to me it is much more Important.
                            • 11. Re: Builder class
                              David Grieve
                              You should be aware that the builders are created automatically by the build so no effort is wasted on them (except, perhaps, for occasional tweaks to the annotation processor). These builders are of great value in attaining the goal of getting more-better-faster-and-with-quality as they greatly simplify writing code. It is much easier to use RadialGradientBuilder, for example, than to remember or look up the args to the RadialGradient constructor (IMHO).