Activity can't really be Serializable - it's not a class that holds some value that can be written (serialized) somewhere and restored back. So you kind of abuse the Serializable interface.
|
private Button[] rightJoinButtons = new Button[GAMES_PER_HOUR]; |
It's fine, but usually a less error prone pattern is to create a class that holds all the relevant stuff for a single item and then have an array of that class. This would be pretty much ViewHolder pattern that android uses in (for example) RecycleView or AdapterView.
|
// flipDown.setDuration(500); |
beh
|
// TODO Auto-generated method stub |
beh ** 2
|
switch (games.get(i).empty_slots()) { |
Note how empty_slots doesn't follow your naming pattern for functions (that are all camelCase)
|
public class Game implements java.io.Serializable{ |
The recurrent pattern here is that everything is serializable (like, here for example, it implies that Server must be serializable too). Generally, it is best to model the classes that hold data and serialize them (for example, the Server doesn't need to be serializable, but the data it holds should be - and it makes sense - you can serialize a state of a game, but how do you serialize a list of open tcp ports? Reading number back from disk won't make them open and in the same state as there were "serialized").
A good rule of thumb is that all custom date / time code has bugs. It works in your case, but change the locale (e.q., switch to Hebrew calendar for example, and everything becomes much more difficult). Java's Data and Calendar classes (or libraries like Yoda-Time) would be much safer to use (but arguably harder to learn at first).
Amazing
README!IMO you don't need a separate https://github.com/nir-ya/Software_UX-pr1/blob/master/About file, it's less common and known.
Software_UX-pr1/app/src/main/java/com/example/cspingpong/MainActivity.java
Line 42 in 823c77b
Activity can't really be
Serializable- it's not a class that holds some value that can be written (serialized) somewhere and restored back. So you kind of abuse theSerializableinterface.Software_UX-pr1/app/src/main/java/com/example/cspingpong/MainActivity.java
Line 67 in 823c77b
It's fine, but usually a less error prone pattern is to create a class that holds all the relevant stuff for a single item and then have an array of that class. This would be pretty much
ViewHolderpattern that android uses in (for example)RecycleVieworAdapterView.Software_UX-pr1/app/src/main/java/com/example/cspingpong/MainActivity.java
Line 153 in 823c77b
beh
Software_UX-pr1/app/src/main/java/com/example/cspingpong/MainActivity.java
Line 177 in 823c77b
beh ** 2
Software_UX-pr1/app/src/main/java/com/example/cspingpong/MainActivity.java
Line 433 in 823c77b
Note how
empty_slotsdoesn't follow your naming pattern for functions (that are all camelCase)Software_UX-pr1/app/src/main/java/com/example/cspingpong/Game.java
Line 6 in 823c77b
The recurrent pattern here is that everything is serializable (like, here for example, it implies that
Servermust be serializable too). Generally, it is best to model the classes that hold data and serialize them (for example, the Server doesn't need to be serializable, but the data it holds should be - and it makes sense - you can serialize a state of a game, but how do you serialize a list of open tcp ports? Reading number back from disk won't make them open and in the same state as there were "serialized").Software_UX-pr1/app/src/main/java/com/example/cspingpong/Game.java
Line 133 in 823c77b
A good rule of thumb is that all custom date / time code has bugs. It works in your case, but change the locale (e.q., switch to Hebrew calendar for example, and everything becomes much more difficult). Java's
DataandCalendarclasses (or libraries likeYoda-Time) would be much safer to use (but arguably harder to learn at first).