Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

``Die CIS scum''

Name: Anonymous 2012-10-17 6:06

Amazing programming explanation using examples which respect people of all genders! I think everyone engaged in IT discussion and teaching should follow this style of highly tolerant and privilege-aware writing. ``Transgender'' and ``homosexual'' should become new ``foo'' and ``bar'' in educational code snippets.

---

I'll take a crack at the Factory Method pattern:

The Factory Method pattern uses a single method to construct objects according to some run-time data rather than hardcoding with new. For example, you may have a program which in various places may need to create a MalePerson or FemalePerson object depending on input, so you'd naturally pepper your code with:

if (gender.equalsIgnoreCase("male")) {
      return new MalePerson(name);
} else {
      return new FemalePerson(name);
}


Now what if you need to handle instances of TransgenderPerson or UndeclaredGenderPerson, etc? You'll have to go back and add those conditions to each place that conditional object creation occurs.

So, instead we employ the Factory Method pattern to be able to just call

PersonFactory.makePerson("male");

This encapsulates all creation of objects based on run-time data behind a single interface.

In Java this might be implemented as

public abstract class Person {
    protected final String name;
    public Person(String name) {
      this.name = name;
    }
}

public class MalePerson extends Person {
    public MalePerson(String name) {
      super(name);
    }
}

public class FemalePerson extends Person {
    public FemalePerson(String name) {
      super(name);
    }
}

public class PersonFactory {
    public static Person makePerson(String gender, String name) {
      if (gender.equalsIgnoreCase("male")) {
          return new MalePerson(name);
     } else {
          return new FemalePerson(name);
     }
    }

}


The declaration of the corresponding classes in Common Lisp is pretty straight forward:

(defclass person ()
  ((name :initarg :name :reader name)))

(defclass female-person (person)
  ())

(defclass male-person (person)
  ())


But, in Common Lisp, methods do not belong to classes, but to generic functions which dispatch specific methods based on their arguments. There is even EQL specialization on methods, which allows for methods to be dispatched based on the equality of their arguments to a specified value. So our PersonFactory in Common Lisp would look like:

(defgeneric make-person (gender name))

