anti-patterns

Are subversion externals an antipattern?

Subversion lets you embed working copies of other repositories using externals, allowing easy version control of third-party library software in your project. While these seem ideal for the reuse of libraries and version control of vendor software, they aren't without their critics: Please don't use Subversion externals (or similar ...

What are the most common SQL anti-patterns?

All of us who work with relational databases have learned (or are learning) that SQL is different. Eliciting the desired results, and doing so efficiently, involves a tedious process partly characterized by learning unfamiliar paradigms, and finding out that some of our most familiar programming patterns don't work here. What are the c...

When are global variables acceptable?

Everyone here seems to hate global variables, but I see at least one very reasonable use for them: They are great for holding program parameters that are determined at program initialization and not modified afterwords. Do you agree that this is an exception to the "globals are evil" rule? Is there any other exception that you can t...

What anti-patterns exist for JavaScript?

I find that what not to do is a harder lesson to learn than what should be done. From my experience, what separates an expert from an intermediate is the ability to select from among various seemingly equivalent ways of doing the same thing. So, when it comes to JavaScript what kinds of things should you not do and why? I'm able to f...

What is the format of a Borland 5.0 project file?

I have an old Borland project which I would like to port to VS2008. Is there any way to dump, in a human readable format, the source file, compile options and dependency information from a .ide file? I'd like something a bit more comprehensive than the 'Generate Makefile' option. ...

What types of coding anti-patterns do you always refactor when you cross them?

I just refactored some code that was in a different section of the class I was working on because it was a series of nested conditional operators (?:) that was made a ton clearer by a fairly simple switch statement (C#). When will you touch code that isn't directly what you are working on to make it more clear? ...

Entity objects getters and setters for data properties

I recently started working in Java and was introduced to the wild and crazy world of getters and setters for everything. I hated it at first, but quickly got used to it. Too used to it. I have been spending a lot of time lately thinking more about class design. One of the things I am trying to do is avoid the trap of doing getters and s...

Last Updated Date: Antipattern?

I keep seeing questions floating through that make reference to a column in a database table named something like DateLastUpdated. I don't get it. The only companion field I've ever seen is LastUpdateUserId or such. There's never an indicator about why the update took place; or even what the update was. On top of that, this field is so...

Performance anti patterns

I am currently working for a client who are petrified of changing lousy un-testable and un-maintainable code because of "performance reasons". It is clear that there are many misconceptions running rife and reasons are not understood, but merely followed with blind faith. One such anti-pattern I have come across is the need to mark as...

What is the most EVIL code you have ever seen in a production enterprise environment?

What is the most evil or dangerous code fragment you have ever seen in a production environment at a company? I've never encountered production code that I would consider to be deliberately malicious and evil, so I'm quite curious to see what others have found. The most dangerous code I have ever seen was a stored procedure two linked-...

Design patterns to avoid

A lot of people seem to agree, that the Singleton pattern has a number of drawbacks and some even suggest avoiding the pattern entirely. There's an excellent discussion here. Please direct any comments about the Singleton pattern to that question. My question: Are there other design patterns, that should be avoided or used with great c...

AntFarm anti-pattern -- strategies to avoid, antidotes to help heal from

I'm working on a 10 page web site with a database back-end. There are 500+ objects in use, trying to implement the MVP pattern in ASP.Net. I'm tracing the code-execution from a single-page, my finger has been on F-11 in Visual Studio for about 40 minutes, there seems to be no end, possibly 1000+ method calls for one web page! If it wa...

Is having a ubiquitous base object an anti pattern?

I remember seeing a debate about this somewhere, and am currently considering removing a base object that every business object, in a system I'm working on, inherits from. It contains a few properties, some database logic, and some constructor logic. Is this an anti pattern, or is the jury still out? Would it be better to have a base co...

Can the Diamond Problem be really solved?

A typical problem in OO programming is the diamond problem. I have parent class A with two sub-classes B and C. A has an abstract method, B and C implement it. Now I have a sub-class D, that inherits of B and C. The diamond problem is now, what implementation shall D use, the one of B or the one of C? People claim Java knows no diamond ...

What anti patterns do you use even though you know you shouldn't?

Am I the only one that sometimes take the seemingly easy, but wrong, way out of certain design situations? I'll admit I've made my share of questionable Singleton objects. Besides that, I've been known to make a God object or two to make things seem easier. Do you ever use an anti-pattern even though you know you shouldn't? ...

Python-specific antipatterns and bad practices

What python-specific antipatterns do you know? Could you also give an example, please. ...

Alternative to 'for i in xrange(len(x))'

So I see in another post the following "bad" snippet, but the only alternatives I have seen involve patching Python. for i in xrange(len(something)): workwith = something[i] # do things with workwith... What do I do to avoid this "antipattern"? ...

Is the 'synchronized' keyword in a classic enterprise application suspicious?

I am talking about classic enterprise applications. Typically hosted in some kind of application-server or container. Nothing fancy, just entities, services, Presentation/UI and relational storage. Whenever I see the synchronized keyword (either on methods or for blocks) in such an application I get very suspicious. In my opinion this i...

Are staging tables / staging databases an anti-pattern?

Are staging tables an anti-pattern that is used when rpc (such as Java RMI or some kind of Web Service call) or messaging queue (such as JMS) would be a better solution, or are there problems better served by staging tables? To clarify: By staging tables I mean those cases where records are appended to a table or tables by a process wh...

Premature Refactoring?

We have all heard of Premature Optimization, but what do you thing about Premature Refactoring? Is there any such thing in your opinion? Here is what I am getting at. First off, reading Martin Fowler's seminal work "Refactoring" quite literally changed my life in regards to programing. One thing that I have noticed, however, is that i...