21

What are some tools/techniques that you have found are clearly the wrong ones for certain problems and should be avoided whenever possible?

As programmers, picking the right tool for the job can make or break the problem you are trying to solve. Unfortunately, making the right decision requires awareness, insight, intelligence and often experience. The following answer on SO talks about the perils of trying to use regular expression to parse HTML. It made me personally think more about my own experience and choices when it comes to solving programming problems and how well, in retrospect, those solutions fit the problem.

One example that occurred to me as being the wrong tool for the job is the use of LINQ queries exclusively for their side-effects. LINQ is definitely one of the hot "new things" in the .NET world, and people often try to fit it into their programs, even if it's not the best choice. It's becoming more common to see people use LINQ instead of more traditional constructs, like for/foreach loops. For many transformation, LINQ is an excellent tool, but an example I recently came across struck me as the wrong fit:

public void MethodRenamedToProtectTheGuilty( List<SomeType> list )
{
    // the code below abuses Select() to produce side-effects and generates
    // an unnecessary List just to force the sequence to be evaluated before
    // the function returns.
    list.Select( (item, index) => { item.ChangeMe(index); return -1; } )
        .ToList();

    // the un-cool, traditional way you would write this is:
    //for( int i = 0; i < list.Count; i++ )
    //    list[i].ChangeMe( i );
}

What are some other examples (in any language or platform) that you think are the wrong tool for the job.

21

Most of my career has been in RDBMS. And one thing that really gets me mad is the fact that people try to use RDBMS for every project. Even small projects where the RDBMS will ever hold a single never changing record.

There are many different database technologies that are more appropriate. There is nothing wrong with Linked Lists, Flat Files, Binary Trees, Text Files, etc. etc.

Please, Please go easy on RDBMS.

15

-- EDIT 2 --

  • CSS is now very mature and reliable. It's come a long way. Still there are designers who say no to CSS and XHTML and still design the websites with table-based layouts. This makes their website non-accessible. I wish they'd goto h**l and that all browsers would display only XHTML compliant pages. [in fact browsers should prompt rendering-errors for such html just as compiler gives error for erroneous code]

  • Using same tools and techniques to fix all problems. You need to use the right technique for each problem. There are close-minded developers who are not willing to learn or adapt new things and apply whatever they already know to solve all problems they come across which is very much incorrect.

-- EDIT 1 --

I think I should merge my answers and post them as single answer.

  • Still using Visual SourceSafe for version control! There are better options with different approaches to version control.

  • Too much relying on ASP.Net Ajax UpdatePanel for partial page updates is dangerous to performance of your asp.net application.

  • Deploying .net application with DEBUG configuration on staging or production environment is Extremely harmful.

  • In general, selecting the right learning resource matters a lot. Whether you are a seasoned developer or a newbie if you happened to pick the wrong book for learning some new topic or subject - you are in trouble. It might take you in a wrong direction and sometimes obfuscate the subject wrongly. I'm quite fuzzy about picking up the right books for learning new things. Authors must be known and be a respectable entity in the field and ratings and reviews on amazon are also seriously considered.

13

Using Lotus Notes to send emails.

(Or as a document repository / suppository)

8

Using XML for application scripting -- at least when scripters are not programmers... Using a real scripting language like lua (or any right language for the job) is way better.

7

Writing your code in Windows Notepad

5
  • XSLT
  • SOAP

Those are the "big 2" that tend to make me run a mile. They all exist for very good uses, and when they're right they're really right, but most of the time it's a bit of architecture astronomy if you see those in any given solution.

Lately I'd have to add stored procedures to the list. In this day and age, they're the wrong tool for the job 90% of the time. "Back in the day" they were a jolly good choice for providing that layer of separation. Nowadays there's too many attractive options, and sprocs tend to bog down development, deployment and testing :-)

Heck, even XML itself can be the wrong tool for the job sometimes. It's ugly and heavy, which is fine for a serialised config file that's not supposed to be human readable. If you're ever likely to ask the receptionist to open the config file in notepad you might want to consider something a tad more readable.

I quote like stefano's answer too, I think that boils it down. We're geeks, we like to play with new shiny things and tell ourselves we've done such a kick ass job solving the simple problem with the big hammer. Or, we don't like any of this new fandangled malarkey and we stick with the ol' tried and true stuff we know. Either way, one day someone is going to look at the tangled mess of stuff and go "what were they smoking??"

5

IM to deliver passwords.

It is insecure. Conversation may be logged on the receiver side.

It happens more often than one could expect.

4

Visual Basic. Always the wrong tool for any job.

3

AJAX is great in the right circumstances but I would say maybe eighty percent of places I see it used, it either offers no benefits or more commonly it actively impedes users of the site.

Why would you need to make an asynchronous request to the server to retrieve the contents of a navigation subheading when there are only fify pages on the site total? Why would you only offer search using AJAX so that there is no way to bookmark results or use the back button to go back to a previous search result? In the majority of circumstances there is no need for asynchronous data retrieval within a regular web page and the web paradigm is simply not designed for it- the "back" button is too valuable to most users.

In the past it used to be Flash that was constantly abused in this respect, but these days this seems to have taken over somewhat.

2

In my experience, one of the cases "wrong tool for the job" is when you adopt (or have to adopt) a very heavyweight technology for " coolness' " sake, but you are a small team and cannot deal with the adoption curve and at the same time be productive.

