Re:Please put units in names
by quickthrower2 on Monday March 21, 2022 @05:47AM
(#30752111)
DB field names can be really hard to change. All those crystal reports to update, and the sales managers pet access DB that the hero set up for him that you don’t know about.
[ Parent
| on HN ]
Re:Please put units in names
by tonyedgecombe on Monday March 21, 2022 @06:08AM
(#30752250)
>DB field names can be really hard to change.
I find it really hard to accept any excuse for something like that. It's why enterprise code is so sloppy, people doing the most expedient thing rather than what is correct.
How do you write code so that it can accommodate DB field name changes without breaking SQL reports / BI?
Might be easy if you own the whole codebase and all reporting, but you are also going to break all those linked BI reports that the analysis team has written.
Breaking the report is a feature.
If you don’t, it will assume kmph instead of mph and just present the wrong data! But sure…those graphs still look pretty…
Which links back to the original point from quickthrower that database field name changes are really hard to change then.
If you can’t make a change without it potentially breaking other stuff, it goes in the “not easy” category for me. Especially if you probably won’t know if stuff is broken until the change is pushed to prod.
Create a new column speed_mph. Create a trigger that makes writes to either column gets written to both (make sure to write it to avoid infinite recursion). Copy all data from speed_kmph to speed_mph. Deprecate speed_kmph. Change existing usages at your leisure. Delete speed_kmph.
You can't just copy data, it's said to be they're factor k (i.e. 10^3) hahaha
Even switching to "speed_mph" still makes the warning/comment relevant: that just means that "m" is for "miles" and not "meters"
Fair enough, although sounds like it’s really hard to change then back to quickthrowers point.
Most often those reports are built on top of table views and not direct table contents. If you have an abstraction layer between its not hard to change whats under.
But that makes an assumption you didnt make any shortcuts.
Considering I was actually consuming the data, if there was an abstraction layer then the field name was in that.
What is "correct" is up for debate, and often depends on cost tradeoffs. Sometimes this is the "correct" thing to do, no matter how gross we think it is.
Re:Please put units in names
by tonyedgecombe on Monday March 21, 2022 @06:28PM
(#30760571)
Not often, what has always surprised me is how regularly these sort of problems are self inflicted. A lot of people will just do what is expedient regardless of what the management position is.