Hot answers tagged

1

General isues Your code doesn't follow the single responsibility principle. The class WorldSimulation is responsible for updating the game and creating the graphical representation. If you followed a naming convention where the name of a class describes it's functionality it would have to be WorldSimulationAndPaint. Instead of passing the canvas and paint ...


1

Let's take a look line per line. var payloadArray: List<Byte>? = this.readBytes().toList() That's a really terrible idea. Generally you stream files using FileInputStream, or you can map files using the NIO (new I/O) interface of Java. Then you can read the bytes piecemeal. val salt = payloadArray.sliceArray(0 until 32) * Salts only have to be 128 ...


1

I can't help too much as I don't have running code, but I can at least get rid of all List and Array conversions, that will make it run faster and reduce lot of memory garbage. I also removed all the optionals as immutability is our best friend :) Is it ran once per stream and then it is closed or more than once per stream? There is no information about how ...


1

Use the android:onClick attribute to get rid of the boilerplate calls to setOnClickListener and findViewById. The giant if-else statement is very repetitive. The actions taken in all branches are assigning a value to the value variable and appending a digit to the phone number. You could convert the code to data by mapping the button label to a value and a ...


Only top voted, non community-wiki answers of a minimum length are eligible