
The Anti-If Campaign - vaksel
http://www.antiifcampaign.com/
======
J_McQuade
This sort of debate annoys me - not so much because of the potentially fragile
design on one side or the perhaps pedantic adherence to OOP principles on the
other, but because I know that I _could_ have things like pattern matching and
a scarily expressive type system and, well, that'd make a lot of these
problems disappear.

Curse you, Haskell, for making me so bitter!

------
tptacek
This is a joke, right? They're making fun of all the programs you see that
have 20 different forests of tiny classes spreading the logic of one function
across 45 files, right?

~~~
erlanger
You mean Lussumo?

------
calambrac
Don't solve with conditionals that which can be solved by your language's
dispatch mechanism.

~~~
tptacek
Don't solve with 15 minutes that which you can bill your client 80 hours for.

~~~
stcredzero
And don't forget, lots of those 15 minute intervals can add up to serious
money. ("Stovepipe" systems.) You can also set up an opportunity to bill for
coming later in and "fixing" a seemingly intractable big mess.

~~~
tptacek
"Oh, I see the problem right here, Mr. Client. Your previous consultant used
'if' statements. Here, let me replace that function with 80 new class files.
You'll be much more agile!"

~~~
stcredzero
I find that the opposite is true: replacing lots of runtime type
identification with polymorphism results in placing repeated code in just one
place. Don't Repeat Yourself is more agile. Even better: wait until at least
the 3rd repetition before refactoring. (But don't wait too long.) This cuts
down a lot of unnecessary coding, and leaves the programmer some leeway for
good judgment.

------
scott_s
Oddly named campaign to promote better use of inheritance. "The Anti-Type
Fields Campaign" would be more appropriate and less confusing.

~~~
henning
Inheritance or polymorphism?

~~~
davidw
calambrac gets it right: 'dispatch'. I though the article was going to be
about pattern matching, actually. I guess polymorphism is a sort of pattern
matching, but the real thing goes farther.

------
gabeybaby
I think this "campaign" is aimed at a developer less capable than the crowd we
see on HN. I used to work with a whole team of people where OOP is a strange
concept. I think the Anti-IF rule can help people think in a more correct
fashion if they're confused about Inheritance.

------
wglb
These days, I tend to use COND rather than IF.

Ah, but the page implies use bunches of teeny classes. Was that what Alan Kay
had in mind when he coined "Object Oriented Programming"?

------
jrandom
This strikes me as particularly funny as I'm working on a module of code where
I had to use a type field and an 'if' statement to get around a dynamic cast
that was killing performance.

(Virtual functions were not an option as this was taking place inside an STL
'==' comparator.)

------
aheilbut
after vanquishing all if statements, we're going to go after function calls.

And after that, we will eliminate source code, because it's too complicated.
Everything you need to do can be done with 5x7 index cards.

~~~
tptacek
First they came for the function definitions, and I said nothing, for I used
lambdas.

