|
|
|
|
|
by vorpalhex
2474 days ago
|
|
It's not an assumption of correctness. It's an assumption of purpose. Chesterton's fence[1]. Let's say you inherit a large codebase, and it in fact does not have any tests, and is relatively complex and convoluted. Obviously that's not going to be very maintainable without testing, and it may make sense to do a rewrite... But first, write tests. Test your assumptions. Read the commit history and see how the code base evolved over time. Maybe the reasons it was built the way it was are dumb ("I like naming my variables after my favorite flavors of pie!") or maybe it was done for really good reasons ("The database library breaks with odd numbers of connections, so the pool always has to be an even number."). The issue is that you simply don't know and risk repeating your ancestors mistakes unless you do some investigation. [1] - https://en.wikipedia.org/wiki/Wikipedia:Chesterton%27s_fence |
|
You're assuming there's always 'commit history' to review :)
I completely agree you need to do investigation, and document what you can about the system. Some of that documentation will take the form of tests. Without a doubt.
The 'assumption' I refer to is either clients or other devs assuming something is correct. I've lost track of the number of times I've heard "it was working fine until 2 days ago", when, in fact, it was never actually working, just not throwing a visible error until 2 days ago.
I will look at the fence - have seen reference to it before.
"until the reasoning behind the existing state of affairs is understood." - you may also need to realize the original rationale may never quite be understood. I've hit this a few times, and we've ended up just scrapping a particular set of functionality because no one could actually tell why it was there any more - everyone involved who may have used it or wanted/needed it is gone, and it's useless (or is now a blocker for other progress).