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.
2 comments:
Είναι ελληνική μου.
If you don't think your old code is crap, you're doing something wrong.
Post a Comment