Comment On Surpassing the Master

Jibran turned in some questionable programming code when he was a student in college. Then again, who didn't? It's a student's sacred right to drive instructors to drink. There are no WTFs in student code; everyone has to learn sometime. [expand full text]
« PrevPage 1 | Page 2 | Page 3 | Page 4 | Page 5Next »

Re: Surpassing the Master

2010-06-03 09:02 • by Obi-Wan
It's always a hardware issue...

Re: Surpassing the Master

2010-06-03 09:03 • by Jayman
Gotta love those college profs, educating the next generation of WTF'ers. I remember that at least one of my Comp Sci profs took great pride in the fact that he had no industry experience; he felt that being a life-long academic kept him "undiluted" by industry practices...

Re: Surpassing the Master

2010-06-03 09:05 • by Alargule (unregistered)
Must have been an Oompa Loompa.

Re: Surpassing the Master

2010-06-03 09:08 • by Chris (unregistered)
Posts have been pretty good lately. They sound more creative. I'm not even going to bother with something witty, it would just be superflous.

CAPTCHA aliquam.

Re: Surpassing the Master

2010-06-03 09:09 • by OldJavaGuy (unregistered)
This must be an advanced class since they're simulating 10-sided dice.

Re: Surpassing the Master

2010-06-03 09:11 • by wtf (unregistered)
310336 in reply to 310335
OldJavaGuy:
This must be an advanced class since they're simulating 10-sided dice.


The professor is a dungeon master.

Re: Surpassing the Master

2010-06-03 09:14 • by Tycho (unregistered)
310337 in reply to 310335
OldJavaGuy:
This must be an advanced class since they're simulating 10-sided dice.


Please. I roll twenties.

Re: Surpassing the Master

2010-06-03 09:14 • by HopelessIntern (unregistered)
Unfortunately I can sympathise all too readily.
Some of the so-called professors at my university were so dense, the mind boggles how they got there in the first place (especially the one with all the letters after his name..?)

I specifically remember one, whom despite having (supposedly) a PhD in Software Engineering, would not answer any programming related questions because that was "not his area". We also sat awkardly in silence for 10 minutes as he tried to turn off mute on his WinXP machine in order to show us a presentation.

Re: Surpassing the Master

2010-06-03 09:16 • by frits
Here's a picture of said short circuit:



Re: Surpassing the Master

2010-06-03 09:18 • by Case (unregistered)
310340 in reply to 310338
To be honest, I think the professor was actually screwing with him for sleeping in class every day. Anyone who was awake heard his explanation that the +0 was just a placeholder for the offset you want in your random number. Then that dumbass wakes up mid-class and asks a retarded question so the prof gave him a retarded joke answer.

Then when it came to the lab, the professor mocked him even further. I know if I was in that class, I'd have been laughing so hard.

Re: Surpassing the Master

2010-06-03 09:18 • by ipeet
Reminds me of the Data Structures & Algorithms prof I had who put the following on the board:

public static void main() {
doStuff();
}

public static void doStuff() {
/* insert main() here */
}

Why was this done?
"As a general principle, I like to keep the main function short and simple"

Re: Surpassing the Master

2010-06-03 09:22 • by madjo
When I got taught Java, for the first 10 weeks we didn't have any practical lessons. Exams were done on paper without the use of a computer. Yes, that meant writing source code on paper, though most questions were multiple choice type questions. And the programs you were asked to write weren't very long, and pretty easy.

And the teacher pronounced the names of certain functions weirdly. Sleep for instance was pronounced as "Slape" (as that's how you pronounce sleep in Dutch), and a thread became threed (though I'm not sure why he did that, probably because in some cases ea is pronounced as ee in English (like eat), and he stuck to it)

It may sounds as an exaggeration, but I assure you it's not.

Re: Surpassing the Master

2010-06-03 09:24 • by highphilosopher (unregistered)
310343 in reply to 310340
Case:
To be honest, I think the professor was actually screwing with him for sleeping in class every day. Anyone who was awake heard his explanation that the +0 was just a placeholder for the offset you want in your random number. Then that dumbass wakes up mid-class and asks a retarded question so the prof gave him a retarded joke answer.

Then when it came to the lab, the professor mocked him even further. I know if I was in that class, I'd have been laughing so hard.


I think you're right. I don't know if the names have been changed to protect the not-so-innocent or not, but I had a professor Talbot in Comp-Sci, and he was actually real slci. Annoying, but smart.

Captcha: esse -- Esse you gonna eat your taco?

Re: Surpassing the Master

2010-06-03 09:25 • by Pete (unregistered)
Are WTF's drying up is all code in the world becoming better.

