Comments by "p11" (@porky1118) on "Bad Code vs Good Code" video.
-
10:00 You COULD write your code in some way that it's easy to change, which would be hard otherwise.
For example if you wrote a game, where some subsystem are 3D (Rendering) and some are 2D (physics, UI), and then you decide to change the dimension of one subsystem (physics), it might be very easy or very difficult, depending on how you wrote it.
In the simplest case you would have to change a 2 to a 3 at one place.
But in the worst case, you have to change ONLY the types, which are related to physics into their 3D equivalents.
In 2D you just used a float to represent rotation, while in 3D it would have to be a quaternion.
You have to rewrite most of the algorithms, since you didn't use algorithms based on dimension generic operations (like the dot product), but instead you used dimension specific operations (like accessing x and y of the vector).
Or if you convert from 3D to 2D, you would probably have used Vectors for rotation speed, which would be scalars in 2D. So you don't immediately know which vectors have to be changed into floats and which would be 2D vectors insdead.
1
-
1
-
1