Skip navigation.
Home
That which cannot be rendered in binary is by definition a delusion
 

Every Bunny Loves some Bunny Sometime

This is my first brush with JavaFX. I wanted to see if I could create a simpple ecosystem (predation, reproduction and hopefully a little natural selection) usinf JavaFX.

Before I dive into the code some cautiionary notes:

  1. The compiler will blow up -- early and often. I don't mean that it will reflect your errors with nice line number indicated error messages, though that happens once in a while -- I mean it will utterly fail with no indications as to where or why you caused it to fail. To get around this -- compile VERY OFTEN. even better, use subversion to allow you to track and revert changes -- the NetBeans IDE will integrate nicely into subversion.
  2. Don't try to overload constructors in custom classes -- it will cause compiler breakage and its against the nature of JavaFX anyway. Initial conditions should be set via the create utility.
  3. Every method returns its last value; make sure that there is a definitive and consistent return type at the end of each method. I.e.,
    public function foo()
    {
        a = 2;
        b = 3;
        if (a == b)
        {
            a;
        }
        else
        {
           true;
        }
    }
    
    

    will confuse and break the compiler.

  4. JavaFX supports multiple extension -- therefore, delegating to parent constructors will not work, even if you only use single extension.

  5. Don't attempt to modify a sequence inside a for(a in sequence) loop. I know -- seems obvious, but.

  6. Avoid unnecessary type hinting. Only specify type when you are creating overloaded methods.

  7. The create() codeblock will execute after a custome node instantiation ( and therefore can overwrite any settings established inside the new Foo { .. }

more to come...

Post new comment

  • Allowed HTML tags: <a> <p> <span><small> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <embed> <object> <param> <strike> <caption>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options