I think we all know there are teachers in colleges and universities that don't have a clue. Those who can't do teach after all.

Re: Surpassing the Master

2010-06-03 09:28 • by robo (unregistered)
310345 in reply to 310342
madjo:
And the teacher pronounced the names of certain functions weirdly. Sleep for instance was pronounced as "Slape" (as that's how you pronounce sleep in Dutch), and a thread became threed (though I'm not sure why he did that, probably because in some cases ea is pronounced as ee in English (like eat), and he stuck to it)

My computing 4 prof and his thick accent had me wondering for quite a while what the heck a "java washing machine" was...

Re: Surpassing the Master

2010-06-03 09:29 • by Spoe (unregistered)
I could understand "rand.nextInt() % 10 + 1", to give an integer from 1 to 10 since they're simulating dice.

Re: Surpassing the Master

2010-06-03 09:29 • by ari
310347 in reply to 310342
madjo:
When I got taught Java, for the first 10 weeks we didn't have any practical lessons. Exams were done on paper without the use of a computer. Yes, that meant writing source code on paper, though most questions were multiple choice type questions. And the programs you were asked to write weren't very long, and pretty easy.

And the teacher pronounced the names of certain functions weirdly. Sleep for instance was pronounced as "Slape" (as that's how you pronounce sleep in Dutch), and a thread became threed (though I'm not sure why he did that, probably because in some cases ea is pronounced as ee in English (like eat), and he stuck to it)

It may sounds as an exaggeration, but I assure you it's not.


Hear hear. Been there, done that. Even in university there are still professors who simply can't pronounce English words correctly. That's not that bad, except when they teach Statistics and Research Methods...

Re: Surpassing the Master

2010-06-03 09:32 • by Troy (unregistered)
This is why experience = 10x(degree)

Re: Surpassing the Master

2010-06-03 09:37 • by krupa (unregistered)
310349 in reply to 310342
madjo:
When I got taught Java, .... Exams were done on paper without the use of a computer. Yes, that meant writing source code on paper...


All of my programming-class exams were on paper. The homework assignments showed you could write code that compiled and ran. The tests showed you understood the fundamental principles and weren't cheating on the homework.

Re: Surpassing the Master

2010-06-03 09:38 • by anon (unregistered)
310350 in reply to 310340
Case:
To be honest, I think the professor was actually screwing with him for sleeping in class every day. Anyone who was awake heard his explanation that the +0 was just a placeholder for the offset you want in your random number. Then that dumbass wakes up mid-class and asks a retarded question so the prof gave him a retarded joke answer.

The *10 is for the offset. The +0 is to be able to adjust the precision.

Re: Surpassing the Master

2010-06-03 09:41 • by Wyatt (unregistered)
Suprised no one has mentioned it should have been rand.nextInt(10) instead of rand.nextInt() % 10, as the latter has a slight bias towards lower numbers.

Re: Surpassing the Master

2010-06-03 09:47 • by I have no clue (unregistered)
310352 in reply to 310337
Isnt that actually a 9 sided die? Well I guess 10 if you count the 0, but I've never seen a blank side of a die.

NINJA VANISH!!

Re: Surpassing the Master

2010-06-03 09:50 • by Knux2 (unregistered)
OK kids, remember to always add "" to every String.

Captcha: nibh - a nibble header

Re: Surpassing the Master

2010-06-03 09:52 • by Prof. (unregistered)

Re: Surpassing the Master

2010-06-03 09:52 • by Prof. (unregistered)
This is a random comment +0.

Re: Surpassing the Master

2010-06-03 09:55 • by Zachary (unregistered)
310356 in reply to 310352
I have no clue:
Isnt that actually a 9 sided die? Well I guess 10 if you count the 0, but I've never seen a blank side of a die.

NINJA VANISH!!


You have never seen a Ten sided die before have you?

Re: Surpassing the Master

2010-06-03 09:56 • by Anon (unregistered)
but was so monotonous it could put an elephant under.


I wasn't aware that elephants were legendary for their alertness.

Re: Surpassing the Master

2010-06-03 09:57 • by Anon (unregistered)
310358 in reply to 310356
Zachary:
I have no clue:
Isnt that actually a 9 sided die? Well I guess 10 if you count the 0, but I've never seen a blank side of a die.

NINJA VANISH!!


You have never seen a Ten sided die before have you?



But this one goes to 11!

Re: Surpassing the Master

2010-06-03 10:02 • by DCRoss
310359 in reply to 310352
I have no clue:
Isnt that actually a 9 sided die? Well I guess 10 if you count the 0, but I've never seen a blank side of a die.


