views:

453

answers:

6

What's the worst technical misunderstanding you've ever seen? Worst abuse of a good system due to lack of knowledge?

Edit: The programming gods have let me know that you will be absolved for all sins you confess here!

+7  A: 

I didn't know I could write my own functions (php)

When I was teaching myself to program years ago I wrote an entire php web application without a single function. All code reuse was done by calling include(...) on other .php scripts. The book I was learning from never introduced the concept of user defined functions. (The day I learned about functions was a very good day.)

Bob Albright
holy crap! are you serious :D
Rakesh Juyal
Seen a similar thing before at a job I consulted on very briefly (bought in by the product owners - but had to work with a different company that developed the web app). This dev company had the mistaken belief that calling a function was too expensive in PHP so their code tended to look like what you're saying. While there were a couple of method calls and includes, a regex to validate an email address in a couple of places shouldn't be encaplusate in a method - but copy paste it wherever you need it - eventually gave up trying to convince them that method call overhead is not important
saret
The app i currently have to maintain must have been from you. Ok, it has a wrapper around the mysql functions but thats it. I've seen a single SQL Query repeated 12 times in _one_ file.
dbemerlin
Don't worry... my code has long since died and been replaced. I've learned my lessons! (and I worked alone at the time and had no one to teach me better practices) :)
Bob Albright
well you should consider yourself successful. I don't think it is easy to achieve that :)
celalo
+3  A: 

Polymorphism.

Didn't really understand it's power at first. Resulted into bloated, and over complicated routines. Boy, try not to remember those days...

Rev316
I can see what you mean. At first I was mostly seeing Object Orientation as way to keep functions and data together. Like how C++ let you declare functions inside a struct. I was aware of the virtual keyword but I didn't really see the usefulness. Smalltalk implementation of the if control structure with polymorphic #ifTrue: and #ifFalse was a real eye-opener.
Alexandre Jasmin
+1  A: 
Bob Albright
+1  A: 

The worst i've ever done was storing comma seperated ids in a database. I did not fully understand joins so it was the easiest thing i could do but the queries where horrible
(WHERE foo_ids LIKE "%,$id,%" OR foo_ids LIKE "$id,%" OR foo_ids LIKE "%,$id").

The worst thing i regularly see are classes that just work like namespaces with all methods public static (PHP).

EDIT:
I just remembered the time when a school mate tried to create an XML file for a database table

Table:

teacher_id | name
         1 | foo
         2 | bar
  ...      |   ...

His XML:

<teachers>
  <id1>foo</id1>
  <id2>bar</id2>
   ....
</teachers>
dbemerlin
+1  A: 

Some Java - "developer" (lol) trying to write a piece of software in C#, not knowing that this is a modern language with a "foreach" - statement.

Result:

Software had iterations using... iterators. Ugly, 90s style, typical of Java.

Made me hate Java even more. :-(

Turing Complete
But Java has a foreach statement (`for (e : iterator) {}`), so the developer was just generally ignorant.
JAB
Except theres a time and place for iterators depending on the operations being performed in the loop. The big example is when you need to remove something from the collection that you're iterating over.
Freiheit
@FreiheitIf you are doing that THIS way, you are doing it wrong. IEnumerables are to be considered immutable, if you need to mutate them, you are supposed to create a modified copy. Everything else is premature optimization.
Turing Complete
Slight correction to my previous comment: that shouldn't be "iterator" but "collection"/"object being iterated over".
JAB
@Turing complete - not in Java: right from the early days, it's explicitly supported non-immutable Enumerators. I consider this an intelligent improvement on early C based enumeration that was more interested in what was easy to implement than in what real-world programs actually needed.
Adam
@AdamIf a program needs a mutable enumeration, the developer isn't a good one. Functional programming will tell you why. :-)
Turing Complete
A: 

A colleage and I worked as consultants on a medium software project. He'd been working for a year on similar projects, so he was billed to the client as an "expert" on the platform.

Soon I discovered that my colleage didn't fully understood the fine points of file I/O on the language we were using, consequently leaving lots of subtle bugs. The funny thing is, all his previous projects had the same subtle bugs but the clients learned to use the system in ways that didn't trigger them.

ASalazar