In one of many Java class files of a commercially release product, so many ints.

It’s packed with so many variables, I cannot believe what I saw:

The first 100 lines:


import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.text.format.Time;
import android.util.FloatMath;
import java.lang.reflect.Array;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import javax.microedition.khronos.opengles.GL11;

public class c
  extends ac
{
  static final int[][] aM;
  static final float[][] aN;

//snipped...

   int A = 1000;
  int B;
  int C;
  int D;
  int E;
  int F;
  int G;
  int H = 12;
  int I;
  float J;
  float K;
  float L;
  float M;
  boolean N = true;
  boolean O;
  boolean P;
  float Q = -1.0F;
  float R = -1.0F;
  float S = -1.0F;
  float T = -1.0F;
  int U;
  float[] V = new float[9];
  float[] W = new float[9];
  float[] X = new float[10];
  float[] Y = new float[10];
  float[][] Z;
  bq[] a = new bq[14];
  boolean aA;
  int aB;
  int aC;
  float aD;
  float aE;
  float aF;
  float aG;
  float aH;
  float aI;
  int aJ;
  int aK;
  int aL;
  float[][] aO;
  float[][] aP;
  boolean aQ;
  int aR;
  int aS;
  boolean aT;
  int aU;
  float[][] aV;
  int aW;
  int aX;
  int aY;
  int aZ;
  float[][] aa;
  float[][] ab;
  float[][] ac;
  float[][] ad;
  int ae;
  boolean[] af;
  float[] ag;
  int ah;
  int ai;
  int aj;
  int ak;
  int al;
  int am;
  int an;
  int ao;
  int ap;
  int aq;
  int ar;
  int[] as;
  int at;
  int[] au;
  int av;
  float[] aw;
  float[] ax;
  int ay;
  int az;
  boolean bA;
  int bB;
  int bC;
  float bD;
  boolean bE;
  boolean bF;
  int bG;
  int bH;
  int bI;
  int bJ;
  int bK;
  int bL;
  int bM;
  int bN;
  int bO;
  int bP;
  int bQ;
  float bR;
  float bS;
  int bT;
  int bU;
  int bV;
  float[][] bW;
  float bX;
  float bY;
  float bZ;
  int ba;
  int bb;
  int bd;
  float[][] be;
  int bf;
  int bg;
  int bh;
  float bi;
  int bj;
  int bk;
  int[] bl;
  int bm;
  float[] bn;
  int bo;
  int bp;
  int bq;
  int br;
  int bs;
  int bt;
  int bu;
  int bv;
  int bw;
  int bx;
  int by;
  int bz;
  bq[] c = new bq[5];
  int cA;
  int cB;
  boolean cC;
  int cD;
  int cE;
  int cF;
  int cG;
  int cH;
  int cI;
  boolean cJ;
  int cK;
  int cL;
  int cM;
  int cN;
  int cO;
  int cP;
  int cQ;
  int cR;
  int cS;
  int cT;
  int cU;
  int cV;
  int cW;
  int cX;
  int cY;
  int cZ;
  int ca;
  int cb;
  boolean cc;
  int cd;
  int cf;
  int cg;
  int ch;
  int ci;
  int cj;
  int ck;
  int cl;
  int cn;
  boolean co;
  boolean cp;
  boolean cq;
  int cr;
  int cs;
  boolean ct;
  boolean cu;
  int cv;
  int cw;
  int cx;
  int cy;
  int cz;
  int da;
  int db;
  int dc;
  float dd;
  float de;
  int[] df;
  float dg;
  boolean dh;
  boolean di;
  boolean dj;
  boolean dk;
  int dl;
  bq[] e = new bq[1];
  bq[] g = new bq[2];
  final float[][][] m = { { { 0.0F, 100.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }, { 1.0F, 100.0F, 2.0F, 100.0F, 3.0F, 100.0F, 100.0F, 100.0F, 101.0F, 100.0F, 102.0F, 100.0F, 200.0F, 100.0F, 201.0F, 100.0F, 202.0F, 100.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }, { 203.0F, 100.0F, 205.0F, 100.0F, 232.0F, 100.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }, { 213.0F, 100.0F, 229.0F, 100.0F, 300.0F, 100.0F, 329.0F, 100.0F, 330.0F, 100.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }, { 222.0F, 100.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }, { 207.0F, 100.0F, 210.0F, 100.0F, 217.0F, 100.0F, 219.0F, 100.0F, 220.0F, 100.0F, 221.0F, 100.0F, 225.0F, 100.0F, 228.0F, 100.0F, 230.0F, 100.0F, 302.0F, 100.0F, 303.0F, 100.0F, 309.0F, 100.0F, 310.0F, 100.0F }, { 407.0F, 100.0F, 408.0F, 100.0F, 409.0F, 100.0F, 412.0F, 100.0F, 413.0F, 100.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }, { 231.0F, 100.0F, 304.0F, 100.0F, 421.0F, 100.0F, 422.0F, 100.0F, 423.0F, 100.0F, 424.0F, 100.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }, { 219.0F, 100.0F, 220.0F, 100.0F, 233.0F, 100.0F, 234.0F, 100.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }, { 312.0F, 100.0F, 313.0F, 100.0F, 314.0F, 100.0F, 315.0F, 100.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0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F }, { 213.0F, 100.0F, 229.0F, 100.0F, 300.0F, 100.0F, 329.0F, 100.0F, 330.0F, 100.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }, { 222.0F, 100.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }, { 207.0F, 100.0F, 210.0F, 100.0F, 217.0F, 100.0F, 219.0F, 100.0F, 220.0F, 100.0F, 221.0F, 100.0F, 225.0F, 100.0F, 228.0F, 100.0F, 230.0F, 100.0F, 302.0F, 100.0F, 303.0F, 100.0F, 309.0F, 100.0F, 310.0F, 100.0F }, { 407.0F, 100.0F, 408.0F, 100.0F, 409.0F, 100.0F, 412.0F, 100.0F, 413.0F, 100.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }, { 231.0F, 100.0F, 304.0F, 100.0F, 421.0F, 100.0F, 422.0F, 100.0F, 423.0F, 100.0F, 424.0F, 100.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }, { 219.0F, 100.0F, 220.0F, 100.0F, 233.0F, 100.0F, 234.0F, 100.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }, { 312.0F, 100.0F, 313.0F, 100.0F, 314.0F, 100.0F, 315.0F, 100.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }, { 303.0F, 100.0F, 400.0F, 100.0F, 401.0F, 100.0F, 402.0F, 100.0F, 403.0F, 100.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }, { 425.0F, 100.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F }, { 426.0F, 100.0F, 427.0F, 100.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F } } };
  int n;
  int o;
  int p;
  int q;
  int r;
  int s;
  int t;
  int u;
  int[] v = new int[2];
  int[] w = new int[2];
  int[] x = new int[2];
  int[] y = new int[2];
  long[] z = new long[2];
 

I’m really not expecting a released product to have ugly codes, unless this is the norm in the industry.

#1 the Application works (obviously, else it would not have been released)
#2 you only see the obfuscated code, so its guesswork if this is ugly code or has a very pragmatic reason to do so.

I have seen lots of very nice looking code, for projects that just dont work…

If they need all the variables, then how is that a bad thing? And like Damocles said, the code was likely obfuscated anyway. The developer problem had better formatting and variable names. As long as your code works, and the developer understands what all variables do, why does it matter how many there are?

Back in the JavaME days, very professional Game Companies tried to use as few Classes as possible,
for compatibility reasons with weaker devices.
The code looked messy from an OOP perspective, but there was a very good reason to do so.

The best solution is not the one that looks nicest (with a little flower on top), but the one that
results in the best stability of the application and understandability for the developer teams.

Plus: you have to also think about the situation that 2 or more Developers have to work simultaniously on the
same class. (that containes the redering logic or so)
In this case merging a list of altered variablenames is easier / less conflics for the sourcecontrol than merging
refactored class-files.
It really depends on the specific workflow during development.