Questions tagged [anti-patterns]

A programming anti-pattern is a commonly used solution to a specific programming problem, often claiming being an actual design pattern. But such a solution usually leads to adverse effects on an application scalability, testability and maintenance.

An anti-pattern can be thought of as a "worst of breed" solution to a problem in that it may "work" for its intended purpose, but have unwanted side effects or incur technical debt. Anti-patterns can arise from improper education, insufficient experience or simple ignorance.

SQL-Injection

In short, this is an anti-pattern of applying unfiltered user input directly to a database query string. This may seem like a quick and easy solution to querying data, however it can lead to data corruption, security breeches, and so-forth.

Example:

query-string = "select * from users where id='" + userid + "';"

Assuming the userid variable came directly from the user, an attacker can cause issues by setting the value to something that would cause unexpected behavior:

userid = "' or 1=1;drop table users"

Tight coupling

Instead of keeping two distinct parts of an application separate (CSS and HTML; Business Logic and the View in an MVC application), the parts are mingled such that a change in one necessitates a change in the other.

Example:

CSS

.yellow { color: yellow; }

HTML

<div class="yellow">foo</div>

In order to change the formatting, either the content (HTML) must be changed by substituting a different class name, or the class definition (CSS) must be changed to something that doesn't match its name.

Others

Wikipedia has other examples.

440 questions
-2
votes
1 answer

Are Fully Defined Relationships in Entity Framework a code-smell

Here's the classic example: public class Blog { public int BlogId { get; set; } public string Url { get; set; } public List Posts { get; set; } } public class Post { public int PostId { get; set; } public string Title {…
Ash
  • 2,021
  • 2
  • 26
  • 59
-3
votes
1 answer

How can I use patterns to process data in a specific way in ArrayList in Java?

There are several strings in my array list and some of them start with a specific prefix -for example ("AFI"). I want to remove these strings from the array list. Other strings contain more than two words, for example ("Edit this template"). I want…
Rumato
  • 147
  • 7
-4
votes
1 answer

What are the common pitfalls in the Go language?

I am planning to do some program analysis on Golang, just like pylint, trying to find issues from source code. So the first question I need to ask is: What are the common pitfalls specialized in the Go language? I know there are some ones in…
Tao HE
  • 300
  • 1
  • 5
-4
votes
2 answers

Django runserver style restart from within a django app

Pls read no further if you're squeamish or pious about django!... It turns out one of the several reasons you shouldn't use django "runserver" development server in production is it's horrible with memory, storing everything it sends or receives…
Roger Heathcote
  • 3,091
  • 1
  • 33
  • 39
-11
votes
1 answer

Why Dart Team does not follow their own style-guide? Or we all also must follow this guide?

I cannot understand for whom Dart style-guide was written? Dart Style Guide Term PREFER form this guide: "PREFER guidelines are practices that you should follow. However, there may be circumstances where it makes sense to do otherwise. Just make…
mezoni
  • 10,684
  • 4
  • 32
  • 54
1 2 3
29
30