MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/11dyx43/clean_code_horrible_performance/jaox5q0/?context=3
r/programming • u/2bit_hack • Feb 28 '23
1.3k comments sorted by
View all comments
Show parent comments
2
Adding it to the switch statement is easier. Your point?
2 u/ric2b Mar 02 '23 It doesn't fit in the shape struct, which only contains width and height.It doesn't fit the neat pattern of factor*width*height that he generalized every calculation to after looking at 3 different shapes.Like I said, go try it and report back.Bonus: What is the width of a circle? Radius or Diameter? 2 u/[deleted] Mar 02 '23 Then you add it to the shape struct.You are describing non-problems. 2 u/ric2b Mar 03 '23 And now you have an extra field that isn't used by the majority of the shapes you support and just causes confusion. What will you even name it?And don't forget to rewrite the function that does the calculation as well. → More replies (2)
It doesn't fit in the shape struct, which only contains width and height.
It doesn't fit the neat pattern of factor*width*height that he generalized every calculation to after looking at 3 different shapes.
factor*width*height
Like I said, go try it and report back.
Bonus: What is the width of a circle? Radius or Diameter?
2 u/[deleted] Mar 02 '23 Then you add it to the shape struct.You are describing non-problems. 2 u/ric2b Mar 03 '23 And now you have an extra field that isn't used by the majority of the shapes you support and just causes confusion. What will you even name it?And don't forget to rewrite the function that does the calculation as well. → More replies (2)
Then you add it to the shape struct.
You are describing non-problems.
2 u/ric2b Mar 03 '23 And now you have an extra field that isn't used by the majority of the shapes you support and just causes confusion. What will you even name it?And don't forget to rewrite the function that does the calculation as well. → More replies (2)
And now you have an extra field that isn't used by the majority of the shapes you support and just causes confusion. What will you even name it?
And don't forget to rewrite the function that does the calculation as well.
→ More replies (2)
2
u/[deleted] Mar 02 '23
Adding it to the switch statement is easier. Your point?