DEV Community

Discussion on: Laravel: Refactoring Code

Collapse
 
l3lackheart profile image
l3lackheart
  1. I have a feature idea.
  2. Come up with a plan on how to build this feature.
  3. Began implementing the feature.
  4. At the end of the day spend an hour or two going back and refactoring the code that I wrote for the day.
  5. Write tests.

how about writing test before starting code? so you wont mess up your feature after refactoring the code.

1. I have a feature idea.
2. Come up with a plan on how to build this feature.
3. Write tests.
4. Began implementing the feature.
5. At the end of the day spend an hour or two going back and refactoring the code that I wrote for the day.
Enter fullscreen mode Exit fullscreen mode
Collapse
 
jringeisen profile image
Jonathon Ringeisen

TDD has been something I've been trying to adapt to but I've been having a hard time getting into the habit of it. But yes, you are right I should be writing the tests first. This is something I'll continue to work on and try to build into a habit.