IamPolaris
IamPolaris

Reputation: 1051

What antipattern does this common programming mistake fall under

For a programming project,

let's say the programmer has named similar style functions differently in many places, for example...

int ask_bro_4_data();

and another as

int ask_mom_for_data();

What antipattern does this represent? Essentially, it's the lack of standardization right? As in, one function uses for, the other uses 4.

Similarily the programmer could be naming variables in some fashion that relates to their use but fails to do so in every case, or does so in a non standardized way. This makes searching for these variables in a large code base harder because they may not be following the naming condition that you assume they would be.

Any ideas? Sorry for the ambiguous name, but I was not sure what to label this question as.

Upvotes: 1

Views: 382

Answers (2)

JOG
JOG

Reputation: 5640

Anti-Pattern: Rename later

When the programmer realize that he/she or her collegues are inconsistent in naming and decide to do something about it later, or that is not important to do something about at all.

This can be coped with by:

  • clear guidelines from the team about what to strive for in respecting naming conventions,
  • recognizing that refactoring is an ongoing process, parallel to the coding.
  • simple IDE commands that afford the user after thinking oh we used "4" here and "for" here, that's disturbing *Ctrl+R Ctrl+R* ah that's better *continues coding.*

Upvotes: 0

Paul Ferguson
Paul Ferguson

Reputation: 195

This would be considered more a syntax convention than a pattern.

The English language would lead us to prescribe using words in preference to numerals in order to improve maintainability. However, conventions can vary significantly depending on your peer group.

A design pattern would be considered a solution intended to address common problems introduced by a specific context.

For example; I want to ensure my application can only ever access the same instance of a given class. A basic pattern to address this problem would be the Singleton.

If the solution then introduces more problems than it solves; then it becomes an anti-pattern.

In this example; Singletons are hard to unit test; so this is one reason why many consider it an anti-pattern.

Upvotes: 1

Related Questions