Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

UberJumper posted:


Sigh, is there a better way to do this? I cant stop it from destroying this page.

You could put it in a pastebin, but I think it's worth it to see this poo poo in all its glory.

To be perfectly frank, I feel a lot better about some of the poo poo I've written in a rush or early in my career... nothing was ever this bad.

Also, I personally love this part:
code:
        // Roger wanted me to make sure that this cant happen if it does anyways
	String checkIT = new String(l1.VALUE())
	if(checkIT == NULL)
Did a scientist write this? I've seen some absolute poo poo come out of scientists...

Adbot
ADBOT LOVES YOU

UberJumper
May 20, 2007
woop

TRex EaterofCars posted:

You could put it in a pastebin, but I think it's worth it to see this poo poo in all its glory.

To be perfectly frank, I feel a lot better about some of the poo poo I've written in a rush or early in my career... nothing was ever this bad.

Also, I personally love this part:
code:
        // Roger wanted me to make sure that this cant happen if it does anyways
	String checkIT = new String(l1.VALUE())
	if(checkIT == NULL)
Did a scientist write this? I've seen some absolute poo poo come out of scientists...

Nope, not a scientist. It was written by a third year Software Engineering coop student from Waterloo University.(:???:)

(I don't want to go into alot of detail, since i am too a coop student, and dont want to break rules(I dont know if there are even any))

The application is an internal Government Application its basically a massive spanning :cthulhu: application that is used, to fetch some random sets of information/other stuff.

Thankfully this poo poo, is only confined within a little application that only deals with a very specific type of data. It's used maybe twice a month. But unfortunately since the system is basically :cthulhu: it interacts with other parts of the system using temporary files, and some other ridiculous things.

But realistically :cthulhu: needs to die a slow/painful death. Its terrible and probably in total is a million lines of code. This is one small part made up of around 40 odd java classes(the gently caress does it use them for) and is :suicide: to try and figure it out.

Maybe the kid never really programmed before, but gently caress come on.

:suicide:

I think i should start pushing to have an actual source repistory, with code inspections etc. Because this is ridiculous.

RoadCrewWorker
Nov 19, 2007

camels aren't so great
code:
//IF WE MADE it this far we update GLOBAL variables with new CWRAP!
//WE make sure its CWRAP.
:monocle: This cant be serious. Its an elaborate prank right?

UberJumper
May 20, 2007
woop
So i actually looked at the wrapper objects, i can see what they are for. But its just useless.

I browsed and found all the wrapper java classes, WTFGFD.

WrapperFIXED_A.java
WrapperFIXED_A.class
WrapperFIXED_B.java
WrapperFIXED_B.class
WrapperFIXED_C.java
WrapperFIXED_C.class
WrapperFIXED_D.java
WrapperFIXED_D.class
WrapperFIXED_E.java
WrapperFIXED_E.class
WrapperFIXED_G.java
WrapperFIXED_G.class
WrapperFIXED_H.java
WrapperFIXED_H.class
WrapperFIXED_I.java
WrapperFIXED_I.class
WrapperFIXED_J.java
WrapperFIXED_J.class

What happend to WrapperFIXED_F? :iiam:

:(

All the classes are identical just with a slightly difference class name. I found this comment in A Tho.

Its GOLD:

code:
/*
	JAVA IS STUPID, LET THIS BE A WARNING TO ANYONE!!!

	I MADE 9 WRAPPERS ENDING WITH LETTERS, SINCE JAVA cant make classes right. THEY ARE ALL THE SMAE!!!!!!
	
	JAVA is hirrable because I want to make 50 classes at once! It cant let me. This fails WHY? With C++ it would work.
	
	for(z = 0; z <= 100; z++)
	{
		WrapperFIXED_ + z z = new WrapperFIXED_ + z;
	}

	WHY IS THIS SO HARD??!@?! If i want 50 clases i need to be able to do it better. 
*/
:suicide:

Please someone tell me what the gently caress he is rambling about?

No Safe Word
Feb 26, 2005

I was going to post crap about a database that at first blush seemed pretty nicely normalized and set up with proper relations and such with only small hiccups in naming here and there, which upon second blush unleashes the coding horror of having datetime columns of varying lengths (some are "yyyyMMddHHMM", some are "yyyyMMdd") stored in varchar(100) fields, dollar/quantity amounts in varchar(100) fields, things that will never be more than 5 or 6 characters in varchar(100) fields, etc.



...but UberJumper pretty much topped all that :v:

McGlockenshire
Dec 16, 2005

GOLLOCKS!

UberJumper posted:

code:
/*
	I MADE 9 WRAPPERS ENDING WITH LETTERS, SINCE JAVA cant make classes right. THEY ARE ALL THE SMAE!!!!!!
	WHY IS THIS SO HARD??!@?! If i want 50 clases i need to be able to do it better. 
*/
:psyboom: does not even begin to describe the sheer concentration of WTF in this comment.

UberJumper
May 20, 2007
woop
One more before i go to bed.

This is what WrapperFIXED_A.java is made of:

(NOTE: I cut out alot of the boring stuff, because its redundant, boring and useless code, some of the other functions were given to him, he just gave them retarded all caps names)

All my comments start with >> and are bolded.

code:
public class WrapperFIXED_A
{
	public int n1;
	public int n2;
	
	/* >> Tons of other defintions crap, i've snipped it */
	
	/* >> The only private variable in the class, i didnt snip it because.... its.. hilarious*/
	// THIS MAN! PROTECTS YOU WHILE YOU CODE
	private int O_O;
	
	//* >> Uhhh okay?... moving on.
	public void foo()
	{
		
	}
	
	//* >> WHAT THE gently caress!
	public String VALUE()
	{
		String temp = new String(VALUE);
		String newtemp = new String(temp.trim());
		if(newtemp == NULL)
		{
			throw RuntimeException("VALUE IS NULL!");
		}
		else if(newtemp != NULL)
		{
			//Touppercase, can't make that NULL? RIght?
			String returnVALUE = new String(newtemp.toUpperCase());		
			return returnVALUE;
		}
		else
		{
			throw RuntimeException("VALUE IS NOT EXISTANCE!");
		}
		throw RuntimeException("ERROR");
		
		//Cannot be at this Code line so its safe to retutn Null cause we cant get that
		return NULL;
	}
	[b]//* >> Rest is boring.[/b]
}
Its kinda tame, what he is doing with strings :isam:, he did make me laugh with the private variable face man. But no...

For the retarded little minirant of his, my theory is:

for this:

for(int i = 0; i <= 100; i++){
(WrapperClass_ + i) (mywrapper_ + i) = new (wrapperclass_ + i);
}

I think that more explains it, im not sure. Looks like he wants to dynamically create 100 variables, of a 100 different classes.

I.e.
WrapperClass_1 mywrapper_1 = new WrapperClass_1();
WrapperClass_2 mywrapper_2 = new WrapperClass_2();
... etc.


Why. :iiam:

*EDIT* Boo bold doesnt work in code tags.

UberJumper fucked around with this message at 05:25 on Feb 24, 2009

Strong Sauce
Jul 2, 2003

You know I am not really your father.





That or he doesn't know how to create an array of objects :v:

Mill Town
Apr 17, 2006

What does he use WrapperFIXED_A through WrapperFIXED_J for, anyway? Why would he want 50 identical but differently named classes?

Also, unlike what he suggests... You can't do that with a loop in C++. Although there's probably some preprocessor macro fuckery that could do it :psyduck:

ColdPie
Jun 9, 2006

Mill Town posted:

What does he use WrapperFIXED_A through WrapperFIXED_J for, anyway? Why would he want 50 identical but differently named classes?

Also, unlike what he suggests... You can't do that with a loop in C++. Although there's probably some preprocessor macro fuckery that could do it :psyduck:

Hilariously, you can do it in Java, using the reflection API stuff:


Class cls = Class.forName("WrapperFIXED_" + i);
Object whateverVariable = cls.newInstance();

Mill Town
Apr 17, 2006

ColdPie posted:

Hilariously, you can do it in Java, using the reflection API stuff:


Class cls = Class.forName("WrapperFIXED_" + i);
Object whateverVariable = cls.newInstance();


Right, but the class still needs to be defined somewhere. Can you do that with reflection, too? I'd like to know! (I like reflection)

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

UberJumper posted:

One more before i go to bed.

Holy poo poo that code owns.

The horrors I run into are mostly nested #ifdefs. Boring poo poo compared to that.

e: Although at one of my earlier coding jobs I had a colleague who loved to use single- and double letter variable names. So stuff like int a = 1; int b = 1; int aa = a + b;

Wheany fucked around with this message at 10:43 on Feb 24, 2009

Richard Noggin
Jun 6, 2005
Redneck By Default

Wheany posted:

Holy poo poo that code owns.

The horrors I run into are mostly nested #ifdefs. Boring poo poo compared to that.

e: Although at one of my earlier coding jobs I had a colleague who loved to use single- and double letter variable names. So stuff like int a = 1; int b = 1; int aa = a + b;

We're working on a project right now that specifies in the coding standards that all variables must be descriptive, especially loop variables. They also have to be spelled out completely.

code:
for (int i = 0; i <= shootMe; i++) //BAD!

for (int idx = 0; idx <= fuckMeRunning; idx++) //NO NO!

for (int index = 0; index <= blargh; index++) //DO THE NEEDFUL
I can certainly understand using descriptive variable names, but you have to be a complete loving moron to require them in loops.

code:
for (int index = 0; index <= carpalTunnel; index++)
{
    for (int index2 = 0; index2 <= rsi; index2++)
    {
        //you can see where this can get confusing
    }
}
Maybe not a true coding horror, but a pain in the rear end at the very least.

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Mill Town posted:

Right, but the class still needs to be defined somewhere. Can you do that with reflection, too? I'd like to know! (I like reflection)

You could do it with CGLIB or ASM. With either you can basically class load arbitrary streams of bytecode on the fly and give them arbitrary class names so long as the class can be verified and the name is valid according to the JLS.

uXs
May 3, 2005

Mark it zero!

UberJumper posted:

:suicide:

Please someone tell me what the gently caress he is rambling about?

This reminds of what I (think I) had to do in a Cobol project for school once. I had made some wrapper code around the standard database access code you would normally use which made it a lot easier to work with.

Unfortunately I couldn't find a way to make my code work for different tables, so I had to copy the same code like 10 or 20 times with just a few lines changed for each different table. Same thing for about 20 listboxes: 20 times, basically the same code with a few lines changed.

Thinking back, there must have been a better way to do this, maybe delegate functions or something, but I didn't know how. Then again, it was Cobol, so who knows ?

Anyway, I'm fairly sure that at least my variables and functions had good names, so it wasn't all bad.

I think this guy's situation was similar to mine: not enough knowledge to make his classes the way he wanted, so "forced" to make copies of one that are only a little different.

TSDK
Nov 24, 2003

I got a wooden uploading this one

Richard Noggin posted:

I can certainly understand using descriptive variable names, but you have to be a complete loving moron to require them in loops.

code:
for (int index = 0; index <= carpalTunnel; index++)
{
    for (int index2 = 0; index2 <= rsi; index2++)
    {
        //you can see where this can get confusing
    }
}
Maybe not a true coding horror, but a pain in the rear end at the very least.
The reason why that is a horror is because 'index' is no more descriptive than 'i'.

Now if you'd have put:
code:
for ( int mesh = 0; mesh < num_meshes; mesh++ )
{
    Mesh &current_mesh = meshes[mesh];
    for ( int triangle = 0; triangle < current_mesh.NumTriangles(); triangle++ )
    {
        // Do stuff
    }
}
Then you can clearly see the extra meaning that you get from using longer variable names. If you're just going to use 'index', then you might as well be allowed to use 'i'.

Richard Noggin
Jun 6, 2005
Redneck By Default
Right. My point was that in the simple "for i = 1 to 100" cases, i is descriptive enough. If it isn't, then you shouldn't be loving with this code. We can't even use a variable named "numOfItems", it must be "numberOfItems". Blah blah blah modern IDEs, auto-completion and all that.

necrobobsledder
Mar 21, 2005
Lay down your soul to the gods rock 'n roll
Nap Ghost
Every time I see all those Java WTFs brought from some government programmer, all I have to imagine is how horrible the C/C++ version of that would become and my brain crashes and reboots.

TRex EaterofCars posted:

You could do it with CGLIB or ASM.
Given the quality of work we've seen from this individual, I would strictly advise them to not use either of those two to avoid blowing the gently caress out of their system in a pile of gibberish.

mr_jim
Oct 30, 2006

OUT OF THE DARK

UberJumper posted:


code:
/*
	JAVA IS STUPID, LET THIS BE A WARNING TO ANYONE!!!

	I MADE 9 WRAPPERS ENDING WITH LETTERS, SINCE JAVA cant make classes right.
	THEY ARE ALL THE SMAE!!!!!!
	
	JAVA is hirrable because I want to make 50 classes at once! It cant let me.
	This fails WHY? With C++ it would work.
	
	for(z = 0; z <= 100; z++)
	{
		WrapperFIXED_ + z z = new WrapperFIXED_ + z;
	}

	WHY IS THIS SO HARD??!@?! If i want 50 clases i need to be able to do it
	better. 
*/
:suicide:

Please someone tell me what the gently caress he is rambling about?

It looks like he's confusing classes and objects. He wants 50 objects of the same class, but he thinks classes and objects are the same thing so he makes 50 identical classes instead.

Unless he's gotten the class/object distinction right in the rest of the code, in which case I have no clue what he's going on about. :psyduck:

Also, JAVA is hirrable. :downs:

slipped
Jul 12, 2001
And I was angry at choosing western over waterloo. I guess the difference in education does not play that much of a role hahah.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Richard Noggin posted:

code:
for (int index = 0; index <= carpalTunnel; index++)
{
    for (int index2 = 0; index2 <= rsi; index2++)
    {
        //you can see where this can get confusing
    }
}
Maybe not a true coding horror, but a pain in the rear end at the very least.

Short loop variables can be descriptive, though. For example using y and x instead of, say, the traditional i and j:
code:
for(int y=0 ; y<height ; y++)
{
    for(int x=0 ; x<width ; x++)
    {
        rgb[y*width+x]=whoa(x,y);
    }
}
Of course variable names such as theXCoordinate are dumb as hell.

Confession: I just made a program last week where I used variables int Δx and int Δy. Because I could. I copy-pasted the delta-character every time.

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

Wheany posted:

Short loop variables can be descriptive, though. For example using y and x instead of, say, the traditional i and j...

Of course variable names such as theXCoordinate are dumb as hell.

Meh, any programmer should have taken at least one statics course and thus grok i, j and k

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

Otto Skorzeny posted:

Meh, any programmer should have taken at least one statics course and thus grok i, j and k

Yeah but i, j, and k (with hats at least) are unit vectors, not displacements along an axis, as x, y, and z often are.

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

Avenging Dentist posted:

hats

Yesssssssssssssssssssssssss this whas the best part of intro to engineering analysis

Zombywuf
Mar 29, 2008

Richard Noggin posted:

Right. My point was that in the simple "for i = 1 to 100" cases, i is descriptive enough. If it isn't, then you shouldn't be loving with this code. We can't even use a variable named "numOfItems", it must be "numberOfItems". Blah blah blah modern IDEs, auto-completion and all that.

The real horror is camelCase.

TheSleeper
Feb 20, 2003

Zombywuf posted:

The real horror is camelCase.

Don't start this.

Zombywuf
Mar 29, 2008

TheSleeper posted:

Don't start this.

Have I mentioned Emacs recently?

p.s. Today I discovered that C-M-h C-w will kill the function the point is in :-)

Inverse Icarus
Dec 4, 2003

I run SyncRPG, and produce original, digital content for the Pathfinder RPG, designed from the ground up to be played online.

Zombywuf posted:

The real horror is camelCase.

Last night in Warcraft I was joking around with some friends in raid chat and spat out "Klaatu.shutUp();". Little did I know that the C programmers would start a jihad on "Javaboy".

Ciaphas
Nov 20, 2005

> BEWARE, COWARD :ovr:


Wait, what's wrong with camel case? Have I been doing it wrong again? :(

spiritual bypass
Feb 19, 2008

Grimey Drawer

Ledneh posted:

Wait, what's wrong with camel case? Have I been doing it wrong again? :(

The only thing that's wrong is neckbeards with no social skills criticizing everyone who doesn't do things their way.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Ledneh posted:

Wait, what's wrong with camel case? Have I been doing it wrong again? :(

The scheme you use to handle variable names with multiple words is by far the most important factor for determining how good code is, and you're using the wrong one.

Zombywuf
Mar 29, 2008

royallthefourth posted:

The only thing that's wrong is neckbeards with no social skills criticizing everyone who doesn't do things their way.

I'm sorry, I seem to have wandered into the "Get butthurt about people not liking the way I code" thread. Can you please direct me to the thread about taking the piss out of code?

dancavallaro
Sep 10, 2006
My title sucks

Zombywuf posted:

I'm sorry, I seem to have wandered into the "Get butthurt about people not liking the way I code" thread. Can you please direct me to the thread about taking the piss out of code?

You kind of started it by getting butthurt about camel case...

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...

Zombywuf posted:

I'm sorry, I seem to have wandered into the "Get butthurt about people not liking the way I code" thread. Can you please direct me to the thread about taking the piss out of code?

Uh, naming conventions that are not patently insane are not coding horrors.

For example, if he had named it it_nm_dx then perhaps you could say that was the real horror.

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
Behead those who say K&R is a violent religion

click

McGlockenshire
Dec 16, 2005

GOLLOCKS!

Otto Skorzeny posted:

Behead those who say K&R is a violent religion

Durka durka One True Brace Style jihad! :jihad:

Zemyla
Aug 6, 2008

I'll take her off your hands. Pleasure doing business with you!

UberJumper posted:

code:
	/* >> The only private variable in the class, i didnt snip it because.... its.. hilarious*/
	// THIS MAN! PROTECTS YOU WHILE YOU CODE
	private int O_O;
Reminds me of that one obfuscated Perl program I saw somewhere that was made of nothing but smilies of various kinds.

But this sort of thing makes me go
code:
    int _
    ;_;

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.
This script has been in daily use since 07/13/05:
code:
# Modified to make send_all.pl taking command line parameters: host_name and AE_Title
#(i.e. Send_all.pl P035.01.1_ -h G3k3sys3 -D redactedG3k33SCP)
#
# Usage : send_all.pl [file prefix] => works as before
# 	: send_all.pl => works as before
# 	: send_all.pl [file prefix] [-h HostName] [-D AE_Title] => Take host_name and AE_Title from command line and
#								send the files with an specified prefix
# 	: send_all.pl [-h HostName] [-D AE_Title] => Take host_name and AE_Title from command line and send all files
#							from current folder
#	: send_all.pl [file prefix] [-D AE_Title] [-h HostName]
# 	: send_all.pl [-D AE_Title] [-h HostName]
...and here's how that's implemented
code:
elsif ( @ARGV > 0  )
	{
		$send_all_flag = 0;
		if( $ARGV[0] =~ /-h|-D/ )
		{
			$filename = "";
			$send_all_flag = 1;
		}
		$i =0;
		$line = "";
		while ( $i < @ARGV )
		{
			$line = $line . " " . $ARGV[$i];
			$i++;
		}
		$hTemp = "";
		$calledTemp = "";
		if( $line =~ /-h(.*?)-D/ )
		{
			( $hTemp ) = ( $line =~ /-h(.*?)-D/ );
			if( $line =~ /-D(.*)/ )
			{
				( $calledTemp ) = ( $line =~ /-D(.*)/ );
				$hTemp =~ s/^\s+//;			#strip leading space
				$calledTemp =~ s/^\s+//;	#strip leading space
				$host=$hTemp;
				$called=$calledTemp;
			}
			else
			{
					print "Missing -D in command line parameter\n";
			}
		}
		else
		{
			if( $line =~ /-D(.*?)-h/ )
			{
				( $calledTemp ) = ( $line =~ /-D(.*?)-h/ );
				if( $line =~ /-h(.*)/ )
				{
					( $hTemp ) = ( $line =~ /-h(.*)/ );
					$hTemp =~ s/^\s+//;			#strip leading space
					$calledTemp =~ s/^\s+//;	#strip leading space
					$host=$hTemp;
					$called=$calledTemp;
				}
				else
				{
					print "Missing -h in command line parameter\n";
				}
			}
			else
			{
				print "No -h or -D specified in command line parameters\n";
			}
		}		
		if( $send_all_flag eq 1 )
		{
			send_all_files();
			exit;
		}
	}
:suicide:

"Hey guys, why do I have to specify the parameters in a specific order or it ignores them all?"

In the future I'm taking the blue pill...

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Veritron posted:

[-D AE_Title]
Application Entity title? I smell DICOM!

I worked for a medical imaging company that had its own horrific (Ruby) script to generate and send DICOM files.

Adbot
ADBOT LOVES YOU

Richard Noggin
Jun 6, 2005
Redneck By Default

Lysidas posted:

Application Entity title? I smell DICOM!

I worked for a medical imaging company that had its own horrific (Ruby) script to generate and send DICOM files.
I'm just glad I had a Windows box and http://support.dcmtk.org/docs/storescu.html

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply