28
u/Dudecor3 May 17 '21
When overrides are used like this it genuinely hurts my soul :(
8
u/fugogugo May 17 '21
It is (Kotlin code based on) Android Java Class.. what would you expect. boilerplates everywhere
4
31
u/MurdoMaclachlan public boolean isInt(int i) { return true; } May 17 '21 edited May 17 '21
Image Transcription: Code
rootView?.viewpagerExplore?.registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() {
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
super.onPageScrolled(position, positionOffset, positionOffsetPixels)
when (viewpagerExplore.currentItem) {
0 -> setIndexAccordingVisibility(0)
1 -> setIndexAccordingVisibility(1)
2 -> setIndexAccordingVisibility(2)
3 -> setIndexAccordingVisibility(3)
4 -> setIndexAccordingVisibility(4)
5 -> setIndexAccordingVisibility(5)
6 -> setIndexAccordingVisibility(6)
else -> setIndexAccordingVisibility(0)
}
}
})I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!
13
u/Nielsly May 17 '21
Hi, thanks for your work, but you misscapitalized the N in setIndexAccordingVisibility a few times.
15
u/MurdoMaclachlan public boolean isInt(int i) { return true; } May 17 '21
Ah whoops, that's because I copy-pasted the miscapitalised line. Fixed now, thanks for pointing it out!
15
14
u/rixogdyuxhs +++++++[>+++++++++<-]>[.] May 17 '21
Programmers being paid by lines of code is the reason why schools definitely need better computer education.
11
5
3
3
u/NoMansSkyWasAlright May 17 '21 edited May 17 '21
Question: does that include comments?
Edit: Particularly, comments of the multi-line variety?
3
May 17 '21
[removed] — view removed comment
3
u/NoMansSkyWasAlright May 17 '21
/*Fair. But you gotta figure that a nice multi-line summary of what * each function/class/object is doing would be a nice way to pump * those line numbers up. You know, something like what the function is * doing, where the input parameters are coming from, and why it's * significant. Nothing too excessive, but you could probably get around * 2-3 extra lines per function; maybe one extra on the smaller bits. */I also saw a thing on this subreddit a while back where some dude was making an else-statement for every if-statement and if the else-statement didn't actually do anything, there'd just be a comment in the else block that said '//Nothing'. Thaaat might be scrutinized over a bit more. But comment blocks that explain what a function is doing might be something OP could get away with more easily considering you could pretty easily come up with justification/a sales pitch for them.
3
1
u/SlaimeLannister May 17 '21
Could you put your optional chaining on separate lines for even more lines?
173
u/racrisnapra666 May 17 '21
Out of curiosity, is there really a system where programmers are paid by lines of code?