What's the worst technical misunderstanding you've ever seen? Wo开发者_如何学JAVArst abuse of a good system due to lack of knowledge?
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.)
Polymorphism.
Didn't really understand it's power at first. Resulted into bloated, and over complicated routines. Boy, try not to remember those days...
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>
Database joins in PHP code
When teaching myself SQL with PHP, I was using SQL like a permanent flat-file type store with complex filtering capabilities (WHERE). I did not understand that you could "join" tables together. All join operations were implemented in a PHP function after all the data was pulled into memory. If I knew more back then I might have called it a nested loops join function! (That will teach you to de-normalize your data very fast!)
I'm sorry database gods!
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. :-(
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.
Back when I was a beginner, I wrote some code in PHP without understanding pointers, objects, or even tuples/structs. I just built all my data structures using PHP's ridiculously flexible, dynamically typed arrays. It's actually pretty surprising how much you can accomplish that way, but I feel bad for anyone (including myself a few months later) that ever needed to modify that code.
That I had to call ToString()
on every variable when concatenating strings, even if the variables were strings.
Examples:
Enum.GetName(...).ToString()
myDate.ToShortDateString().ToString()
...
精彩评论