Edit: What everybody else said. I'm just going to add that real twenty sided dice are numbered from 0 to 9 twice and come with a crayon so you can colour half the digits.

Now get off of my lawn.


Re: Surpassing the Master

2010-06-03 10:02 • by ajtacka (unregistered)
310360 in reply to 310342
madjo:
When I got taught Java, for the first 10 weeks we didn't have any practical lessons. Exams were done on paper without the use of a computer. Yes, that meant writing source code on paper, though most questions were multiple choice type questions. And the programs you were asked to write weren't very long, and pretty easy.

And the teacher pronounced the names of certain functions weirdly. Sleep for instance was pronounced as "Slape" (as that's how you pronounce sleep in Dutch), and a thread became threed (though I'm not sure why he did that, probably because in some cases ea is pronounced as ee in English (like eat), and he stuck to it)

It may sounds as an exaggeration, but I assure you it's not.

That sounds like one of my high school English teachers. Yes, English teacher. She was Spanish (or Italian. I forget, it was a long time ago). We spent half of most classes trying to figure out what she was actually saying.

Re: Surpassing the Master

2010-06-03 10:04 • by Anonymouse (unregistered)
It doesn't explain the "short-circuit" comment, but it
could be that the prof was doing something out of habit. The +0 thing is occasionally used to cast something to an int. I also dimly recall doing something similar to tell the compiler to STFU about a warning.

Re: Surpassing the Master

2010-06-03 10:06 • by dtobias
Some of those pronunciations are in fact how English pronounced those things before the Great Vowel Shift of around 1500.

Re: Surpassing the Master

2010-06-03 10:11 • by Mister Zimbu (unregistered)
310364 in reply to 310352
I have no clue:
Isnt that actually a 9 sided die? Well I guess 10 if you count the 0, but I've never seen a blank side of a die.

NINJA VANISH!!


I'm not sure what dice you're using, but most 6-sided dice I've seen DO have a side with a "0" on it.

Re: Surpassing the Master

2010-06-03 10:11 • by Cliff notes anyone (unregistered)
310365 in reply to 310332
Jayman:
Gotta love those college profs, educating the next generation of WTF'ers. I remember that at least one of my Comp Sci profs took great pride in the fact that he had no industry experience; he felt that being a life-long academic kept him "undiluted" by industry practices...


That's like someone that practices foul shots but never played a game of basketball and somehow thinks that he/she is a foul shot master. It's different i nteh game with adrenaline and a crowd and others depending on you though.

Re: Surpassing the Master

2010-06-03 10:11 • by SR (unregistered)
310366 in reply to 310339
frits:
Here's a picture of said short circuit:





I've seen that issue before. Here's my workaround:

Random rand = new Random();

int n = rand.nextInt() % 10; // note: short circuit means no "+0"
return 5;

Re: Surpassing the Master

2010-06-03 10:12 • by JayT (unregistered)
Is the word "Master" really appropriate to describe this professor...?

Captcha: quis - ok class it's time for a pop quis on the value of 0...

Re: Surpassing the Master

2010-06-03 10:12 • by wtf (unregistered)
310369 in reply to 310362
I thought the Dutch pronunciations were a tribute to Java's origin on a Dutch colony.

Re: Surpassing the Master

2010-06-03 10:12 • by c4ctusal (unregistered)
That code is not even correct in Java because nextInt() can return negative numbers.

Just trying this:
import java.util.Random;

public class Test {
public static void main(String[] args) {
Random r = new Random();
for (int i = 0; i < 10; i++) {
int roll = r.nextInt() % 10;
System.out.println(roll);
}
}
}

Outputs:
0
-7
-9
8
-9
-4
8
0
5
-2

Re: Surpassing the Master

2010-06-03 10:15 • by Cliff notes anyone (unregistered)
310371 in reply to 310353
Knux2:
OK kids, remember to always add "" to every String.

Captcha: nibh - a nibble header


Actually, that's how I convert numbers to strings since this is a compile error:

double d = 1.1;
String x = 1.1; // compile error
String x = "" + 1.1; // works

yes, with the Double class I could do this differently but the way I do it, it works fine.

Re: Surpassing the Master

2010-06-03 10:20 • by operagost
Chuck Norris always rolls a natural 20-- on a d4.

Re: Surpassing the Master

2010-06-03 10:21 • by SR (unregistered)
310373 in reply to 310361
Anonymouse:
It doesn't explain the "short-circuit" comment, but it
could be that the prof was doing something out of habit. The +0 thing is occasionally used to cast something to an int. I also dimly recall doing something similar to tell the compiler to STFU about a warning.


