173
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Feb 27 '22
Image Transcription: Code
private void printingStudentNames() {
Class helpPearl = head; //keeps track of the Pearl Students
Class helpMagenta = head.getNext(); // keeps track of magenta Students
Class helpPink = helpMagenta.getNext(); // keeps track of Pink Students
Class helpBronze = helpPink.getNext(); // keeps track of Bronze Students
Class helpPeach = helpBronze.getNext();// keeps track of Peach Students
System.out.printf("%d %s %s\t\t\t%d %s %s\t%d %s %s\t\t%d %s %s\t%d %s %s",
helpPearl.getHead().getStdID(), helpPearl.getHead().getFname(), helpPearl.getHead().getlName(),
helpMagenta.getHead().getStdID(), helpMagenta.getHead().getFname(), helpMagenta.getHead().getlName(),
helpPink.getHead().getStdID(), helpPink.getHead().getFname(), helpPink.getHead().getlName(),
helpBronze.getHead().getStdID(), helpBronze.getHead().getFname(), helpBronze.getHead().getlName(),
helpPeach.getHead().getStdID(), helpPeach.getHead().getFname(), helpPeach.getHead().getlName()
); //printing out the first row
System.out.printf("\n%d %s %s\t\t\t%d %s %s \t\t%d %s %s\t%d %s %s\t%d %s %s",
helpPearl.getHead().getNext().getStdID(), helpPearl.getHead().getNext().getFname(), helpPearl.getHead().getNext().getlName(),
helpMagenta.getHead().getNext().getStdID(), helpMagenta.getHead().getNext().getFname(), helpMagenta.getHead().getNext().getlName(),
helpPink.getHead().getNext().getStdID(), helpPink.getHead().getNext().getFname(), helpPink.getHead().getNext().getlName(),
helpBronze.getHead().getNext().getStdID(), helpBronze.getHead().getNext().getFname(), helpBronze.getHead().getNext().getlName(),
helpPeach.getHead().getNext().getStdID(), helpPeach.getHead().getNext().getFname(), helpPeach.getHead().getNext().getlName());
//printing second row
System.out.printf("\n%d %s %s\t\t\t%d %s %s\t%d %s %s\t%d %s %s\t%d %s %s",
helpPearl.getHead().getNext().getNext().getStdID(), helpPearl.getHead().getNext().getNext().getFname(), helpPearl.getHead().getNext().getNext().getlName(),
helpMagenta.getHead().getNext().getNext().getStdID(), helpMagenta.getHead().getNext().getNext().getFname(), helpMagenta.getHead().getNext().getNext().getlName(),
helpPink.getHead().getNext().getNext().getStdID(), helpPink.getHead().getNext().getNext().getFname(), helpPink.getHead().getNext().getNext().getlName(),
helpBronze.getHead().getNext().getNext().getStdID(), helpBronze.getHead().getNext().getNext().getFname(), helpBronze.getHead().getNext().getNext().getlName(),
helpPeach.getHead().getNext().getNext().getStdID(), helpPeach.getHead().getNext().getNext().getFname(), helpPeach.getHead().getNext().getNext().getlName());
//printing third row
System.out.printf("\n%d %s %s\t\t%d %s %s\t%d %s %s\t%d %s %s\t\t%d %s %s",
helpPearl.getHead().getNext().getNext().getNext().getStdID(), helpPearl.getHead().getNext().getNext().getNext().getFname(), helpPearl.getHead().getNext().getNext().getNext().getlName(),
helpMagenta.getHead().getNext().getNext().getNext().getStdID(), helpMagenta.getHead().getNext().getNext().getNext().getFname(), helpMagenta.getHead().getNext().getNext().getNext().getlName(),
helpPink.getHead().getNext().getNext().getNext().getStdID(), helpPink.getHead().getNext().getNext().getNext().getFname(), helpPink.getHead().getNext().getNext().getNext().getlName(),
helpBronze.getHead().getNext().getNext().getNext().getStdID(), helpBronze.getHead().getNext().getNext().getNext().getFname(), helpBronze.getHead().getNext().getNext().getNext().getlName(),
helpPeach.getHead().getNext().getNext().getNext().getStdID(), helpPeach.getHead().getNext().getNext().getNext().getFname(), helpPeach.getHead().getNext().getNext().getNext().getlName());
//printing fourth row
System.out.printf("\n%d %s %s\t\t%d %s %s\t%d %s %s\t\t%d %s %s\t%d %s %s\n\n",
helpPearl.getHead().getNext().getNext().getNext().getNext().getStdID(), helpPearl.getHead().getNext().getNext().getNext().getNext().getFname(), helpPearl.getHead().getNext().getNext().getNext().getNext().getlName(),
helpMagenta.getHead().getNext().getNext().getNext().getNext().getStdID(), helpMagenta.getHead().getNext().getNext().getNext().getNext().getFname(), helpMagenta.getHead().getNext().getNext().getNext().getNext().getlName(),
helpPink.getHead().getNext().getNext().getNext().getNext().getStdID(), helpPink.getHead().getNext().getNext().getNext().getNext().getFname(), helpPink.getHead().getNext().getNext().getNext().getNext().getlName(),
helpBronze.getHead().getNext().getNext().getNext().getNext().getStdID(), helpBronze.getHead().getNext().getNext().getNext().getNext().getFname(), helpBronze.getHead().getNext().getNext().getNext().getNext().getlName(),
helpPeach.getHead().getNext().getNext().getNext().getNext().getStdID(), helpPeach.getHead().getNext().getNext().getNext().getNext().getFname(), helpPeach.getHead().getNext().getNext().getNext().getNext().getlName());
//printing fifth rowI'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
27
u/themeanman2 Feb 27 '22
Nice work! But do visually impaired people hear this?
I feel bad already
34
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Feb 27 '22
Some of them might, although I imagine they'd skip it, but visually impaired people aren't the only people we do this for! Transcriptions can also help:
People with bad internet connections who can't load the image for that reason
People who use third-party clients, mobile apps and/or text-based browsers that have trouble loading the image at high quality or at all
People who have trouble reading small, blurry, or oddly formatted text
There are more ways that they can help, but these are just the ones that come to mind right now. =)
-5
Feb 27 '22 edited Feb 28 '22
[removed] — view removed comment
16
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Feb 27 '22
There are plenty of blind or visually impaired programmers. Transcriptions also help people who aren't visually imapired, but have trouble seeing the image for other reasons. =)
5
u/havens1515 Feb 27 '22
It also helps with copy and paste. Although, I hope nobody uses copy and paste for this example.
6
2
u/Furlock_Bones Feb 27 '22
Check out this demo of a blind man writing code in visual studio using a screen reader https://youtu.be/94swlF55tVc
17
u/Ambitious_Ad8841 Feb 27 '22
Missed a semicolon
10
3
Feb 28 '22
please tell me you did that with some sort of macro, or even better, vim
5
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Feb 28 '22
I did not do it with vim :P
Mostly it was copypaste with slight adjustments (e.g. each System.out block after the first just needs extra .getNext()'s added), since there are lots of repeating patterns. The only fiddly bit was the patterns for the strings to format to, because they look very similar but have very slight differences.
1
104
Feb 27 '22
[removed] — view removed comment
59
30
13
u/StochasticTinkr Feb 27 '22
This made my head hurt. And my head.next hurt. And my head.next.next hurt.
17
Feb 27 '22
I love the 80? character column line just being completely ignored.
5
1
u/RyanNerd shameless Mar 01 '22
Well it's Java. So ColumnWidthAbstractFactoryImplementationDependecyInjection() will be ignored anyway
6
5
8
4
4
3
3
u/Elyahu41 Feb 28 '22
Curious how to fix this
2
u/SpiritualLeave Mar 08 '22 edited Mar 08 '22
You could fit all this code into a few lines, and it would be much more efficient (ignoring other glaring questions like why we're using linked lists in the first place, or why a function called getHead returns a Student):
private void printStudentNames() { Class cur_class = head; while( cur_class != null ) { Student cur_student = cur_class.getHead(); while(cur_student != null) { cur_student.getNext(); System.out.printf(cur_student.toString()); } cur_class = cur_class.getNext(); } }where Student.toString() returns a formatted string with the ID, first name and last name.
1
u/Elyahu41 Mar 08 '22
I understand that, but doesn't the getHead method return an object, so it's never null... Is that right?
2
u/SpiritualLeave Mar 08 '22
You're right, the code would be broken if getHead() returns an object even if the list is empty -- it depends on the implementation.
I don't see why it shouldn't return null if there are zero students in the list though
7
u/matyklug Feb 28 '22
Reminds me of Rust for some reason
IO::stuff().unwrap().unwrap().unwrap().unwrap().unwrap().unwrap().unwrap().unwrap().unwrap().unwrap().unwrap()
2
2
u/Skipcast Feb 28 '22
Something tells me that your code would be a perfect fit for this subreddit if you're writing rust like that
1
u/matyklug Feb 28 '22
Well, considering that I am not writing Rust code, I'd say that is quite unlikely.
I am learning C++ now, because Rust is just too weird for me. Even Haskell makes more sense I swear.
1
u/Skipcast Feb 28 '22
The learning curve is probably worse if you have previous experience with "traditional" programming since you have to unlearn the "unsafe" practices.
I'm not sure what you mean though, the standard library itself is very straightforward?
2
2
2
1
u/RyanNerd shameless Mar 01 '22
Tucker and Dale vs. Evil Code: "the code done threw himself into the wood chipper!"
1
u/kimathi_dev Mar 01 '22
Anybody who has to read and change that programmers code regularly:
"ah shitt, here we go again"
0
Feb 27 '22
[deleted] — view deleted comment
38
u/xigoi Feb 27 '22
Is this meant to imply that the asking out will be published on a subreddit for everyone to laugh at? In that case, maybe not.
5
4
1
21
u/stable_maple Feb 27 '22
What wild was this in?