Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the name of this anti-pattern?

Surely some of you have dealt with this one. It tends to happen when programmers get a bit too taken by OO and forget about performance and having a database.

For an example, lets say we have an Email table and they need to be sent by this program. At start-up, it looks for anything that needs to be sent as follows:

Emails = find_every_damn_email_in_the_database();
FOR Email in Emails
  IF !Email.IsSent() THEN Email.Send()

This is a good from a do-not-repeat-yourself perspective, but sometimes it's unavoidable and it should be:

Emails = find_unsent_emails();
FOR Email in Emails
  Email.Send()

Is there a name of this one?

like image 900
WW. Avatar asked Apr 01 '09 01:04

WW.


1 Answers

I'll have a go at it and coin the name "the lazy filter (anti) pattern".

like image 147
1800 INFORMATION Avatar answered Sep 28 '22 21:09

1800 INFORMATION