I’m a web developer & data visualizer working at a think tank in D.C. I'm a self-taught dev trying to better my skills. I spend most of my time on the front end of the stack.
Location
Washington, D.C.
Work
Lead Developer at Center for Strategic and International Studies
Maybe I'm missing the point of your comment, but if you have recommendations for how to refactor that snippet, I'd honestly love to hear them! I did consider creating a dataset object first with the type & years predefined (like I created in Option 1) and setting that to the initial accumulator value, but this seemed cleaner to me. Would love to know if you had other thoughts!
I have great experience in IT over 12 years: front / back - ends, mobile, system administration and deployment cycle. I implement effective and great software products.
I’m a web developer & data visualizer working at a think tank in D.C. I'm a self-taught dev trying to better my skills. I spend most of my time on the front end of the stack.
Location
Washington, D.C.
Work
Lead Developer at Center for Strategic and International Studies
I have great experience in IT over 12 years: front / back - ends, mobile, system administration and deployment cycle. I implement effective and great software products.
I’m a web developer & data visualizer working at a think tank in D.C. I'm a self-taught dev trying to better my skills. I spend most of my time on the front end of the stack.
Location
Washington, D.C.
Work
Lead Developer at Center for Strategic and International Studies
I have great experience in IT over 12 years: front / back - ends, mobile, system administration and deployment cycle. I implement effective and great software products.
sauln, if take your comment seriously, not easy without smile, but anyway,
about "naive" – what do you mean from technical point of view?
Propose your variant, and highlight weak(or naive) sides of my example,
if you will be right with your proposition – I will agree with better solution with real advantages.
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.
Maybe I'm missing the point of your comment, but if you have recommendations for how to refactor that snippet, I'd honestly love to hear them! I did consider creating a dataset object first with the type & years predefined (like I created in Option 1) and setting that to the initial accumulator value, but this seemed cleaner to me. Would love to know if you had other thoughts!
Hello, didn't read the whole legacy code.
But this block of code took my attention, in concrete: useless write and duplicated reads.
I see better construction of it is:
Thanks for sharing! Just goes to show that there's a lot of different ways to solve the same problem.
@Jacque, it's way of not doing useless writing each time, but only in case when it needs.
Yep, I read it and can see what it does, thanks.
Yeah, Dmytro it's terser. It's really not among the more interesting comments you could make though given the optimisations actually available above.
Maybe consider when commenting on the internet about how crap someone's code is that yours is still very ...naive.
sauln, if take your comment seriously, not easy without smile, but anyway,
about "naive" – what do you mean from technical point of view?
Propose your variant, and highlight weak(or naive) sides of my example,
if you will be right with your proposition – I will agree with better solution with real advantages.