I'm doing a CodeRage presentation on Delphi Coding Anti-patterns, and was wondering if anyone would like to contribute their favorite. The kind of things I had in mind would be:

I'm doing a CodeRage presentation on Delphi Coding Anti-patterns, and was wondering if anyone would like to contribute their favorite. The kind of things I had in mind would be:
if assigned(x) then
  x.free;  //just call free!!!
Over use of the with statement (that is to say using it all), using a TStringList to store references to objects, incorrect use of try...finally statements and so on.  I'm basically after short easily explainable patterns.  I currently have a few, but I'm not sure that it's half an hour of content as yet.

Comments

  1. Igor Schevchenko Some people are trying really hard to explore the limits ;)

    ReplyDelete
  2. Asbjørn Heid Maybe their salary depends on number of code lines ? :)

    ReplyDelete
  3. The biggest anti-pattern or Code Smell I see every day is CopyPasta.   The clean alternative is DRY (don't repeat yourself).   Even fifteen identical Method X invocations that have the same parameter list that could become a single method, are better off with less repetition.   If there are sequences of bytes in your source code > 50 bytes in length, repeated more than once, you have this Code Smell/anti-pattern.

    ReplyDelete

Post a Comment