Thursday, April 23, 2009

Lesson Learned

So since I am slacking at work someone had to refactor my code. Although the code that I wrote started from pretty much the beginning of my career.

I started writing this code and as functionality needed to be added I just added it to the module. I had modular code to a certain extent but used it in the wrong way. When a certain case hit I was using one module to do the other modules task. This made my code confusing for other developers.

Another big thing wrong with that code was that things could be extracted. While programming classes are made to do a certain task, and that task alone. I was making the class do several different things which could be extracted into their own classes.

The lesson learned here is keep my code modular. Refactoring as I go.

The bad habit that I had was started out with a modular design and just adding functionality to classes as those functions were needed. I need to learn to pull that functionality from the class and create new classes which can be used by my original class.


jalna said...

Είναι ελληνική μου.

austen.ito said...

If you don't think your old code is crap, you're doing something wrong.