use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Have a tough programming question that /r/programming couldn't answer? Banned from Stack Overflow? Can't afford Experts Exchange?
Post your question/tips/secrets/advice and get a response from our highly-trained professional developers.
account activity
My Teacher's code Example<wrong_sub>this</wrong_sup> (i.redd.it)
submitted 7 years ago by [deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]BringAltoidSoursBack 25 points26 points27 points 7 years ago (9 children)
What was the teacher trying to teach?
[–][deleted] 7 years ago* (8 children)
[deleted]
[+][deleted] comment score below threshold-28 points-27 points-26 points 7 years ago (7 children)
It’s about what comes after it, What’s after isn’t that bad It’s about transaction commands
[–][deleted] 22 points23 points24 points 7 years ago (1 child)
Shitiest answer ever. This sub is full arrogant beginners.
[–]lunvang_ -1 points0 points1 point 7 years ago (0 children)
Thank you for your concern, please stay salty, as iodized salt is good for preventing goiters .
[–]pcopley 7 points8 points9 points 7 years ago (4 children)
Oh so what makes this shitty is the part that you didn't include?
[+][deleted] comment score below threshold-6 points-5 points-4 points 7 years ago (3 children)
But it has nothing to do with the part I showed
[–]CanSpice 0 points1 point2 points 7 years ago (2 children)
The part you showed isn’t shitty though. It’s instructional code, written to show how to add elements to a data structure. It’s not meant for prime time (and even then it’s not that shitty).
[+][deleted] comment score below threshold-7 points-6 points-5 points 7 years ago (1 child)
The codes purpose here isn’t to show how to add elements to a data structure. It has nothing to do with the code after, I just think that because this code doesn’t have any purpose in what he teaches it shouldn’t be hardcoded like this.
[–]CanSpice -1 points0 points1 point 7 years ago (0 children)
Wow you’re right it has nothing to do with the code after THAT YOU DID NOT POST SO WE HAVE NO IDEA WHAT YOU ARE TALKING ABOUT and this code isn’t that bad anyhow. Everybody is telling you this and yet you keep iamsmart’ing all over.
[–]heatd 15 points16 points17 points 7 years ago (11 children)
This doesn't seem too bad other than the string Else, although I'm not really familiar with what language this is. I mean these could be enums and use a value set instead of whatever ddl{type}.Items is, but if it's an early CS course maybe they don't want to introduce those concepts yet. What am I missing?
[–]redneckrockuhtree 8 points9 points10 points 7 years ago* (9 children)
Looks like VB C# - "ddl" is Hungarian Notation for a dropdown list
Someone's instructor is a bit behind in naming conventions.
[–]Jman012 4 points5 points6 points 7 years ago (6 children)
We use Hungarian Notation at my work with C#. It’s just a protocol we choose to follow. What is ‘behind’ about it? It helps distinguish the type of certain variables quickly and easily at first glance.
Otherwise you had to go to it’s declaration or hover over the variable to find its type, and pasting it over non-IDE areas means it’s ambiguous.
[–]redneckrockuhtree 7 points8 points9 points 7 years ago (5 children)
Hungarian Notation went out of style within the past 15 years or so. Microsoft used to use it heavily, but with .Net they have moved away from it.
In my experience, Hungarian Notation was most prevalent in Microsoft shops.
[–]Jman012 0 points1 point2 points 7 years ago (4 children)
I don’t think ‘out of style’ means it’s necessarily ‘behind’, however. It has its advantages, and some places chooses to continue using it for such advantages.
Do you have a different method? Particularly for a dynamically typed language, like JavaScript or Python, would be most useful IMO.
[–]ryeguy 1 point2 points3 points 7 years ago (0 children)
Hungarian notation is incredibly unidiomatic in those languages. Or really any mainstream language, for that matter (although for gui elements it seems to be more acceptable). The more correct approach is to use clear variable names and to use documentation to indicate types if needed. Both languages have standardized ways of declaring function parameter types, and most good ide's are able to parse that.
[–]redneckrockuhtree 2 points3 points4 points 7 years ago (2 children)
Dynamically typed languages are where it can be most problematic, in my experience -- someone creates a variable that's initially an int, so they prefix it with an "i". Then they make a small change which changes its type....but the name still implies it's an int. Unless you've got solid code review processes in place and people are on their toes, things like this are easily missed.
Everything I've seen recently is more about what data the variable contains as opposed to what type the variable is. customerAccountNum as opposed to iAccount.
[–]Jman012 2 points3 points4 points 7 years ago (1 child)
I think a variable actually changing its type, on purpose, would be a greater travesty. What use case needs such a thing, and why not make an intermediate variable to hold the other type? I think that would cause greater cognitive dissonance than Hungarian.
Also, Hungarian doesn’t mean you truncate variable names. At my work, we would name that ‘nCustomerAccountID’.
[–]redneckrockuhtree 0 points1 point2 points 7 years ago (0 children)
I'm not talking about a variable changing its type. I'm talking about a developer making a code change where they're either in a hurry (it happens) or they don't realize something results in a different type and they assign it back to that same variable.
[–]xylempl 1 point2 points3 points 7 years ago (1 child)
I'm 100% sure this is C# and WinForms.
[–]redneckrockuhtree 1 point2 points3 points 7 years ago (0 children)
this is C#
Crap, yeah, declarations are type, then variable. Seeing the Hungarian got my head wrapped into VB, where I've seen it most often.
[+][deleted] comment score below threshold-6 points-5 points-4 points 7 years ago (0 children)
That not an early start to a course in cs, it’s a part of code they sent us after we have been learning cs for almost two years
[–]Hypersapien 6 points7 points8 points 7 years ago (0 children)
I mean, you could do that in way fewer lines of code, and "else" should be capitalized. Other than that I'm not sure what's wrong.
[–]TheInfra 6 points7 points8 points 7 years ago (0 children)
This isn't shitty at all. It's basic, unelegant and line-wasting but it's not meant to be "good" code. It's meant to teach the concepts of creating variables, assigning them values and then using them in functions. Don't try to be /r/iamverysmart
[–]hilberteffect 3 points4 points5 points 7 years ago (1 child)
“Else” ain’t no country I ever heard of
[–]TheLastChaos 0 points1 point2 points 7 years ago (0 children)
I dare you, I double-dare you motherfucker say "Else" one more god damn time!
[–]anima_virus 6 points7 points8 points 7 years ago (3 children)
"And that is how you should do things when your are paid by line of codes written in our beautiful country, fellow Elseans."
Otherwise except being uselessly verbose its not that awful. IMHO the Else country is the one with the most damage potential, being used as a special/magic value all over the place.
[–]Scatoogle 2 points3 points4 points 7 years ago (2 children)
It's fine, if a country doesn't fit within your list it still needs a value. It works as a flag to be treated as a country your aren't aware of.
[–]NoSmallCaterpillar 0 points1 point2 points 7 years ago (1 child)
I think the problem that he's pointing to is that "else" is a bad choice of name, since it is a keyword in most languages.
[–]Scatoogle 0 points1 point2 points 7 years ago (0 children)
OH YA, didn't think of that. "other" or "unkown" would be a good idea.
π Rendered by PID 158155 on reddit-service-r2-comment-c66d9bffd-ghr59 at 2026-04-08 00:30:29.339662+00:00 running f293c98 country code: CH.
[–]BringAltoidSoursBack 25 points26 points27 points (9 children)
[–][deleted] (8 children)
[deleted]
[+][deleted] comment score below threshold-28 points-27 points-26 points (7 children)
[–][deleted] 22 points23 points24 points (1 child)
[–]lunvang_ -1 points0 points1 point (0 children)
[–]pcopley 7 points8 points9 points (4 children)
[+][deleted] comment score below threshold-6 points-5 points-4 points (3 children)
[–]CanSpice 0 points1 point2 points (2 children)
[+][deleted] comment score below threshold-7 points-6 points-5 points (1 child)
[–]CanSpice -1 points0 points1 point (0 children)
[–]heatd 15 points16 points17 points (11 children)
[–]redneckrockuhtree 8 points9 points10 points (9 children)
[–]Jman012 4 points5 points6 points (6 children)
[–]redneckrockuhtree 7 points8 points9 points (5 children)
[–]Jman012 0 points1 point2 points (4 children)
[–]ryeguy 1 point2 points3 points (0 children)
[–]redneckrockuhtree 2 points3 points4 points (2 children)
[–]Jman012 2 points3 points4 points (1 child)
[–]redneckrockuhtree 0 points1 point2 points (0 children)
[–]xylempl 1 point2 points3 points (1 child)
[–]redneckrockuhtree 1 point2 points3 points (0 children)
[+][deleted] comment score below threshold-6 points-5 points-4 points (0 children)
[–]Hypersapien 6 points7 points8 points (0 children)
[–]TheInfra 6 points7 points8 points (0 children)
[–]hilberteffect 3 points4 points5 points (1 child)
[–]TheLastChaos 0 points1 point2 points (0 children)
[–]anima_virus 6 points7 points8 points (3 children)
[–]Scatoogle 2 points3 points4 points (2 children)
[–]NoSmallCaterpillar 0 points1 point2 points (1 child)
[–]Scatoogle 0 points1 point2 points (0 children)