Once I saw a team of two people having to deal with database technology, java applets, javascript ajax, php programming, perl programming, tcsh scripts, and SOAP/WSDL, at the same time. While they did achieve some result, the result was so precarious and undocumented that:

  1. a small change in the system, even a bit of invalid data, would make the whole structure collapse with poor understanding for any future maintainer
  2. they could not get anyone else on board to help them
  3. Once they got the paper, the thing was left to rot.

Side note to clarify the context: the latest point is particularly interesting because this is the typical situation of academia. Teams are small and generally made of unskilled students, interoperability between research groups is seldom obtained due to heterogeneity of interests, skills, and research focus.

In other words, you should use the technology that better suits you, and consider the strength of your team against the productivity curve you can obtain. If the learning phase is too steep, and/or you would end up driving a mass of code too big for your team, then you chose the wrong tool.

2

Using JavaScript to perform processing in the browser that would be easier to write and easier to test if it was done server-side with an ajax call.

2

Unit tests used as integration tests.

Unit tests are there to test units of code, not the integration of complete application and other systems. I've seen unit tests depend on external DBs or LDAP directories.

Usually this shows pure code architecture.

2

Honestly speaking sometimes its lack of reasoning before deciding the right tool. Before using the tool if you cant reason it then its definitely the wrong tool for the right job. A famous anecdote

Q. How many developers are required to change a lightbulb?   
A. None. Its a hardware problem!
2

When a corporation who declare Microsoft products and tools as their standard, without ever looking elsewhere regardless of the project, rewrite a working system soley because it was not done with a Microsoft product prior to the standard being mandated.

2

Using programmers for non-programming tasks.

1

Using Maven for a project that doesn't follow Maven conventions.

Although Maven core tries more and more to make itself configurable, Maven's usefulness lies in its plugins, and many of them are just incredibly hard to configure if you step out of "the Maven way"(TM).

Maven is useful if your projects follow its convention.

1

Versioning Control System for delivery of build artefacts.

Sometimes it is so tempting to just commit freshly build deliverable into subversion because the file is too big to be sent per email and there is no suitable file-server to put it on (or any other 100 reasons people sometimes find). Please, resist it as VCS is there for other purpose.

1

when it comes to worst-practices, considering inheritance a tool: wrong use of inheritance and the use of abstract base classes for dependency inversion:

class Rectangle {
 //....
}
class Square extends Rectangle {
 //override setters of width and height here, to keep them equal, breaking invariants
 //Square has a size and that's it.
}

and this is something I see in many frameworks.

class PluginBase {
 //stuff
 public Type1 foo() {
  return someExpressionOfType1;
 }
 abstract Type2 bar();
}
class FrameworkClass {
 //stuff
 private void usePlugin(PluginBase plugin) {
  plugin.foo();
  plugin.bar();
  //and so on
 }
 public void addPlugin(PluginBase plugin) {
  //some implementation
 }
}

Clearly, FrameworkClass should only depend on some IPlugin, and PluginBase is just a help you offer to implementors.

when it comes to bad tools:

  • using PHP to create cutting edge frameworks: seriously, it's an awful language ... there are some really great PHP frameworks, yet the language is a horror, and I think the result could've been better, if people had chosen other platforms to build on ...
  • using XML to serialize objects: you cannot do that without adding additional constraints or doing serialization/deserialization by hand (i.e. per class) ... YAML and JSON correspond much more to object semantics of most languages ...
  • using Flash to stream videos: seriously, I love the flash player platform ... but if you're not using windows, then the performance of flash player's video decoding is so horrible, it emberasses me ... let people use divx, quicktime or java or whatever ...
  • using HTML to create complex user interfaces with funky designs: HTML was never designed for that, and it is very much misused to achieve this ... if you want to create these sort of rich applications, use SVG + JavaScript or flash, or java or silverlight ... it's HyperTextMarkupLanguage ... and divs were not designed to serve as buttons ... hopefully html5 will solve that problem ...
  • using TCP for RPCish communication or chunk transmission in general: TCP is a stream based protocoll ... it doesn't have ANY of the semantics required ... all it offers is reliability (and even that's really poor) ... use protocols like DCCP instead, or build your own on UDP ... in cases when order is of importance, combine multiple messages into one ...

there are quite a few others I can think of, but I believe their impact is of less importance ...

greetz

back2dos

0

The biggest anti-pattern I have seen is the over use of Selenium. People using Selenium to test databases and all sorts of things!

0

Anything that is two major versions out of date and that is still having new features added to it.

0

Using a text editor to modify html tables and cells. Sometimes, the value of having a WYSIWYG editor to be able to select and delete easily is underrated.

Or maybe I haven't yet heard of the right vim combo for this. Care to enlighten me?

0

Use of one language to tackle all problems

This is a common issue where I work. For example:

Using C for string processing as well as application development.

Using Perl for application development as well as string processing.

Using C for implementing application policy as well as application mechanism (instead of a Domain Specific Language or plug-in scripting).

Often this comes from a love of the power achieved from a lifetime of using one language, or a reluctance to learn what appears to be a fiddly and underpowered language that you don't know.

Using a compiled tool to for interactive investigation ? use an interpreted, interactive one.

As the pragmatic programmer states ? Learn a new language every year.

Individual languages are optimised for different tasks - so don't bend your current one to the new task - learn the appropriate lanaguage and write fast, concise and appropriate code to suit the problem.

0

The worst abuse I've seen in a while: A stored proc to format a string. This was a vb.net web application.