I'm trying to make an application in javafx but i'm having trouble with choosing the right variable types. I'm rather new to Object oriented programming and the application would have to display a bunch of variables of personnes in a tableView. Afterwards i will do alot of calculations with these variables. The problem is that i started with normal variables like strings, int's and arrays. It worked fine but now that i'm trying to display them in a table view it gets very complicated and i'm not sure if i used the right types. I've seen some other people use Stringproperties and other funky stuff but then i would have to change all my code. Are these types better to use and why? And is there a general rule to follow when your building your main data class so that you can avoid these problems? Are there important things you should take into account when building your main structure?
Here is some code of how i did it right now:
//this class would be used to store the choices of every leader.
//It then can be used to make the best possible distribution for next year.
public class Leiding { //leiding => scouts leader in dutch ;)
private static final AtomicInteger count = new AtomicInteger(0);
private int id = 0;
private String naam;
private Leiding[] voorkeurleiding = new Leiding[3]; //3 prefeerd other leaders (from 1 till 3)
private Leiding[] afkeurleiding = new Leiding[3]; //3 disliked leaders
private Tak[] voorkeurTak = new Tak[3];
private Leiding relatie;
private int score;
public Leiding(String naam, Leiding relatie){
this.naam = naam;
this.relatie= relatie;
this.id = count.incrementAndGet();
}
public Leiding(String naam){
this.naam = naam;
this.id = count.incrementAndGet();
}
public String getNaam(){return naam;}
public void setNaam(String naam){this.naam = naam;}
public boolean checkNaam(String naam){ return this.naam == naam;}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getScore() {
return score;
}
...
}
Sorry if this question is too broad but i found it hard to find a cleary answer to this and i have a feeling that these things are related.