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
0
votes
2 answers

Is MEF a Service locator?

I'm trying to design the architecture for a new LOB MVVM project utilising Caliburn Micro and nHibernate and am now at the point of looking into DI and IOC. A lot of the examples for bootstrapping Caliburn Micro use MEF as the DI\IOC mechanism.…
Adam Hardy
  • 377
  • 3
  • 9
0
votes
1 answer

Is it advisible to launch an executable from a webpage

I have a requirement wherein I need to launch an application (assumed to be installed on the user's machine) from a webpage. I found that there are several ways of doing so, but I would like to know if this is an acceptable solution. Is it OK to…
Raam
  • 10,296
  • 3
  • 26
  • 27
0
votes
2 answers

Is this an anti pattern? If so why? If not why not?

I'm working on a bit of code where we're creating object models but the models have generic keys. For example class myContact { var key; var value; } And then in the code instantiating them as follows myContact = new myContact() myContact.key =…
Alan Hollis
  • 1,292
  • 3
  • 14
  • 29
-1
votes
6 answers

Common design by obfuscation practices?

What are some common practices you have seen used in the design by obfuscation crowd? I find it interesting to be on projects that are not allowed to be rewritten while, that would be the faster and most efficient solution to the problem.
Matthew Whited
  • 22,160
  • 4
  • 52
  • 69
-1
votes
1 answer

Passing current service object to domain will be a anti pattern for DDD?

I have service which is getting domain from repository and passing its own instance to the domain for some external dependency. Can it become anti pattern? RichDomainModel suggests to pass dependency to domain as required, however I am concerned if…
-1
votes
1 answer

Which design (using OOP) is better? Externalized or internalized logging?

I need to verify log information(error messages) along with the result set. Here logging can be also understood as report generation in my case. Externalized Logging Should I store the log messages(for any errors) along with result and do the…
arvindkgs
  • 373
  • 4
  • 12
-1
votes
1 answer

parsable sql anti-patterns

I am working on an SQL script-inspecting software. Do you know about any SQL anti-patterns that can be possibly parsed automatically? False positives are okay.
-1
votes
1 answer

How do you call this (anti?)pattern where every operation returns an instance of a result class?

Does the following (anti?)pattern have a name? every function returns an instance of a result class (or structure, or associative array) that has at least these two public variables: success: a true/false value to hold if the action completed…
beppe9000
  • 1,056
  • 1
  • 13
  • 28
-1
votes
2 answers

Bad code c# project example

I am looking for examples (preferably open source) of C# projects I could use in my thesis as an example of bad code. Ideally a small project you would expect a "garage developer" to create. E.g. horrible naming, not disposing objects, god classes,…
LH_
  • 21
  • 2
  • 5
-1
votes
2 answers

Are Gulp Recipes an Anti-Pattern?

I think most would agree that copy and paste as a solution to reusability is an anti-pattern, so isn't copying and modifying a "Gulp Recipe" the same thing or am I missing something?
Resist Design
  • 4,462
  • 3
  • 22
  • 35
-1
votes
1 answer

Is heavy (slf4j logger) method overloading an anti-pattern?

slf4j is heavily overloading methods: Method Summary void debug(Marker marker, String msg) Log a message with the specific Marker at the DEBUG level. void debug(Marker marker, String format, Object... arguments) This…
Jas
  • 14,493
  • 27
  • 97
  • 148
-1
votes
1 answer

Is this BaseBeen anti-pattern?

I have an utility library with the class ConsoleApp, which has only static method like GetIntValue(string name) to ask user to enter the integer value of the parameter with specified name, or functions to parse command line parameters. As for me…
Oleg Oshkoderov
  • 500
  • 1
  • 4
  • 17
-1
votes
4 answers

Good and bad ways to use operation contracts.

Hi I have been reading some lecture notes and I cant work out why this method: [OperationContract] Student PostStudent (Student student); Is good. And this method is bad: [OperationContract] void PostStudent (string firstname, string lastname…
G Gr
  • 6,030
  • 20
  • 91
  • 184
-2
votes
0 answers

Why even allow file handling without "with"

This may be rudimentary question for some and not even a programming one technically but I just stumble upon a thought process which I could not find an answer myself. As we all know file handling operations are one of the important aspect of the…
DoctorAV
  • 1,189
  • 1
  • 14
  • 40
-2
votes
1 answer

Singleton is design-pattern or anti-pattern?

Singleton is design-pattern or anti-pattern??
1 2 3
29
30