Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
User Journal

Journal Richard Dick Head's Journal: Object Orientation

Some people have trouble grasping the object orientation, but its quite simple if you put it into terms so one could explain conversationally in a bar. On to some pseudocode:

Lets say we want to implement a dick and a vagina. Ok, lets make a class called Dick.

First we need a constuctor, so when we make a "new Dick();" it will have certain perameters:

Dick() {
integer length = 5.5;
length += 5 * (random(2) - 1);
}

Basically what we have here, is that as make new Dick() objects, each will have its own length, with a nominal length 5.5 and varying from 0.5 to 10.5.

Now, to properly implement our Dick, we need a fuck function that takes a Vagina object , and acts upon it. We will implement Vagina later.

fuck(Vagina vag)
{
vag.setFucked(length);
}

So, with this function we message the object vag of class Vagina to notify vag it is fucked. Now we need a Vagina class, so we make a constuctor setting its characteristics.

Vagina() {
boolean isFucked = false;
integer maxLength = 5.5;
maxLength += 5 * (random(2) - 1);
}

We now have our map for each Vagina object, each having its own comfort length. Now we make the setFucked function we needed for interaction with Dick objects.

setFucked(length) {
isFucked = true;
if (length > maxLength) {
print("ow");
}
}

Ok, now we're done, but suppose we want to create Human classes, with Man and Woman subclasses. We can of course use the functionality we created by having the Man and Woman classes with their own respective Dick and Vagina objects. First with the Human class:

class Human {
Human() { // constructor
integer IQ = 100 + random(80) - 40;
}
}

class Woman implementing Human {
Woman() {
Vagina myCunt = new Vagina();
}
// We need a way to access the vagina when
// we are dealing with a woman.
Vagina getVagina() {
return myCunt;
}
}

class Man implementing Human {
Man() {
if ( random(1) > 0.001 )
Dick myShlong = new Dick();
else
Dick myShlong = null;
}
haveSex(Woman myBabe) {
if (myShlong == null)
print("Sorry, this one was circumcised into oblivion")
else
myBabe.getVagina().setFucked(mySchlong.length);
}
}

As you can see functionally, not every Human is a Man, and not every Man has a Dick, but every Man is a Human, and everything that has this dick you can assume to be a Man (for our purposes). You could the latter assumption more formal, by creating a ManWithDick interface.

Also, we can demonstrate class behavior with a subclass of Vagina.

class PickyVagina implementing Vagina {
setFucked(length) {
if (length < maxLength) {
print("hahahahahaha no");
}
else
isFucked = true;
}
}

So, our PickyVagina is a Vagina in every sense but its setFucked function, which we replaced.

Now we implement a Bitch subclass of Woman with a PickyVagina:

class Bitch implementing Woman {
Bitch() {
PickyVagina myCunt = new PickyVagina();
}
}

You might wonder if since a given Man object is expecting a Vagina, and is getting a PickyVagina in this case, that would cause problems with the Man. However, the Man doesn't care, because due to the implementation, a PickyVagina is still a Vagina.

Anyway, thats a good treatment in OO, hope that clears it up for some ;)

This discussion has been archived. No new comments can be posted.

Object Orientation

Comments Filter:

THEGODDESSOFTHENETHASTWISTINGFINGERSANDHERVOICEISLIKEAJAVELININTHENIGHTDUDE

Working...