• Advertisement
Sign in to follow this  

Hacks and effectiveness

This topic is 3840 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I recently read a thread where two people mentioned "lazyness" as their top two qualities a programmer should have. I'm not sure if it was meant as sarcasm, but it got me thinking. When I need quick (or not so quick) solutions I sometimes pull quite ugly hacks into the code. They perform nicely and everything works, but I keep going back to them when I don't have to, to fix them. If I don't fix them, I constantly think about it and feel bad about it. Not so rarely I even try to rewrite the code in question. Now, I'm (obviously!) a hobby programmer - but I would say that this is killing my productivity. Is someone else feeling this way? Do you hack alot, and does it bother you?

Share this post


Link to post
Share on other sites
Advertisement
I think I rather belong to the lazy ones. I rewrite Stuff only if I really need to, and even then, I often finish the other Stuff first which is more fun to write.

But I think it can be good to be a perfectionist. When you work out new techniques for a project and optimize them, even it's not really necessary, you also learn to think in new ways. Both may help you in your next projects.

Edit: By the way, do you have a link to that thread? Sounds like an interesting one...

Share this post


Link to post
Share on other sites
Hacks are bad. Write code which can easily be changed, modified, tweaked, or replaced. Might take a little bit longer to do initially, but will potentially save you a lot of time in the long run.

The only time I will add a hack dirty code is:

1) Submission day - where rewriting an entire section of code is not an option. Patch it up, make sure you handle each case, and test it to hell before committing.

2) Before diving into a larger task - I'll hack a pre/post condition in to make sure the code I've wrote works so far, but remove it when the task is fully completed, when it is not actually needed anymore.

3) If I am forced to use someone else code and it is totally unusable, and they do not know how it works at all. I will usually rewrite if time permits so no one else has to suffer the pain.

Share this post


Link to post
Share on other sites
It comes only down to this. Your code will be: Good, Fast, Cheap. Pick any two.

Disclaimer: Fast applies to "Developed quickly, in arbitrarily short amount of time".

For many business tasks, that means that an application with estimated workload of 17 man-weeks must be completed and deployed by Friday.

Share this post


Link to post
Share on other sites
I'm an OCD perfectionist through and through, although on web projects I tend to be a bit lazier because I'm usually just trying to get it done when I'm on web projects. I think I respect C++ too much to be hasty with it, C++ errors get far uglier than anything I've done for web development.

Sometimes I do have to accept that things will be less than perfect, but I've already refactored my current engine project dozens of times and now I want it to work on Linux too and that has me pulling hairs out. Maybe I need medication...

I know that I will finish this though. I've completed plenty of dinky projects in javascript and did plenty as a kid with QBasic, so I know what it is to finish something. Regardless, that is partly why I just want 1 good quality hobby project done. I'm tired of only half understanding how my projects work.

Share this post


Link to post
Share on other sites
Quote:
Original post by SymLinked
I recently read a thread where two people mentioned "lazyness" as their top two qualities a programmer should have. I'm not sure if it was meant as sarcasm, but it got me thinking.

By "laziness", they mean they don't re-invent the wheel. If there is a solution available, it is generally better to use it than to implement yet another version of it.

Quote:
Original post by SymLinked
When I need quick (or not so quick) solutions I sometimes pull quite ugly hacks into the code. ... I would say that this is killing my productivity.

While an ugly hack may be useful in the short term, it is likely to cause problems down the road -- it's a tradeoff.

Share this post


Link to post
Share on other sites
Quote:
Original post by SymLinked
I recently read a thread where two people mentioned "lazyness" as their top two qualities a programmer should have. I'm not sure if it was meant as sarcasm, but it got me thinking.


It is generally meant not as sarcasm but as zen wisdom.

Share this post


Link to post
Share on other sites
Quote:
Original post by JohnBolton
By "laziness", they mean they don't re-invent the wheel. If there is a solution available, it is generally better to use it than to implement yet another version of it.

One of my teachers used to say "A good engineer is a lazy engineer" and refers to exactly that. Do not try to invent/create everything yourself, it is possible someone else already did it and probably did it better than you can ever do.

Quote:
Original post by SymLinked
When I need quick (or not so quick) solutions I sometimes pull quite ugly hacks into the code. They perform nicely and everything works, but I keep going back to them when I don't have to, to fix them. If I don't fix them, I constantly think about it and feel bad about it. Not so rarely I even try to rewrite the code in question.

Don't put hacks into your code in the first place. ;-)

Share this post


Link to post
Share on other sites
Quote:
Original post by SymLinked
I recently read a thread where two people mentioned "lazyness" as their top two qualities a programmer should have. I'm not sure if it was meant as sarcasm, but it got me thinking.

When I need quick (or not so quick) solutions I sometimes pull quite ugly hacks into the code. They perform nicely and everything works, but I keep going back to them when I don't have to, to fix them. If I don't fix them, I constantly think about it and feel bad about it. Not so rarely I even try to rewrite the code in question.

Now, I'm (obviously!) a hobby programmer - but I would say that this is killing my productivity.

Is someone else feeling this way? Do you hack alot, and does it bother you?

Hacking is not lazyness, it's doing things in the wrong way. Not to mention that in the end, you get more work to do.

The key to effective lazyness is to do things correctly in the first place, so that you don't have to waste your time hacking it later. Your goal is to minimize your work, and in order to be able to do so, you must use your tools to the best of their capabilities, and your code must be good enough to allow easy modifications later. That way, you can boost your productivity, meaning that you'll finish your day sooner and you'll go home sooner. Which is nice if you live near the Sea, like me.

(but to be honnest, I don't benefit from this productivity gain - mostly because the extra time I get is spent doing more things...)

Share this post


Link to post
Share on other sites
Actually, if all you're doing is writing a prototype then rushing a few parts just to get it minimally functional may be what you need to do.

Of course with a prototype, the resulting code is thrown out and refactored correctly in the next revision. Prototypes are experiments, and their resulting code is not meant for release or reuse.

Share this post


Link to post
Share on other sites
Quote:
Original post by SymLinked
I recently read a thread where two people mentioned "lazyness" as their top two qualities a programmer should have. I'm not sure if it was meant as sarcasm, but it got me thinking.


FWIW, I was one of the people who listed laziness, and I wasn't being sarcastic. What I meant was that, a good programmer should always want to do as little as possible. You should aim to write as little code as possible, and not reinvent any wheels when you program. In the same vein, you should keep things as simple as possible, in keeping with the KISS and YAGNI principals.

So, basically, to reiterate what Emmanuel Deloget said:
Quote:

Hacking is not lazyness, it's doing things in the wrong way.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement