Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    8
  • comments
    10
  • views
    9609

Refactoring is evil

Sign in to follow this  
CTar

534 views

Five days ago I chose to refactor my file system, since it was actually only a prototype, and it would be a PITA to make any changes to later.

Now, five days after I started refactoring, I have finally gotten my code to compile once again. At one point I had 4000< errors for 3500> lines of code(not including comments, whitespace etc.), it was some recursive template stuff. I'm a little disappointed since before refactoring I had over 3500 LOC(lines of code), now I only have 2865 LOC[crying] which doesn't sound as good, I had hoped I would cross the 5000 LOC barrier sometime next week, but that isn't going to happen because I had to refactor even though I haven't gained any new functionality.

I had actually planned to refactor my logging system too, but I think I will work on a memory manager first since I don't want to drop below 2500 LOC.

Everything was much easier when I was just learning C++ and just added code to my main function without ever removing a single line. Also copy-pasting instead of creating general-purpose functions could helped a lot to "improve" the number of LOC.

Well everything isn't bad, I have just gotten Introduction to algorithms, 2nd edition which I hope is a good book. It will probably give me even less time to work on my engine, but it will probably pay off later when I choose the right algorithms and don't have to spend weaks optimizing the wrong sort algorithm.
Sign in to follow this  


2 Comments


Recommended Comments

When you refactore code it's a good idea to change the things one at a time and "always" be in a state where you can compile and run your code.

Share this comment


Link to comment
<excuse>
I know, but sometimes when you start to refactor your code you find out how many things needs to be done and sometimes (not that I recommend it) I change a lot of code without a compile, this will sometimes lead to having to change other parts of the code and suddenly you have 100 errors because of something stupid.
</excuse>

But, yes it was a bad approach.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!