3 ms·
I really agree with some parts. If you expect to grow, you can at least make an effort to keep stuff extensible in the future. Right now, I work with old code e
by viraptor 16y ago
I really agree with some parts. If you expect to grow, you can at least make an effort to keep stuff extensible in the future. Right now, I work with old code every single day. With code written one day assuming that: tax will never change (did twice since then), tax code will never change (changed once), service provider will never change (another one was added, so we have to choose one at runtime based on many dynamic conditions), this modification is needed for only one reseller (file has 10+ lines of if reseller_id == ...).
Making things flexible may not sound pretty at the start. But ending up changing 3 apparently completely separate systems to accomodate the fact that you changed the version of some software and the output format needs to be different (hey - why would we do immediate representation, output's not going to change).
It looks silly in the example, because it's a simple operation. Now substitute 'factorial()', for 'provision_customer_config()'. You WILL change the backend at some point. You WILL change the endpoint at some point. You WILL change the way the function works completely, but will have to retain the previous procedure for existing users. It's a when not an if question. There should be a saying similar to that about people doing backups: there are 2 types of programmers - those who write modular code and whose who will.
- ollysb 16y agoPerhaps the point is that you should refactor your code into modular code when it's required. In real applications there's a million different ways to modularise the code, it's extremely rare that you guess which way is right in the absence of actual requirements.
- sophacles 16y agoI would like to add to this, changing some endpoint frequently involves a single, one-time migration to the new system rather than a requirement to support the old and the new simultaneously, thus making some of the modularization moot or just pure overhead vs. a port.
- TheSOB88 16y agoBut it's not a when question. It's a what question. And if you don't know, why would you code for all the possible possibilities?