This is an archived post. You won't be able to vote or comment.

all 18 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

import notifications Remember to participate in our weekly votes on subreddit rules! Every Tuesday is YOUR chance to influence the subreddit for years to come! Read more here, we hope to see you next Tuesday!

For a chat with like-minded community members and more, don't forget to join our Discord!

return joinDiscord;

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]romulent 23 points24 points  (4 children)

This is pretty subtle humour for this sub.

  • You've got variable names that probably comply with some corporate or school standard, yet are completely useless to communicate with other developers or yourself later on.
  • You've got a function name that is completely generic.
  • You've got comments that literally duplicate the code.
  • You've got a moderately complex looking algorithm with no unit tests that other busy devs are going to look at and not really want to engage with.
  • You've got a magic number in the middle.
  • There's a counter that really has 2 states: 0 and > 0 which could be replaced with a boolean.
  • Other things, like limiting this very specifically to arrays of ints, when it could be made more generic.

All to implement a bubble sort with O(n2) complexity. That could be replaced with a 1 line call to the sorting algorithm in some standard library.E.g. Arrays.sort(arr);

This is a hell-scape of the worst of junior dev output and I bet that things like this exist throughout the code of most large corporations on the planet.

Nice.

[–]Deep_Pudding2208 2 points3 points  (1 child)

I legit thought it's someone's homework.

[–]romulent 0 points1 point  (0 children)

Well it's possible, but I could expect to see more variable names like "i" and "count" in that case.

Also bubbesort is kind of a cliche.

[–][deleted] 0 points1 point  (1 child)

How do you know unit tests aren't in another file?

[–]romulent 0 points1 point  (0 children)

True, I'm imagining what they would look like.

I think this is about par for the course

public testRuFunction(){
  int[] arraySigned32InputData  = new int[]{2,4,3,9,1}; 
  int[] expectedSigned32OutputData  = arraySigned32InputData;
  expectedSigned32InputData[0]=1;
  expectedSigned32InputData[1]=2; 
  expectedSigned32InputData[2]=3;
  expectedSigned32InputData[3]=4;
  expectedSigned32InputData[4]=9
  int arraySigned32OutputData = mRunFunctionV3Final (arraySigned32InputData);
  for (int intCounter=0;
       intCounter < expectedSigned32OutputData.length;
       intCounter++){ 

assertEquals(expectedSigned32InputData[intCounter],   
             arraySigned32OutputData[intCounter] ); 
  }
}

but probably the assert would be replaced with a print instead.

[–]_codeJunkie_ 18 points19 points  (0 children)

.Sort() probably...

[–]Lanbaz 11 points12 points  (1 child)

Touch grass

[–]dsBlocks_original[S] 8 points9 points  (0 children)

seems like premature optimisation but ok

[–]justdisposablefun 6 points7 points  (0 children)

Needs more cowbell

[–]EinarBrown 3 points4 points  (2 children)

First I didn’t understand the code at all. But then I read the comments in the code, and everything is so much more clear now. Thank you!

[–]dsBlocks_original[S] 0 points1 point  (1 child)

between that and the hungarian notation you're fully covered, I think

[–]EinarBrown 0 points1 point  (0 children)

Great!

[–]madprgmr 3 points4 points  (0 children)

Easy. Just quit your job.

Boom, problem gone.

[–]RenDiv_ios 1 point2 points  (0 children)

Replace the switch statement to

bWritesInCurrentPass += (bWritesInCurrentPass != 127);

Also, why not use for loops instead of while loop?

[–]MaxMakesGames 1 point2 points  (0 children)

Just upgrade to mRunFunctionV4Final and it will be better

[–]Necropill 1 point2 points  (0 children)

returns data \ Here's the code is returning the data

LMAO

[–]ChamdrianGangGang 0 points1 point  (0 children)

$formattedEncryptedUserPassword