2

I have read this question and after a very long time it's clear I still don't understand anti-patterns. perhaps, it raised a new level of curosity to know why should I read Anti design pattern if they are actually nothing but a "Bad Practice". Is there any chance I should implement those anti design patterns in my application ?

EDIT

When Jeff said: “A basic rule of programming is to never write what you can buy or get for free,”.

Which I believe is the way to implement copy & paste programming then should I say that SO is ,in some way or another, following Anti-Pattern?

3
  • I'd also add "Copy and Paste Architecture" to that as well. While you can of course have anti-patterns at the code level, you can also have them at any level of a solution.
    – Adrian K
    Jun 2, 2011 at 10:08
  • 1
    Your first sentence is painful. Try "...after a very long time it's clear I still don't understand anti-patterns." If that's what you're trying to say.
    – Philip
    Jun 2, 2011 at 16:47
  • 1
    I disagree with your last statement. Cut-n-paste programming is reusing without understanding. Jun 2, 2011 at 18:40

5 Answers 5

8

why should I read Anti design pattern if they are actually nothing but a "Bad Practice"

It takes one to know one. If you don't read about them, how can you know if you are using them?

When Jeff said: “A basic rule of programming is to never write what you can buy or get for free,”.

Which I believe is the way to implement copy & paste programming then should I say that SO is ,in some way or another, following Anti-Pattern?

Copy-paste programming is when you take something and use it without trying to understand what it does.

Always get at least a general understanding how a snippet/framework works before you use it.

4

Is there any chance I should implement those anti design patterns in my application ?

There is a chance you'll implement various anti-design patterns as you may fall into situations where it appears like, "This looks good let's do that," only to discover later that, "Ah that wasn't so good after all." Will you intentionally knowingly implement an anti-design pattern? That's another story as some people may like learning things the hard way and so to really see the lesson of the anti-pattern they'd implement it and see what happens. Other people may take the cautionary tale and know the lesson without having the direct experience of it.

EDIT

When Jeff said: “A basic rule of programming is to never write what you

can buy or get for free,”.

Which I believe is the way to implement copy & paste programming then should I say that SO is ,in some way or another, following Anti-Pattern?

No, though there is something to be said for how a lot of things can be misused or abused at times. Consider the basics of a knife. This can be used as a weapon in combat or as a tool to cut food into bite size pieces to make it easier for some people to eat. Should there be no knives in the world simply because they could inflict harm? I'd think not as there are lots of good uses of a knife and so I'd like to see them stay as something I can use with food. SO can have some parts that if taken out of context could be damaging but this is true of a lot of things in the world where a little information can be a dangerous thing.

2

why should I read Anti design pattern if they are actually nothing but a "Bad Practice".

So that you can recognize when they appear in your own code. Which they will.

There seems to be a certain segment of programmers who dont understand that you can learn just as much from looking at bad code as you can from 'perfect' code. Learning 'what not to do' is every bit as important as learning 'what to do'.

1

You should study anti patterns, simply to learn from the mistakes of others. So that you do not make the mistakes.

In your example the copy paste anti pattern is copying code that you do not understand and contains more than you need.

I have seen examples of this at the begining of a project to show progress, saving days, and then loosing weeks (months) at the end of the project since it is difficult to find bugs or the cause of performance problems.

0

In general, you should not implement anti patterns in your application. Anti patterns are basically the easiest way to exemplify bad practice in a way that lets people know what they should avoid doing.

That said, you should study anti patterns to know what they are and how to avoid them. The only reason you'd want to put anti patterns into your application on purpose that I can think of is if you were doing a scientific study of the effects of anti patterns on future maintainers of the code.

2
  • 2
    Or job protection :)
    – psousa
    Jun 2, 2011 at 7:14
  • @psousa +1 that is eventually the main motive.
    – Chris
    Jun 2, 2011 at 8:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.