|
Or in other words - if it ain't broken, don't fix it 
|
|
|
|
|
While I'd like to say I don't do hacks, I sadly cannot (while being honest) Given the poor quality of some of my employer's codebase, doing a proper fix instead of a hack could sometimes inflate the scope of work beyond reason, and leave the possibility of introducing more bugs. Sometimes it is best to leave a little hack here and there in order to avoid going down some really messy rabbit holes, especially when there are deadlines to consider!
|
|
|
|
|
For the very rare cases when I write code which looks 'really' nice, I'm asking me when I should refactor it that it matches more with the rest of the hack-code-base.
It does not solve my Problem, but it answers my question
Chemists have exactly one rule: there are only exceptions
modified 19-Jan-21 21:04pm.
|
|
|
|
|
I have an informal metric which I call the "kludge limit" -- I'll do a hack on some code 2 or 3 times, but then it's hit the "kludge limit" and I rewrite the whole module right.
Truth,
James
|
|
|
|
|
That sounds about right to me. I can't recall a significant project I've worked on that didn't have one hack in it. Major projects are typically going to have one or two. After that, it's time for a rewrite.
That's what //HACK: is for! VStudio will even give you the list of these comments in your project.
Real programmers use butterflies
|
|
|
|
|
I would prefer to fix the problem properly than leave a workaround. If time is not permitting then I would make sure I properly commented the workaround so that the next person to come across it understood why it was there.
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." - C.A.R. Hoare
Home | LinkedIn | Google+ | Twitter
|
|
|
|
|
If it is safe, doesn't affect performance, and works, then it was a fix, not a hack.
Money makes the world go round ... but documentation moves the money.
|
|
|
|
|
If that piece of code is only readable by the author, it means it becomes a liability. That's what I would consider a hack and it should not stay. It's not only my professional reputation that is on the line but more importantly it should be about ethics and courtesy that we all should abide to so we make the next guy's life better and the legacy of your work safely replaceable or refactored.
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson
Our heads are round so our thoughts can change direction - Francis Picabia
|
|
|
|
|
If I create a hack in order to get it to work, I add a comment above and below to indicate that it is a hack and the date. I would love to fix it in the future, but the reason for the hack is that I did not have the time to explore a better way to do what needed to be done. Net result: I will probably NEVER have the time to fix it, unless it breaks.
When it breaks, I use the date to look up the original problem, my research into a better way, my reasoning and so forth in my notebook. (I keep a daily journal of everything I do at work. It is a great CYA hack. )
__________________
Lord, grant me the serenity to accept that there are some things I just can’t keep up with, the determination to keep up with the things I must keep up with, and the wisdom to find a good RSS feed from someone who keeps up with what I’d like to, but just don’t have the damn bandwidth to handle right now.
© 2009, Rex Hammock
|
|
|
|
|
|
"If it works, leave it in and create a tech debt so that it can be addressed in the future."
/ravi
|
|
|
|
|
Low-interest or high-interest debt? Hold on, let me get my calculator and finance tables...
|
|
|
|
|
Agree. This was always my approach, write up a ticket explaining what we were trying to accomplish, and the reasons why we chose to do a hack. Include at least some details about the path we'd go if we were to implement the 'proper' solution. Put it in the backlog in whatever change tracking system is being used.
Where, of course, it's ignored for eternity. Sigh.
|
|
|
|
|
. . . I learn from the hack and realize it's not a hack at all.
Implement it elsewhere. Ah-Ha ! moments are good, too.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
...any new hack is just "normal."
It's when someone actually makes an architecture improvement, or refactors into one function the 50 places where cut & paste was used, that's what raises eyebrows.
|
|
|
|
|
we are not considering a hack for bug fix here or alike, all are good and for most of them we will be proud of it.
|
|
|
|
|
Potential Interpretatons:
". . . and besides, the customer's none the wiser (most of the time)."
"Down the line we can charge to fix it . . ."
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Ah! lets make money...
|
|
|
|
|
it was a clever work around!
I'm not sure how many cookies it makes to be happy, but so far it's not 27.
JaxCoder.com
|
|
|
|
|
our some stupid botch of a code monkey who cant read the documentation or find some sample code
PS: one of my collegues like to do "one workaround after the other". He has the luck that his manager isnt accepting this and hammers it out.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Is it still a hack?
|
|
|
|
|
It can still be a hack:
if(the conditions under which bug report #nnnnn occur are true)
{
fix things up and continue;
} This is OK when something is giving users a headache, but it soon needs to be replaced by something that fixes the root cause.
modified 17-Aug-20 10:08am.
|
|
|
|
|
Greg Utas wrote: something that fixes the root cause.
I don't know about your neck of the woods, but in the UK it's very much frowned upon to kill users.
|
|
|
|
|
musefan wrote: Greg Utas wrote: something that fixes the root cause.
I don't know about your neck of the woods, but in the UK it's very much frowned upon to kill users.
Greg recommended fixing the root cause, not killing it. What's the UK's position on involuntary sterilization?
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Unfortunately they are pretty reluctant...
I am all for population control though, so tell all your UK friends: VOTE MUSEFAN!
|
|
|
|