(defmethod make-person ((gender (eql 'male)) name)
  (make-instance 'male-person :name name))

(defmethod make-person ((gender (eql 'female)) name)
  (make-instance 'female-person :name name))


You'll notice that Common Lisp lacks a new operator. That's because there are no "constructors" in the usual sense of the word. The standard way of creating objects is to pass runtime data either a class object or symbol that is the name of the class object to the factory method MAKE-INSTANCE.

Now, that's all well and good, but let's look at what happens when we want to add the feature to create a TransgenderPerson to our factories. In Java we have to open the PersonFactory.java class file and modify it:

public class PersonFactory {
    public static Person makePerson(String gender, String name) {
      if (gender.equalsIgnoreCase("male")) {
          return new MalePerson(name);
      } else if (gender.equalsIgnoreCase("transgender")) {
          return new TransgenderPerson(name);
      } else {
          return new FemalePerson(name);
      }
    }

}


But in Common Lisp, we do not need to modify anything. We can just extend the MAKE-PERSON generic function with a new method:

(defmethod make-person ((gender (eql 'transgender)) name)
  (make-instance 'transgender-person :name name))

Name: Anonymous 2012-10-17 6:47

Use an enum instead of a string for the gender argument to makePerson. This isn't a scripting language.

Name: Anonymous 2012-10-17 8:05

'>lol fag

Name: Anonymous 2012-10-17 8:29

>>3
A white heteronormative cisgendered CEO professor and Baptist preacher was teaching a class on Karl Rove, known Christian.

“Before the class begins, you must get on your knees and worship Jesus Christ and accept that you too can become straight through daily prayer, self-flagellation, and eating Chik-Fil-A every day!”

At this moment, a brave, trans-Asian, self-diagnosed pansexual demiromantic vegan multisouled person who had been free of all animal products and only bought products at the local transgender co-op boldly stood up, holding a glass filled with some white liquid.

“Hey, Professor, what is this?”

The arrogant professor smirked like a rapist and smugly replied “It’s clearly milk, you crazy faggot. What the fuck does milk have to do with political science?”

“Wrong. It’s an all natural vegan soy almond kombucha latte. No animals or transpeople were harmed or raped in the making of this product.”

The professor was visibly shaken, and dropped his chalk and copy of the Wall Street Journal. He stormed out of the room, clearly planning some kind of rape. The professor realized that he had been playing into the hands of the kyriarchy of CEOs, investment bankers, the Religious Right, and psychiatrists. He then killed himself. The proper term for this is “trans-dead”.

The students checked their privilege, all diagnosed themselves with autism and gender identity disorder and joined the Gay-Straight Alliance. An obese trans-eagle furry otherkin waddled into the room and tried to perch upon the American Flag, bending the flagpole in the process. All parties involved gave up meat, Christianity, and the right to bear arms.

Name: Anonymous 2012-10-17 9:38

I raged for a few seconds!  Not because of the cis/trans bullshit but because of .equalsIgnoreCase.  Who the fuck calls functions like that?

Name: Anonymous 2012-10-17 9:39

public class OurProduct extends YourDick {

Name: Anonymous 2012-10-17 9:46

>>4
This needs to be pasted over a Chick tract.

But there's probably a Subnormality comic saying about the same.

Name: Anonymous 2012-10-17 11:11

I'm very much against the right wing (by virtue of being a socialist, feminist, etc.), but if you motherfuckers try to touch my meat, guns, or general purpose computer, this will end very badly.

Name: Anonymous 2012-10-17 11:23

>>8
Meat? Barbarian.

Name: Anonymous 2012-10-17 11:24

>>9
Explain carnivorous animals, dipshit.  I don't give a fuck about what you think about what I eat.

Name: Anonymous 2012-10-17 11:30

>>9
Internet? Consumerist fuck.

Name: Anonymous 2012-10-17 11:34

>>10
They have less of a capability for moral choice, you shithead. I don't give a fuck about your moral indolence.

Name: Anonymous 2012-10-17 11:38

>>10
It's out of necessity, you fucking moron.
Are you an animal? No.
Are humans self-assigned (or otherwise) caretakers of the planet? Yes.
Do you need to eat meat? Absolutely not.
Is farming a massive waste of energy and resources? Yes.
Is the meat industry one of the largest contributors to global warming? Yes. (This is not a conspiracy.)
Is it irresponsible as a human to eat animals, given the above? Yes. If you are ``socialist'' and ``feminist'' then is it not a contradiction of personality to be apathetic about a very similar issue?

Name: Anonymous 2012-10-17 11:46

>>13
Are you an animal? No.
IHBT

Name: Anonymous 2012-10-17 11:50

>>14
Keep telling yourself YHBT and you won't ever have to challenge your own beliefs. Ignorance is bliss, right?

Name: Anonymous 2012-10-17 11:53

>>15
If IHNBT, what the fuck are humans then? Plants?

Name: Anonymous 2012-10-17 12:01

>>13
Are you an animal? No.
Check your privilege you species-normative scum.

Name: Anonymous 2012-10-17 12:05

>>16,17
Obviously humans are animals, technically. But just using that definition ignores the myriad things that distinguish humans from other species.

Name: Anonymous 2012-10-17 12:09

>>16,17
Excellent argumental fallacy, by the way. Swaying the discussion off-topic by ignoring the brunt of the question to focus on nitpicks.

Name: Anonymous 2012-10-17 12:09

>>18
Disgusting.

Name: Anonymous 2012-10-17 12:22

>>19
But humans are animals, the sooner you get that into your head, the sooner you'll realize why your world view will never work.

Name: Anonymous 2012-10-17 12:26

>>21
The sooner you read the rest of >>13, the sooner you'll realise that humans are animals with responsibility and morals.
If you are of the ``just animals'' mindset, I'm sure you won't mind being put through the things that animals are put through by humans - slaughter, torture, trading, etc. After all, humans are animals, so why treat them any different?

Name: Anonymous 2012-10-17 12:28

>>22
You are correct, humans don't get treated differently and why should they?

Name: Anonymous 2012-10-17 12:30

>>23
I take it you are an advocate of the abolition of human rights.

Name: Anonymous 2012-10-17 12:34

>>24
I do think the herd needs to be culled, there's a few billion too many people for what this planet can support.

Name: Anonymous 2012-10-17 12:35

Why are we letting male and female be subclasses? Why not just set gender to be a boolean (or a bit in a bitfield, where the other bits represent some other value)

Example (in sepples)

class Person {
protected:
  std::string name;
  uint8_t gender : 1;
  uint8_t age : 7;
public:
  std::string name();
  uint8_t gender();
  uint8_t age();
  Person(std::string, uint8_t, uint8_t);
  ~Person();
};

Name: Anonymous 2012-10-17 12:36

>>25
I'm glad we agree on something. All we need is a backdoor on a life-critical system that billions of people rely on. Any ideas?

Name: Anonymous 2012-10-17 12:45

>>26
Because gender isn't boolean you fucking heteronormative cisgendered fagstorm.

Name: Anonymous 2012-10-17 12:49

>>13
Are you an animal?
Yes.

Are humans self-assigned (or otherwise) caretakers of the planet?
No.  What sets us apart is that we have intelligence, and that we (or at least some of us) are self-aware enough to know that if we fuck up the environment badly enough, we won't survive either.  I'm not saying that animals can't feel or that animal abuse doesn't matter (since they sense pain through pretty much the same neurological channels as we do), but killing animals for food is totally okay.  Caging them in 0.01 m^3 cells for a great part of their miserable lives is not.

If you choose not to eat animals, fine, but don't tell me what to do.

Name: Anonymous 2012-10-17 12:53

>>28
I do it just to piss off faggots like you.

Name: Anonymous 2012-10-17 12:55

>>26
Because FemalePerson has methods like "GetRaped" and "WashDishes" and "MakeSandwich" while MalePerson has methods like "Rape" and "EatSandwich" and "DrinkBeer." So when you do your dynamic dispatch of "PerformRandomGenderAction" it'll do the right thing without some horrifying gigantic case statement.

Name: Anonymous 2012-10-17 12:57

>>29
You're saying that animals feel pain just as humans do but that killing them for food is not morally objectionable, even though animal is not a required part of a human's diet?
What the fuck is wrong with you?

The rest of >>13 still stands, by the way. You are a fool if you know that eating meat is fucking up the environment, but continue to do so anyway.

Name: Anonymous 2012-10-17 13:02

>>32
They don't necessarily feel pain when you kill them.  Sure, most farmers (as well as many disgusting agricultural megacorporations) don't give a shit about it, but there are ways.  I have a friend who grows chicken and she pretty much smashes their brains, killing them instantly (as opposed to the usual "cut their head and look at them gasping for air for twenty seconds" method).

Name: 33 2012-10-17 13:07

>>32
You are a fool if you know that eating meat is fucking up the environment, but continue to do so anyway.
I don't eat five large steaks everyday, you know.  I eat, on average, 35 kg of chicken meat per year.  I do have a question; does that soy meat imitation thing have a smaller ecological impact?  I know that some brands are particularly delicious, although prohibitively expensive (heh, looks like someone cares more about lining their pockets than the environment).

Name: Anonymous 2012-10-17 13:16

BACON TASTES GOOD
PORK CHOPS TASTE GOOD

Name: Anonymous 2012-10-17 14:02

>>33
That's great and all, but you're still killing them. Murder is OK as long as they don't feel it, I bet.
>>34
Eating animal, even things only with gelatin or whey protein in, is still fuelling the meat industry.
Also, I don't eat soy meat imitation. That's primarily to show meat-eaters they can still eat stuff they like as a vegetarian, even when it isn't meat. I have a well balanced, inexpensive diet. I also don't know its impact but that isn't my wrongdoing. One thing I am guilty of with environmental impact is cow's milk, but until soy milk becomes palatable, affordable and ubiquitous, I'm afraid I can't do much about that. Veganism is a step too far.
heh, looks like someone cares more about lining their pockets than the environment
I don't know what straw man you're trying to burn here, but it doesn't make sense.

Name: Anonymous 2012-10-17 14:03

>>36
Oh, I get it now, never mind

Name: Anonymous 2012-10-17 14:07

>>36
murder |ˈmərdər|
noun
the unlawful premeditated killing of one human being by another

Were you once a cannibal or do you just like misusing words?

Name: Anonymous 2012-10-17 14:10

>>38
Cool, a dictionary definition. I'm surprised Hitler hasn't been mentioned yet.

Name: Anonymous 2012-10-17 14:11

>>19
I wasn't even partaking in the discussion. I wanted to point that stupid thing out.

Stop being so defensive. You forgot your ``ad hominem cognitive bias poe's law'', by the way.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List