Is it a serious mistake to keep the floor like a line?



  • I have a floor in Person class. Now I'm keeping a line "муж" and "жен"♪ Should we make a list?

    In general, I understand that the list is better. If I had a text field for sex entry, it would avoid a mistake. Like if the user had injected "муж" Russians, and the keyboard is English, the base would have been hit. "ve;" But I' two. JRadioButton♪ So the floor will definitely be either. "муж" or "жен"♪ In this situation, I guess it doesn't matter how to store, enumerate or row, right?



  • Java-code likes semantic and value-type. Always better enum, string literature, coded.

    Tonight, you're just... "муж" and "жен"coming from JRadioButton♪ Tomorrow, you want to add in two classes a check of the value and put it in there. if (value == "муж")♪ After tomorrow "муж" and "жен" Added "не определился"♪ Then they'll add checks in three more classes. And in a while, for some reason, you'll need to be replaced. "муж""мужской""жен""женский"♪ Or compare every floor with additional metadata. There's something you're going to be happy that you have one enum that you can control the permissible multitude of Poles.


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2