I have written that code in loop form in the past....
# water-cooler
d
I have written that code in loop form in the past. Not proud but it got the feature out and we then converted it to be better later.
1
💪 1
a
Did you have tests on it?
d
Oh no, unfortunately I have never worked in a place that actually wanted tests. I want them, but time is not my own.
I mean yes we had tests, Jason from QA and Paul from dev team testing.... (Names are not real names)
a
It's odd how some managers see tests as time-consuming, it saves considerable time over the medium to long term and gives you much more confidence in your code. Why would you repeatedly spend time manually testing something when you could spend that time to write something that'll not use time in the future.
I think it was Uncle Bob who said that if you are afraid to change code then the code controls you. The code base I work on has lots of examples of where people have replicated code instead of changing it as they were afraid to break something (as there were no tests). We have partial test coverage now but it's a long way from full coverage. But the code that has tests is much faster to make changes to.
a
@deactivateduser to be clear I was not having a go at you. I was just hoping you were gonna say yes, in which case my response was "it's nice to have the freedom to ship a 'just enough' solution safe in the knowledge you can happily refactor later". But also you can just "change shit" and get Jason and Paul to sort it out. Again. 😉
a
Let me know if Jason or Paul have any spare time 🙂
d
@User I didn't think you were having a go at me at all. I know and am frustrated by current system, but can't change it yet. And unfortunately most managers/POs/people watching time don't see immediate return then it isn't necessary and when working with such a legacy app they want all or nothing coverage quickly vs just working up coverage as you go which makes it very difficult to say, hey let me spend an extra hour to get some testing up and running so we can start small.