Hacker News new | ask | show | jobs
by frodowtf 1098 days ago
> Anti-patterns are things like using a wrong data structure

What is a "wrong data structure"? Is it wrong to do linear scans when hash access would be sufficient?

> ... using the wrong levels of abstractions

When is the abstraction level wrong? I can name you at least 10 projects that avoid so called anti-patterns by introducing unecessary abstractions. Is something really an anti-pattern if it's "solution" massively reduces your development velocity but now everything is nicely composable?

In my opinion, anti-patterns are either obvious (constantly using different names for the same thing) or totally subjective to the context (when to repeat yourself).

But maybe I'm not able to put myself into the shoes of novices and a lot of things seem obvious to me. Granted.

1 comments

> What is a "wrong data structure"?

I've seen people use multiple named arrays, search for something in the first array, then use its index to find matching data in the other arrays, instead of a dictionary of string:tuple.

Another example is languages with arrays and vectors, usually one or the other is preferred. In Go you can use arrays but you're supposed to use slices whenever possible, while the opposite would be appropriate in, say, C.