I like to build cool things, work with nice people and help others where I can. Currently I'm an engineering manager for a fintech startup and historically a serial founder & freelancer software dev.
Location
München, Deutschland 🇩🇪
Education
The Open University
Work
Engineering Manager @ Deutsche Fintech Solutions GmbH
I agree that this isn’t good code or practice to use in a production environment and if seen in the wild it should be refactored but that was the point of the example.
Furthermore the example isn’t my own and instead comes from the linked source who uses this example to showcase a similar point.
The other point of consideration is that in some environments it is unavoidable to have mutations to the inputs and so clones and copies become the default solution to avoid mutation to the original values which this example showcases.
I like to build cool things, work with nice people and help others where I can. Currently I'm an engineering manager for a fintech startup and historically a serial founder & freelancer software dev.
Location
München, Deutschland 🇩🇪
Education
The Open University
Work
Engineering Manager @ Deutsche Fintech Solutions GmbH
“I would also like the readers to understand that it's more of a workaround than a solution.” - only if it’s avoidable since in the environments where we can’t have proper immutability this is the solution.
Fair enough, it’s a point though. Thanks for the comments!
Mmm.. interesting philosophical topic. I really need to think about it. Thinking here now. I would say that it's a workaround, which is the appropriate solution for the situation (as opposed to refactoring the original function, which is not possible).
Keeping it in mind and in comments as "workaround" should potentially push more towards the "real" solution when it becomes possible.
I guess "workaround" is specific type of solution in this situation. Between two words when one is more specific, I choose the specific one unless I specifically want to generalize.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I agree that this isn’t good code or practice to use in a production environment and if seen in the wild it should be refactored but that was the point of the example.
Furthermore the example isn’t my own and instead comes from the linked source who uses this example to showcase a similar point.
The other point of consideration is that in some environments it is unavoidable to have mutations to the inputs and so clones and copies become the default solution to avoid mutation to the original values which this example showcases.
Really doesn't matter. I was commenting about the example, not about you :)
The aim is to let potentially inexperienced readers know that this is typically not OK.
Unfortunately, yes.
I would also like the readers to understand that it's more of a workaround than a solution.
“I would also like the readers to understand that it's more of a workaround than a solution.” - only if it’s avoidable since in the environments where we can’t have proper immutability this is the solution.
Fair enough, it’s a point though. Thanks for the comments!
Mmm.. interesting philosophical topic. I really need to think about it. Thinking here now. I would say that it's a workaround, which is the appropriate solution for the situation (as opposed to refactoring the original function, which is not possible).
Keeping it in mind and in comments as "workaround" should potentially push more towards the "real" solution when it becomes possible.
I guess "workaround" is specific type of solution in this situation. Between two words when one is more specific, I choose the specific one unless I specifically want to generalize.