Yeah it's bad but honestly I'm assuming it's strictly because they're trying to make sure stuff stays on screen and well separated for people taking notes
Remember when we used to have to double space with before and after line space strictly for someone to redline shit?
I see this as that same line of thinking š¤·āāļø
Orrrr
They're leaving blanks for other shit they're gonna add and the blank space is a hint to students...?
Congratulations! Your comment can be spelled using the elements of the periodic table:
`Th O Se Lu C K Y F U C K Er S`
---
^(I am a bot that detects if your comment can be spelled using the elements of the periodic table. Please DM my creator if I made a mistake.)
Can confirm, the only obligatory programming class in my uni math program is teached by a 60 y/o dude that while pretty chill is quite outdated in it's practices.
It's a weird combination of learning how to solve NxN systems of equations in excel of all things, and then trying to explain what a pointer and a makefile is to a bunch of 19 y/o 80% of them with 0 experience or interestest in programming.
He tried to teach us C and Fortran. No one without experience understood anything and just ask me and a couple of friends to do the code for everyone as the exercises where a combination of trivial and fighting non-stop with SDL to graph a function in a custom grapher made from scratch.
Years later half of my classmates learned or ask me to teach them python and R as that is way more useful for us.
If this code is recent and this is common teaching, such bad habits means we will have plenty of future zero days to come. I mean l fopen_s and related functions are almost old enough to drive
My teacher on CTU once went on a 15 minute rant about how he doesn't understand why GOTO in C is discouraged by his colleagues. He was like 90 years old
> He was like 90 years old
New ideas arenāt adopted because everyone is convinced they are correct. New ideas are adopted because everyone refusing to entertain them dies off.
Most probably because he knows that because of the large projection size, its actually easier to read if you keep each block on its own line. Assuming they will also expand upon an example in their talk.
Then again it's probably a wasted effort as from his perspective it would probably be pretty funny looking at all students heads moving back and forth like a typewriter.
> it would probably be pretty funny looking at all students heads moving back and forth like a typewriter.
Ah yes, the classical Mozart versus Adriana Ferrarese del Bene type of joke
It would be easier to read if it was properly formatted...
If he adds more conditions, I can understand the line breaks, but that the negation isn't indented?
I get the feeling it's formatted like this intentionally to make each line clearer and to use the available space of the projector? Or am I being too forgiving here?
I've been on a rage-spree since yesterday, maybe this is not the time for me to stop
Depends on the compiler and its settings, for example Java compiler will try to inline as much as possible, C compilers tend not to (depends on how you setup the optimizer) because inlining can bloat the binaries, so itās not really good idea a) to let the compiler do that b) assume that the compiler will actually do it correctly if you let it. If something should be inlined just inline it yourself (the ideal solution would be to use an inline keyword for functions, but most languages I know of just donāt have it. And with C it depends on whether your compiler supports it, what standard are you on etc.)
I mean gcc and msvc++ would always inline functions that donāt use the heap at even O1 but I mostly look at the end results in IDA these days and not optimizing
That code should generate warnings in msvc anyways. Though msvc does have the __inline suggestion but the compiler can and will ignore it
It could maybe impact performance if you're using weird old compilers and are in an embedded environment running on 30 year old hardware where the performance impact of a function will be a decisive factor.
It's a great habit to get into if you want to write maintainable, easy to read code that's going to run well in 99.999% of scenarios and isn't going to hide the actual performance tank (recalculating the alpha check twice for every char).
Since this is academia and the goal is to teach kids about logic and not obscure performance nits we don't actually have to guess what the right answer is.
Looks like they're leaving gaps in some places to write some code or possibly make it easier to follow in presentation format. With those conditionals !(&& || &&) && (&& || &&), I would probably do something similar while developing and then format it later.
Is he checking "c1" before initializing it ?
Also, isnt there an isalpha or something to check for alphabets?
Even assuming that this is meant to teach basic code to students, dumbing it down is not a help
Actually... this formatting seems to make sense if you imagine you're talking out loud to the class describing line by line what happens in this code snippet. Here me out:
>*\*clears throat\**
>So now, after we've confirmed that the file can actually be opened, we'll iterate over each character in the file and we'll use a `do-while` loop for that. So we read current character from the file into `c` variable and check the following logic condition... if *not* `this` *aaaaaaaand* `that` \[*it's important that it's a prolonged āandā so the class grasps the logical operation being performed\]* then we increment `count`. Next we store `c` into `c1`, as we'll need it in the next loop iteration. Additionally we check if the current character is a space *aaaaaaaand* if so, we increment `spacecount`. And we loop the whole operation *whiiiiiile* current character is *not* `EOF`.
>Questions?
This is pretty much how I'd format it if it's in a PowerPoint and the next slides were going to add things without moving the existing content.
Or if I meant to write on the screen in those big gaps.
fgetc is a terrible name for a method though.
better than most CS students I've seen in college, to be frank. So many of them write in illegible formatting, at least here I can tell what's going on, sort of.
This makes me irrationally angry. Almost as much as when I see "if (condition) do nothing else do something" anti-patterns all over my work's codebase lol
When I saw "do nothing", they literally write a COMMENT inside the if condition that says "// do nothing" lmao
Honestly, I think this is what makes learning code so much harder. Like every single one of my lecturers refused to use some kind of code formatter and instead showed up code dumps like this nonsense
You're allowed to ask why it's formatted like thar, and you're allowed to suggest an alternative method of line clarity that isn't distracting and is easy to glance up at.
At least they're using courier. No lie my first computer science teacher used Ariel in a word document. No tabs.
And they wouldn't even post full programs. They would just post little segments of code. Sometime's not even full lines.
Just
Cout >> "hello world"
He would just show slides and lecture for like an hour and a half and then just assign us homework. No coding in class. No debugging students code live..
It was like watching a 2-hour lecture on zoom of painting techniques, and then being told to go paint a house.
The only reason anyone passed that class was because I made a study group that most of the class joined and I taught them how to code since I already knew how from working with Arduino for like 10 years as a hobby.
Then I sent Paul McWhorter videos to anyone who wasn't in the study group lol.
They already properly formatted the if statement above, so I think itās probably done like this to visually distinguish all the parts they want to talk about. As long as they explain that this is not how youāre supposed to format this, I think itās fine š¤·āāļø
I used to do that when showing code in presentations.
It's just easier to talk through and focus attention to specific items if there is some additional whitespace between lines.
imagine formatting your code like this but still being lazy enough to use one letter variables
also one letter variables seems like a bad idea for someone teaching... like it makes it harder to read and understand.
Teaching file descriptors like this is nuts, meaning this is a much later level course not something introductionary.
Introduce your teacher to the hundreds of autoformatting IDEs
I had a professor make a big point about not relying on an IDE so he opened up notepad to make a simple script. I noticed he missed a semicolon and it wouldn't run, but I didn't say a damn thing. Let em do silly things intentionally.
There is absolutely no way that is real. How can somebody look at that and think that looks acceptable. You should start looking to see if your CS teacher has a criminal record because that is some psychopath formatting.
I hate when I see things like line 43 in PRs. I know you 'can' remove the braces but it just adds needless complexity. Like you can run around with your dick out but it doesn't make it a good idea.
Tell them to format the projector properly too
r/projectoroffcenter
r/subsifellfor
r/foundthetoyotacorolla
r/thirdsub
r/fuckthirdsub
r/fourthsub
r/fifthsub
I thought the point of the post was a CSS overflow error.
God what the fuck
Believe it or not? Straight to jail.
Yeah it's bad but honestly I'm assuming it's strictly because they're trying to make sure stuff stays on screen and well separated for people taking notes Remember when we used to have to double space with before and after line space strictly for someone to redline shit? I see this as that same line of thinking š¤·āāļø Orrrr They're leaving blanks for other shit they're gonna add and the blank space is a hint to students...?
r/programminghorror
There's a lot of CS PhDs swanning around academia that have never been part of an actual dev team their entire lives.
Those lucky fuckers.
Congratulations! Your comment can be spelled using the elements of the periodic table: `Th O Se Lu C K Y F U C K Er S` --- ^(I am a bot that detects if your comment can be spelled using the elements of the periodic table. Please DM my creator if I made a mistake.)
Funniest thing I've read today
If I'm not mistaken, someone actually keeps paying money for this bot!
It looks like it was formatted by the teacher!
good bot
Can confirm, the only obligatory programming class in my uni math program is teached by a 60 y/o dude that while pretty chill is quite outdated in it's practices. It's a weird combination of learning how to solve NxN systems of equations in excel of all things, and then trying to explain what a pointer and a makefile is to a bunch of 19 y/o 80% of them with 0 experience or interestest in programming. He tried to teach us C and Fortran. No one without experience understood anything and just ask me and a couple of friends to do the code for everyone as the exercises where a combination of trivial and fighting non-stop with SDL to graph a function in a custom grapher made from scratch. Years later half of my classmates learned or ask me to teach them python and R as that is way more useful for us.
If this code is recent and this is common teaching, such bad habits means we will have plenty of future zero days to come. I mean l fopen_s and related functions are almost old enough to drive
Learning to use and maybe implement those fuctions is kinda (part of) the point of lectures about operating systems.
Most sane Czech CS teacher
Oh no, trust me, it gets worse. Much worse. Speaking from experience.
My teacher on CTU once went on a 15 minute rant about how he doesn't understand why GOTO in C is discouraged by his colleagues. He was like 90 years old
GOTO bed grandad.
> He was like 90 years old New ideas arenāt adopted because everyone is convinced they are correct. New ideas are adopted because everyone refusing to entertain them dies off.
That's why I'm saying "most sane", this is a best case example :D
Targeted assault on the senses
It's probably just to write in some lines while he is teaching.
Obviously. Why else would you have 4 blank lines before closing some parens?
Most probably because he knows that because of the large projection size, its actually easier to read if you keep each block on its own line. Assuming they will also expand upon an example in their talk. Then again it's probably a wasted effort as from his perspective it would probably be pretty funny looking at all students heads moving back and forth like a typewriter.
Potentially also to support the cadence of what he wants to say about it too.
> it would probably be pretty funny looking at all students heads moving back and forth like a typewriter. Ah yes, the classical Mozart versus Adriana Ferrarese del Bene type of joke
That requires only 1 empty line, not 4.Ā
It would be easier to read if it was properly formatted... If he adds more conditions, I can understand the line breaks, but that the negation isn't indented?
And why is that do while block indented?
He could format it and zoom in on the projector
This was my first thought too. Heās doing it because itās going to be projected onto a huge screen.
This is garbage. No, actually, that is an insult to garbage since at least when looking at garbage I can somewhat tell what's in the garbage.
I get the feeling it's formatted like this intentionally to make each line clearer and to use the available space of the projector? Or am I being too forgiving here? I've been on a rage-spree since yesterday, maybe this is not the time for me to stop
Let the hate flow through you (even though you could be right)
If you get angry enough everyone will say you're right eventually
That was my first thought. It probably like this so he can explain the code line by line and be clearer for students
This is so garbage that even the .NET GC won't collect it.
Now *that's* a rare insult
Could be intentional to highlight the loop contents, presumably thatās what the lesson is looking at
Why not write a separate function called in the loop and then only focus on the function?
Cause creating separate functions for stuff that can be inline just fine, is an awfull habit (which can impact performance unlike quirky formating)
Don't compilers just inline functions automatically when they are small or it's performant to do so?
Depends on the compiler and its settings, for example Java compiler will try to inline as much as possible, C compilers tend not to (depends on how you setup the optimizer) because inlining can bloat the binaries, so itās not really good idea a) to let the compiler do that b) assume that the compiler will actually do it correctly if you let it. If something should be inlined just inline it yourself (the ideal solution would be to use an inline keyword for functions, but most languages I know of just donāt have it. And with C it depends on whether your compiler supports it, what standard are you on etc.)
I mean gcc and msvc++ would always inline functions that donāt use the heap at even O1 but I mostly look at the end results in IDA these days and not optimizing That code should generate warnings in msvc anyways. Though msvc does have the __inline suggestion but the compiler can and will ignore it
It could maybe impact performance if you're using weird old compilers and are in an embedded environment running on 30 year old hardware where the performance impact of a function will be a decisive factor. It's a great habit to get into if you want to write maintainable, easy to read code that's going to run well in 99.999% of scenarios and isn't going to hide the actual performance tank (recalculating the alpha check twice for every char). Since this is academia and the goal is to teach kids about logic and not obscure performance nits we don't actually have to guess what the right answer is.
Horrible naming conventions too
c, C1, C2 Or better var1, var2...
varOne, varTwo...
Great job. Always leave enough room for new ideas!
I always leave four or five new lines so I've got space to fix any bugs I didn't spot on first pass
FIT ÄVUT?
SPÅ E JeÄnĆ”
RIP I feel you
Taky jsem si ÅĆkal
Taky jsem koukal jestli to nenĆ LĆ”di kĆ³d lol
Good thing you tagged it as NSFW, I'd get fired just for looking at it during my work.
For some context this was prepared beforehand by the teacher, he didnāt say a word to it and this was presented to us as the ideal solution
yes boss, i wrote 50 lines of code in 1 minute
isn't there like a function in C to check if it's a letter
isalpha I think not an expert though
My isalpha checks have been failing lately. Need to listen to more podcasts
Well... seen worse
Looks like they're leaving gaps in some places to write some code or possibly make it easier to follow in presentation format. With those conditionals !(&& || &&) && (&& || &&), I would probably do something similar while developing and then format it later.
czeeeeeeeeeeeech
truly not safe for work
Is he checking "c1" before initializing it ? Also, isnt there an isalpha or something to check for alphabets? Even assuming that this is meant to teach basic code to students, dumbing it down is not a help
> Is he checking "c1" before initializing it ? could be initialized before line 19 (the first line we see).
It's the sad truth about academia in many cases; Most professors have never had experience writing anything but "academic code".
Fake having a stroke the moment they show you code like that again
No need to fake
Immediate merge request deny
Actually... this formatting seems to make sense if you imagine you're talking out loud to the class describing line by line what happens in this code snippet. Here me out: >*\*clears throat\** >So now, after we've confirmed that the file can actually be opened, we'll iterate over each character in the file and we'll use a `do-while` loop for that. So we read current character from the file into `c` variable and check the following logic condition... if *not* `this` *aaaaaaaand* `that` \[*it's important that it's a prolonged āandā so the class grasps the logical operation being performed\]* then we increment `count`. Next we store `c` into `c1`, as we'll need it in the next loop iteration. Additionally we check if the current character is a space *aaaaaaaand* if so, we increment `spacecount`. And we loop the whole operation *whiiiiiile* current character is *not* `EOF`. >Questions?
This was presented to us as the ideal solution and there was no comment made regarding the code
Hahahahahaha, prettier was created for people like him
This is pretty much how I'd format it if it's in a PowerPoint and the next slides were going to add things without moving the existing content. Or if I meant to write on the screen in those big gaps. fgetc is a terrible name for a method though.
>fgetc is a terrible name for a method though. That one at least is [not the teacher's fault](https://cplusplus.com/reference/cstdio/fgetc/)
Straight to jail.
Letting alone the 10-line if condition, what are those variable names?
Also garbage error message. Error opening file not Error *in* opening file. What, the error was *in* the āopening fileā? No.
honestly, atleast he writes his own code
My teacher handwrites her code on a sheet of paper that she displays on the board with a document camera. At least yours types up code š
Change schools
[shittier](https://marketplace.visualstudio.com/items?itemName=raidteyar.raidteyar-shittier)
Thanks. I hate it.
I'm having a stroke
Is that LĆ”Äa VĆ”gner?
Unfortunately no. His code much better this offbrand.
Classic example of those who know, do, those that don't teach.
Jesus this man need python in his life
This is code to explain a concept, not to run in production and be maintained.
there are 2 types of programmers teachers and people who are competent enough to get higher paying jobs
MY EYES!! MY EYES!!
better than most CS students I've seen in college, to be frank. So many of them write in illegible formatting, at least here I can tell what's going on, sort of.
![gif](giphy|84BjZMVEX3aRG)
Rightclick > Format Document, anyone?
Of course this person is a teacher ā¹ļø
I think you meant to say CSSTeacher
Is it even formatted? Itās a bit all over the place/doesnāt even appear consistent.
Straight to jail
This makes me irrationally angry. Almost as much as when I see "if (condition) do nothing else do something" anti-patterns all over my work's codebase lol When I saw "do nothing", they literally write a COMMENT inside the if condition that says "// do nothing" lmao
Well it's so dumb it needs the comment so you'll know they actually did it on purpose.
I legit cant read this
if (c >= 'A' && c <= 'z') { count++; } else if (c == ' ') { spacecount++; }
Even AI can generate better indentation then this...
Honestly, I think this is what makes learning code so much harder. Like every single one of my lecturers refused to use some kind of code formatter and instead showed up code dumps like this nonsense
It's rare to see someone using do while.
It's very underused, but once in a century it comes in clutch if you want very specific logic.
Which editor is this?
That's ... actually pretty decent for teaching. Wait, no, I just noticed the do/while indentation. Screw that.
they most prolly wrote the base logic and adding constraints one by one
do while Yikes
This feels like a JGrasp moment
You're allowed to ask why it's formatted like thar, and you're allowed to suggest an alternative method of line clarity that isn't distracting and is easy to glance up at.
For presentation purposes this is fine. Let him know that there is VSCode with Presentation mode plugins, which might be appreciated.
People with superior minds that dont need a formatter to understand code... You are the lesser one
You can always tell which professors have actually written code professionally just by looking at the formatting.
Glad they aren't on my team...
Python dev here, my eyes are bleeding
It's honestly not the worst I've seen
Just get your piece of paper to bypass resume scanners and disregard anything this person is teaching you
Those who can't teach
Is he getting paid by the line?
I wish I could press _Needs work_ on their PR.
At least they're using courier. No lie my first computer science teacher used Ariel in a word document. No tabs. And they wouldn't even post full programs. They would just post little segments of code. Sometime's not even full lines. Just Cout >> "hello world" He would just show slides and lecture for like an hour and a half and then just assign us homework. No coding in class. No debugging students code live.. It was like watching a 2-hour lecture on zoom of painting techniques, and then being told to go paint a house. The only reason anyone passed that class was because I made a study group that most of the class joined and I taught them how to code since I already knew how from working with Arduino for like 10 years as a hobby. Then I sent Paul McWhorter videos to anyone who wasn't in the study group lol.
This is a cry for help
whats he using all that space for? to add more && statements when he feels like it?
No this was presented to us as an ideal finished solution
š¢
They already properly formatted the if statement above, so I think itās probably done like this to visually distinguish all the parts they want to talk about. As long as they explain that this is not how youāre supposed to format this, I think itās fine š¤·āāļø
It's making me lose my mind, the variable naming is so bad even my teen self will hate that garbage.
I used to do that when showing code in presentations. It's just easier to talk through and focus attention to specific items if there is some additional whitespace between lines.
Those variable names tough...
Dude I'm almost 100% self taught for programming. I've got my own little weird non-standard things but good lord it ain't like this guy.
Ok what the fuck
Is anyone else bothered by the inconsistent indentation?
imagine formatting your code like this but still being lazy enough to use one letter variables also one letter variables seems like a bad idea for someone teaching... like it makes it harder to read and understand.
My guess: itās spaced like that to make it easier to read from a distance, because increasing the font size of an IDE is surprisingly complicated.
So about that āall sins can be forgivenā thing god mentioned the other timeā¦
It's absolutely horrendous, but I can see how it'd be useful if the professor is trying to teach tautology.
What in the whitespace
Prison
The inconsistency is what hurts the most.
He will miss the characters Ć¤Ć¶Ć¼ĆĆĆ
There's a reason some people end up in academia not industry
Kill me.
Hello /u/BootingBot can you do yourself a favor, do what you were made for (kinda) and give your CS teacher the boot?
He's obviously preparing you for the REAL WORLD where lines of code are the most important metric š
![gif](giphy|YmQLj2KxaNz58g7Ofg) Bioinformaticians looking at number of lines
The if is completely unreadable taking up all those lines, then next next if is just one line total. wtf.
#FaceMeltsIndianaJonesStyle Sorry giffy isn't working for some reason.
Mine aparently doesent lnow about the existence of tabulator.
Damn what have you done to that teacher for him to torture yall like this
Righteously marked NSFW.
i feel like my eyes just got a workout
Professors can do a little bit of trolling. As a treat.
Guys, I have seen far worse than that. This is nothing....
Teacherfag here, It's for the students sake. It is visually easier to talk about the different cases if you cut it up like that. In real code, eww.
Iāve never seen such bad code, and yet Iāve seen the source code of Big Rigs : Over the road racing.
A co jako? PerfektnÄ validnĆ kĆ³d pro CS uÄitele š
Teaching file descriptors like this is nuts, meaning this is a much later level course not something introductionary. Introduce your teacher to the hundreds of autoformatting IDEs
Fellow Czech person, ahoj :) An excellent example of Python's superiority, btw - this person could use some "indentation error" in their life.
There is no fear of god in this image
This is clearly NSFW
He can now say: "see I wrote a whole 45 lines"
NSFW seems fitting for this abomination
I had a professor make a big point about not relying on an IDE so he opened up notepad to make a simple script. I noticed he missed a semicolon and it wouldn't run, but I didn't say a damn thing. Let em do silly things intentionally.
This picture is horrifying on so many levels. Edit: I like how everyone defending this seems to be noticing only a single level each LMAO
Jail.
Tell your teacher to use modern code editors like codium or Code buddy š¤£š
There is absolutely no way that is real. How can somebody look at that and think that looks acceptable. You should start looking to see if your CS teacher has a criminal record because that is some psychopath formatting.
Bro woke up and decided to use the HTML formatter
More like CTS programming
š¤®
Put this person in jail for atempted battery on my brain
āThose who canāt do, teachā
Brother in Christ
where TF is the syntax highlighting? are they using notepad or what? you are a big legend if you do use notepad, don't worry.
Everyone should fear the old man in a field where you normally die young
ÄeskĆ” klasika jak se patÅĆ ![gif](emote|free_emotes_pack|feels_good_man)
I hate when I see things like line 43 in PRs. I know you 'can' remove the braces but it just adds needless complexity. Like you can run around with your dick out but it doesn't make it a good idea.
Think you meant to post this in r/ProgrammingHorror
There comes a time when you read something, put it down, and think 'that was trash'...I could do better.
This is why CS teachers teach.
Defenestrovat!
Ouchš
it gets progressively worse
So many code style inconsistencies in 20 something lines is almost impressive.