views:

384

answers:

8

I saw this question and it reminded me of AutoGenerateColumns in the old DataGrid. The few times I've used them, I ended up backing it out because I needed data formatting past the standard "spit out the Data Source columns." Likewise, with toggle, it sounds like it would save time, but then you end up needing to keep track of state or something else, and you rewrite the code accordingly.

Are there things that you end up using thinking it will save you time, but end up backing out because it doesn't do what you need?

+5  A: 

Make a little improvement in an existing working system and not cover it with tests.

For many times it ended up with debugging hell. Worst of all that the hell went to my colleagues, not me.

nailxx
+3  A: 

I think the obvious answer for the most regrettable programming "shortcut" would be gotos.

But regarding frameworks, I think all frameworks can be a trap sometimes. They're not bad to use but I don't think you'll find a framework that doesn't force you to purchase reduced development time with reduced maintainability. I work mostly with Drupal, and every time a new version comes out I have to rewrite at least some of my custom code... but that's the price I pay for being able to add new features quickly with community modules, and for me, it's worth it. For a different set of purposes or applications, it certainly wouldn't be worth it.

Reynolds
-1 for bashing goto. If the world were perfect and recursion were implemented and supported fully in every programming language (stack expands dynamically, tail recursion is optimized, coroutines or continuations are supported, etc.), then any program could be written elegantly without gotos. If one is trying to avoid recursion, goto is often the simplest way to implement a state machine (and don't tell me switch/case is better; it's more verbose). My JSON library uses goto-based state machines in many of its functions: http://constellationmedia.com/~funsite/static/json-0.0.2/json.c
Joey Adams
+1 for frameworks, and I won't touch the "goto" argument.
bmb
+1 for the note on frameworks, though :) (bah, SO won't let me change it)
Joey Adams
I worked at a place many many years ago (using some UNIX based basic style language) and the people there only used GOTO, never a WHILE, never a FOR, never a REPEAT, and never declared a function/subroutine, even though the language DID supported all of those. needless to say their app had so many bugs and caused so many "fires" it was almost comical. I tried to explain the importance of control structures but they were really old school in a bad way.
KM
@KM: Indeed, I agree it's best to default to structured programming and recursion first, and know when goto is appropriate. Here's my favorite illustration of gotos gone wild: http://www.ticalc.org/pub/89/asm/games/peg_game.zip
Joey Adams
+2  A: 

Letting Visual Studio do the Data Binding. It works most of the time, but sometimes it introduces subtle bugs that take far more time to find and solve than it would doing the data binding manually.

Malfist
I get doing databinding manually for web. But ugh, i can't image doing it for a fat client application. I think I would go bonkers if I had to write databinding code all the time. :)
Tony
+1  A: 

The over usage of C/C++ macros. I think it's a trap big projects fall into more than small projects though.

Earlz
Challenge: find out where putchar is implemented in glibc.
Joey Adams
+3  A: 

Every large web project that starts with a huge amount of modularity usually goes too far for the scope of the application that will eventually be built.

So, the web layer calls a delegate interface calls delegate implementation calls service interface calls service implementation calls dao interface calls dao implementation and so on.

And eventually, since you didn't do distribution at this level, you notice that all of your delegate implementations are one line of code, and you pull them out for clarity, after losing some efficiency by writing a hundred delegate classes in the first place.


Or: most projects at one point or another massively overestimate how large the application's userbase will be, and unfortunately, code for that instead of coding more efficiently. A cookbook application with 200 users is a lot more common to write than an industry-defining application with a hundred thousand users every morning, but developers tend to code part - but not all of - their app for the improbable case.

If you're writing hello world, just write the code, and bulk it up later as needed.

Dean J
Dean J, seems like you're describing the opposite of "shortcuts" that you end up regretting. You make excellent points, but those seem like longcuts...
bmb
They were intended as longterm shortcuts; make the code easier to maintain overall. They wound up being short-and-longterm mistakes. Oops?
Dean J
+1  A: 

Not exactly a shortcut, but: Writing a C++ String class without even considering the possibility that someone else has had the same idea. However, it was a good exercise, as I learned that:

  • Writing a library doesn't make all of programming downhill from there. It can be easier to have a library on hand, but if it's harder to understand the semantics of the library than to implement the functionality by hand, the library can turn out to be pretty useless.
  • C++ has a lot of really neat features.
  • C++ is always missing that one feature I really need.
Joey Adams
Often I find a library that looks like it does what I need it to do, and then in practise it's clunky, slow, etc. By the time I've figured out how to fix someone else's code, I end up scrapping it and writing my own anyway. It doesn't seem to take more or less time--either way there's a learning curve and experimentation before it's done the way you want it.
Kev
@Kev: Sounds just like what I went through writing my JSON library.
Joey Adams
How is reinventing an over-reinvented wheel a shortcut??
Victor
@Victor: As I said, "Not exactly a shortcut". It seemed like a shortcut to me back when I was writing it, as I thought "Once I get this String class written, it'll be just like Visual Basic and everything will be easier!" I know better now :-)
Joey Adams
Hey, not that I didn't do it too! I wrote the same (useless) web framework in java and php a couple of times before wising up. (In my defense, that was before rails. (but after struts...))
Victor
+2  A: 

Copy/pasting a few lines of code that are similar to, but not exactly the same as the code you need right now, will almost always result in a bug in that code.

It's almost always better to just type it character by character, forcing yourself to consider everyone of them. But I keep doing it, thinking: "what could possibly go wrong", and regretting the decision later.

Emile Vrijdags
It's better to abstract it enough so that you don't have duplicate code laying around :P
Earlz
can't abstract every line of code though :p
Emile Vrijdags
+2  A: 

Using the latest and greatest feature from <insert framework here> only to have it fail and take longer.

I am all for new features but to use them too soon can be problematic.

Tony
+1 - Yes! Entity Framework, I'm looking at you!
John