|Replies are listed 'Best First'.|
Re^4: The Boy Scout Rule
by BrowserUk (Pope) on Jan 27, 2015 at 00:05 UTC
You can find some interesting parts in my questions and meditations in the last year.
Hm. Over the past year you (appear to) have posted(*)
of those, only the first stands out
Ignore this. The post I was referring to (as returned by my first search), isn't returned by the second attempt, after the preloaded link failed. Super search is inconsistent and illogical.
However, most of the code is, unfortunately, agonisingly boring.
Boring's fine, and irrelevant to my inquiry. I'm interested in seeing samples of code that draw such vehement condemnation.
* I would have posted the preload link, but it didn't work; and the first time I did the search it returned 8 results; but when the link didn't work and I had to reconstruct the search, it only turned up 5. There's nothing like consistency; and that's ... :)
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Oh… Hmmm… I was fixing to complain about the rows to hoe in my code base. But, uh, …nah… Uncle.
(Though truthfully ours is identical in spirit, just rarely deeper than 4 nested ifs or 25K lines per disaster.)
Can you imagine the interview? "What data structure would you use to store 1 to 10 values of the same type?" — "10 variables?" — "Correct!"
Yes, that is horrible. But ...
Essentially, exactly the same as above.
Whilst not pretty, it is pretty simple and clear.
Unless there are improvements that are entirely localised to that subroutine, which given the number of external (presumably global) variables being referenced and changed, would probably be very superficial, then you have to look at the affect of any changes here on the rest of the code base and do the risk .v. reward calculations.
Which on cursory inspection do not look good.
I suspect that the only way to tackle refactoring this codebase would be to start by converting the global state into a god object and passing that around to every subroutine. Once you've done that, you can start breaking the god object into sub-objects that only get used by subsets of the functions; and then slowly work them into separate modules or classes.
I've done that a few times and it is a pretty thankless task. In the interim you break things a lot; and even once you've got it all working again, it often runs measurably more slowly and often requires more memory, and all you've done is get back to where you started in terms of functionality.
Of course, the hope is that future additions and maintenance are easier; but that only becomes measurable in the future.
Get it wrong and you're the guy that broke everything.
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked