45
6502
5y

Previous developers read entire result of a SELECT into array of arrays.

Then used that later on in the following fashion.

print "name: " + result[row][17]
print "address: " + result[row][23]
...
without any description whatsoever what the numbers mean.

And it's here "result" and "row", in the actual code it was "arr" and "ii".

And these arrays were "public static" used everywhere, but initialized only at few places, so if you went onto wrong screen or if there was a phone call that kicked the app out it crashed.

But real fun began when people started changing queries and altering tables...

I seriously thought I was being pranked as a new hire.

Comments
  • 7
    I will pray for you 😔
  • 2
    for keeping a list of customers with associated data in local memory it's not all bad...

    well it is if it isn't documented, and it'd still be a lot better if it was a list<customer> or somesuch instead. the initializations also sound wonky, as does changing calls and tables instead of making new ones or operating around the existing tables in other ways...

    very funky overall. you still there?
  • 5
    Godspeed
  • 4
    @ArcaneEye In fact, I still am and it's not that bad.

    After persistence of these arrays in memory was resolved so app doesn't crash randomly, there was a grousome task of fixing all of the magic number references everywhere and making them be in sync with queries.

    App depended on things like "show map at (value[13], value[14]) which worked most of the time, but sometimes crashed when a string value came in for that field, or it worked incorrectly when a number of a different kind was there instead of lat or long.

    Those were really unpleasant 2 months, however app became stable enough to ensure further biz financing, at which point we discarded all of it and rewrote the whole damn thing from scratch.
  • 4
    @6502 well i guess congratulations are in order :)

    all 16 hours "clean coding with uncle bob" should be mandatory for anyone working with code... the things we woulden't have to deal with if people _cared_...
  • 2
    I find "result" the single laziest variable name anyone can use.
  • 0
    Please use %s ...
  • 0
    @uselesshero i find myself doing it if i make short methods that just need to take a variable, do something and return something. especially if i'm using stringbuilder or have to iterate for-loops over an array to sort something out or tasks like that where you can't just "return [algorith] but need a variable to keep or collect parts of the returned object.

    i find it rather exact in its' naming when used in such instances - the above seems to not be one of those.
  • 0
    @ArcaneEye Sure, I use it too. I agree.
Add Comment