If it was a duck-typed language you might get away with that. In Java, an int is an int is an int.

Re: Surpassing the Master

2010-06-03 10:22 • by Procedural (unregistered)
310374 in reply to 310342
madjo:
When I got taught Java, for the first 10 weeks we didn't have any practical lessons. Exams were done on paper without the use of a computer. Yes, that meant writing source code on paper, though most questions were multiple choice type questions. And the programs you were asked to write weren't very long, and pretty easy.

And the teacher pronounced the names of certain functions weirdly. Sleep for instance was pronounced as "Slape" (as that's how you pronounce sleep in Dutch), and a thread became threed (though I'm not sure why he did that, probably because in some cases ea is pronounced as ee in English (like eat), and he stuck to it)

It may sounds as an exaggeration, but I assure you it's not.


Well, you can slape the threed in Amsterdam; it's just 10 extra kronors.

Re: Surpassing the Master

2010-06-03 10:26 • by The Real, Non-Random Steve (unregistered)
Frist+0

Captcha: quibus -- Greyhound's new no-talking policy.

Re: Surpassing the Master

2010-06-03 10:28 • by GEE (unregistered)
310376 in reply to 310370
When you find a modulus of a negative number the result is always positive (as it is the remainder after an integer division).

So '% 10' limits the results to something between 0 and 9.

import java.util.Random;

public class Test {
public static void main(String[] args) {
Random r = new Random();
for (int i = 0; i < 10; i++) {
int roll = r.nextInt() % 10;
System.out.println(roll);
}
}
}

Outputs:
0
-7
-9
8
-9
-4
8
0
5
-2

Re: Surpassing the Master

2010-06-03 10:31 • by The Real, Non-Random Steve (unregistered)
310377 in reply to 310372
operagost:
Chuck Norris always rolls a natural 20-- on a d4.


Except when he rolls a 4 on a d20 - but even then, it criticals.

Re: Surpassing the Master

2010-06-03 10:32 • by Anonymous Hero (unregistered)
310378 in reply to 310371
Knux2:

Actually, that's how I convert numbers to strings since this is a compile error:

double d = 1.1;
String x = 1.1; // compile error
String x = "" + 1.1; // works

yes, with the Double class I could do this differently but the way I do it, it works fine.


SLLLOOOOOOWWW

Re: Surpassing the Master

2010-06-03 10:33 • by Anonymous (unregistered)
310379 in reply to 310362
dtobias:
Some of those pronunciations are in fact how English pronounced those things before the Great Vowel Shift of around 1500.


Not to be confused with the Great Bowel Shift that happens after a visit to Taco Bell.

Re: Surpassing the Master

2010-06-03 10:34 • by Anonymous (unregistered)
310380 in reply to 310341
ipeet:
Reminds me of the Data Structures & Algorithms prof I had who put the following on the board:

public static void main() {
doStuff();
}

public static void doStuff() {
/* insert main() here */
}

Why was this done?
"As a general principle, I like to keep the main function short and simple"

I don't want to support useless code and obviously it serves no purpose to spin the "stuff" off into a separate "doStuff()" method but I have to admit that I'm guilty of doing this myself - for exactly the reason given by your professor. I like the entry point of an application to be concise and readable; after all, it's the first bit of code that the next poor slob has to hit when he ends up maintaining your program. I just hate seeing big slabs of code in the main() method so even if it has a relatively simple job to do, I generally put that code in a separate function.

Re: Surpassing the Master

2010-06-03 10:35 • by VBMaster_VBFaster (unregistered)
310381 in reply to 310371
Cliff notes anyone:
Knux2:
OK kids, remember to always add "" to every String.

Captcha: nibh - a nibble header


Actually, that's how I convert numbers to strings since this is a compile error:

double d = 1.1;
String x = 1.1; // compile error
String x = "" + 1.1; // works

yes, with the Double class I could do this differently but the way I do it, it works fine.


yeah, do the same in VB when Strict is On, easier to write:

Dim crapLanguage as String = someInt & ""

than

Dim crapLanguage as String = someInt.ToString()

Re: Surpassing the Master

2010-06-03 10:36 • by IT Girl (unregistered)
310382 in reply to 310344
Pete:
Are WTF's drying up is all code in the world becoming better.

I think we all know there are teachers in colleges and universities that don't have a clue. Those who can't do teach after all.


That's right, those who can do, those who can't teach, and those who can do neither, criticize.
« PrevPage 1 | Page 2 | Page 3 | Page 4 | Page 5Next »

Add Comment