Let's all have a good laugh..Java
Let's all have a good laugh..Java
Author
Discussion

theexcession

Original Poster:

11,669 posts

280 months

Friday 10th June 2005
quotequote all
Would any of you programmers out there consider this Java Exception Handling to be, short sweet and to the point?

The whole App is written like this... why do something in one line of code when you could really do it in 10... No wonder this software runs at the pace of a stoned snail with a vallium overdose.


[quote="some programmer"]
try
{
System.out.println("Launcher: Initializing Framework (Id = " + iFwkId + ")....");
framework.initSystem();
}catch(HHMEException he)
{
System.out.println("Launcher: Error in Initialization - " + he.getMessage());
StringWriter sw = new StringWriter();
he.printStackTrace(new PrintWriter(sw));
String str = sw.toString();
System.out.println("Launcher: Exception - StackTrace - \n" + str);
init = false;
}
catch(Exception e)
{
System.out.println("Launcher: Error in Initialization");
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
String str = sw.toString();
System.out.println("Launcher: Exception - StackTrace - \n" + str);
init = false;
}
[/quote]

I dispair....

best
Ex

rebelstar

1,146 posts

274 months

Friday 10th June 2005
quotequote all
I especially like the liberal use of smileys ;-)

You can always find worse code though. Have a look through www.thedailywtf.com/

TeamD

5,060 posts

262 months

Friday 10th June 2005
quotequote all
Does he/she get paid by the line?

Yes, and I know I can talk!

>> Edited by TeamD on Friday 10th June 15:35

JonRB

80,068 posts

302 months

Friday 10th June 2005
quotequote all
rebelstar said:
www.thedailywtf.com
What a great domain name! I wish I'd thought of that.

theexcession

Original Poster:

11,669 posts

280 months

Friday 10th June 2005
quotequote all
rebelstar said:
I especially like the liberal use of smileys ;-)

You can always find worse code though. Have a look through www.thedailywtf.com/


There's some good stuff there alright, however you'd have to go quite far to beat the synchronized logging method that has 20+ threads queued up to write to a file.

Not only weren't the logging messages dumped in a list for a thread safe file routine to pick up and push into the file. Nope siree, not this time, each thread wanting to log some information had to wait for the thread in front to check to see if the file existed, then open a file handle to it, log one line of text, flush the buffer, close the file handle and return out of the synchronised method allowing the next one in.

Astonishing. Reminds me of queueing for a Visa in the Emabassay in Katmandu.

best
Ex