Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Naming of an algorithmic antipattern

I'm having problems to recall the name of doing something with quadratic complexity when it can be solved linearly.

For example, using a get-by-index function to iterate over a linked list instead of just using a next-element is the typical case of this antipattern.

I think it was the "something painter", as a metaphor of a guy that is painting a road, but doesn't carry with him the paint bucket and has to come back to the starting point every time he needs to refill the brush.

Cheers.

like image 646
fortran Avatar asked Jun 18 '10 14:06

fortran


People also ask

How do you identify anti-patterns?

In an organization, there are three main opportunities to identify anti-patterns: During design reviews, during code reviews and during refactoring of legacy code. Design reviews are a great opportunity to find anti-patterns.

What is an AntiPattern in programming?

In software, anti-pattern is a term that describes how NOT to solve recurring problems in your code. Anti-patterns are considered bad software design, and are usually ineffective or obscure fixes. They generally also add "technical debt" - which is code you have to come back and fix properly later.

What is an example of an anti-pattern?

In software engineering, anti-patterns include the big ball of mud (lack of) design; the God Class (where a single class handles all control in a program rather than control being distributed across multiple classes); and Poltergeists (ephemeral controller classes that only exist to invoke other methods on classes).

What means AntiPattern?

An AntiPattern is a literary form that describes a commonly occurring solution to a problem that generates decidedly negative consequences.


1 Answers

You're probably thinking of Schlemiel the Painter's Algorithm.

There's a classic joke on the topic that Joel Spolsky included in his Back to Basics article some years ago:

Shlemiel gets a job as a street painter, painting the dotted lines down the middle of the road. On the first day he takes a can of paint out to the road and finishes 300 yards of the road. "That's pretty good!" says his boss, "you're a fast worker!" and pays him a kopeck.

The next day Shlemiel only gets 150 yards done. "Well, that's not nearly as good as yesterday, but you're still a fast worker. 150 yards is respectable," and pays him a kopeck.

The next day Shlemiel paints 30 yards of the road. "Only 30!" shouts his boss. "That's unacceptable! On the first day you did ten times that much work! What's going on?"

"I can't help it," says Shlemiel. "Every day I get farther and farther away from the paint can!"

P.S. Don't confuse this with the Painter's Algorithm, which is an actual method for composing images.

like image 79
LBushkin Avatar answered Sep 28 '22 02:09

LBushkin