Hacker News new | ask | show | jobs
by burgreblast 3510 days ago
How do you guys deal with re-factoring code? Imagine a codebase that has been largely additive for 100 years.

While the "+1 minus two guideline" has plenty of shortcomings in the long term, there is lots of low hanging fruit now, and it's an important mindset shift.

Guys, don't just add LOC. Refactor, clean it up and make it better. Remove blocks we don't use anymore.

3 comments

Government is strongly limited by time. There's a hard ceiling on the amount of things that can be proposed, debated, and voted on within a term. Consequently, if there are things in the statute that are no longer used it's often better to simply ignore them than to spend precious time in the house arguing about removing them. It might only take 5 minutes to call the house to order, have someone stand up and say "We don't need a law banning witchcraft any more" and then have a vote where the result is a foregone conclusion, that's 5 minutes that the government isn't doing something useful that will actually impact people's lives.

The repeal of pointless old laws comes up relatively often here in the UK. Some of our laws are really old - the government was talking about repealing some that were passed almost 750 years ago recently http://www.bbc.co.uk/news/uk-politics-30334812

>>>Government is strongly limited by time. There's a hard ceiling on the amount of things that can be proposed, debated, and voted on within a term. Consequently, if there are things in the statute that are no longer used it's often better to simply ignore them than to spend precious time in the house arguing about removing them.

That is exactly why all laws should have sunset rules built into them.

We should have listened to Thomas Jefferson who wanted all laws, even the constitution itself to expire every 19 years

It's a really terrible thing to have laws that aren't respected by the people, the government or the courts. It completely undermines the rule of law.
There's an argument to be made that there might be some benefit in government spending a little less time impacting people's lives.

But also, spending that time cleaning up old laws sounds an awful lot like "doing something useful that will actually impact people's lives".

Sounds like a garbage-collection problem. Some algorithms are more efficient than others.
How do you guys deal with re-factoring code?

As a very rough guide. Replacing one big function with two smaller functions is often better than replacing two small functions with one big one.

This is for functions that actually have a meaningful purpose and merit being better understood.
spot on
I think we programmers are ahead here - the general public needs sometime to think this over. The "+1 - 2" rule looks like a good start for opening the discussion.