bad code, bad code everywhere

Thats how i feel while reading the sourcecode of my current customer (big insurance company) http://www.quickmeme.com/meme/3tk91t/

Seriously, their code has neither performance nor maintainability.

For example: They do a DB Query, loop over the results and then, within that loop, they call a method which does the same Query again, instead of reusing the result of the previous one. Not even the SQL String is reused, its a copy & paste job! So if you change a query at one place you might forget to change it in other places too :P

Yes, thats NO joke, its really that bad, and they blame Java for it being so slow. "Optimizing" this piece of shit to get 40+ times the performance is a piece of cake here... no special skills needed, just common sense!

Edit:

Here another Example of the bad code quality: http://i.imgur.com/3sUldaK.png The above part is something i would call a toString method. The output, a comma separated String, is used to fill a textbox in a form.

The String looks like this (numbers are zeroed and address/name are faked by me for anonymizing) BLZ: 0000000, KtoNr: 0000000, BIC: 0000000, IBAN: 0000000, Land: XX, The bank name, XX-0000 MyCity, Somestreet 8

Then at some other place of the application, the value of the textbox is used as input. However they only wanted to have the bank name and city. So they split up the string by ',' and guess the position of the wanted value. Notice that not all of the values are always there and so the positions my change. So they cut out all values having a title i.e. 'IBAN:', so this remains:

The bank name, XX-0000 MyCity, Somestreet 8

Now the name always had the first index in the split and the City the second.

However some one added the persons name owning the bank account to the string:

BLZ: 0000000, KtoNr: 0000000, BIC: 0000000, IBAN: 0000000, John,Doe, Land: XX, The bank name, XX-0000 MyCity, Somestreet 8

Resulting in:

John,Doe, The bank name, XX-0000 MyCity, Somestreet 8

Thus the first index now holds the Firstname, not the bank name. As said its however not guaranteed that all values are always there, thus now the bankname could be the first or the second index.

In other words they are fucked now and suffer from the epic miss decision using this Display string for further processing instead of working with the Bank class holding each value in a separate variable.

7 comments · 81% upvoted · other discussions

comments

that_which_is_lain

If only common sense were common...

[deleted]

"Alle Werte, die einen : beinhalten, wegscheissen"

OK then. ó_Ò

Silver0ne [OP]

ja das dacht ich auch :D

jarod1701

German engineering in da house

rscarson

Add some code samples, as per the rules in the sidebar, or I will have to remove your post.

Silver0ne [OP]

Done. Added another example where posting code is easier.

The code for my first example would have been to big and spread over multiple classes.

rscarson

post re-approved :)