Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best practices on separating debug/developing code java/javafx

I am working on a game in JavaFX and I'm sending people the compiled game once in a while for them to try out. As I'm still in the middle of developing it, I have several pieces of code intended solely for developing/debugging.

One example is a gamespeed slider that is of great use for me while testing, but it is VERY buggy and can only be used in a specific manner - in other ways, I don't want code like that in the test releases.

What is the best ways of removing such code?

  • Surrounding the code with if(Config.DEBUG) (setting a parameter in code) ?
    • Using if() but setting parameter in different build configurations?
  • Can SVN branches keep sort of code like this? Or should I change to Git?
  • Is there any way to use annotations for this?
like image 415
Vargen Avatar asked Mar 16 '26 22:03

Vargen


1 Answers

SVN branches can be used for this, but you keep ending up with the effort of having to merge your branches every so often. I wouldn't do this.

Though perhaps not wildly elegant, I'd go for your first suggestion: Put a configuration parameter somewhere that your build process can change it for you automatically, and if()s around the affected code.

Change your build process so it will create player jars and testing jars at the same time.

like image 65
Carl Smotricz Avatar answered Mar 18 '26 12:03

Carl Smotricz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!