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:
- 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.
- 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.
- 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.
-
JavaFX supports multiple extension -- therefore, delegating to parent constructors will not work, even if you only use single extension.
-
Don't attempt to modify a sequence inside a for(a in sequence) loop. I know -- seems obvious, but.
-
Avoid unnecessary type hinting. Only specify type when you are creating overloaded methods.
-
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