r/shittyprogramming • • Dec 05 '14

Recursion 101

Post image
316 Upvotes

73 comments sorted by

View all comments

4

u/manghoti Dec 05 '14

I have to give that student credit. He's doing top down programming!

"Ok so how does this work. Well first we open the window"

public void doThing(){
	openWindow();
}

public void openWindow(){
	//TODO
}

"Then we set its color..."

public void doThing(){
	openWindow();
	setColor(255,0,0);
}

public void openWindow(){
	//TODO
}

public void setColor(int r, int g, int b){
	//TODO
}

now how do we actually set the color?... ummmm... well stack overflow says to do this:

public void setColor(int r, int g, int b){
	setColor(r,g,b);
}

... genius.