Why refactor this?

Dear experts,

why are we refactoring the tank aiming component? After all it is a C++ course, so why can’t we leave the C++ logic that did take as some time and headache to set up after all?

Thank you for any ideas/explanations on this.

Best regards, Peter

For those learning to code its necessary to see and understand what other people do with code as they’re working on it. This seems to be their focus as far as I can tell as refactoring is something we all should do and so they teach it.

You can do whatever you want with your code while going through the course, including not refactoring it.

I think the code will be a lot clearer after this refactor, and it’s a good way to learn.
I’ve experiened two errors in compile, and now my “code” is compiling, but game crash, probably the barrel and turret pointers… Investigating that is almost as good teacher as Ben :smiley: Even if its hard…
Maybe I’ll have to review the course about how to revert back to previous commit :smiley:
Hopefully I did one just before this mess!

Hello SillikOne,

I am a few lectures further and I am done with the refactoring. Now I get it. It is more according to OOP standards. That makes sense.

Kind regards, Peter

Hi Peterwal!
I also went through the refactoring, I’m super proud to have solved the crash before seeing the “solution” :smiley: My code wasn’t as clean as it should but the game was running.

To do that I had to review and fully understand the architecture and the logic of the Tank.
Ben is not only a good coder, a mathematician, he’s also a great pedagogue!

1 Like