I’ve been involved in several projects where I worked on moving an existing codebase into using AngularJS. Some involved refactoring a small codebase, which is relatively straightforward in most cases, but I’ve also refactored much larger projects where moving everything at once is not an option. Here’s some best practice type stuff that I’ve learned along the way.
Using unit tests as requirements when refactoring
What should you do to make sure new code works properly when you’re refactoring old code? I asked myself this question recently, when I needed to refactor a big bunch of procedural PHP code into a neat, testable, OOP-style interface. The conclusion I came into is that you should write unit tests – not to test the old code, but …
Refactoring explained to an absolute beginner
Recently while on a drive with a non-programmer friend, I talked with him about code complexity and manageability, how very complicated code is detrimental to productivity and stuff like that. Later on, I decided to explain it to him with actual code examples, although the most he has ever done was some HTML back in elementary school. Here’s what I …
Refactoring
Today I’d like to point out a bunch of good articles about refactoring – the process of improving code without changing the functionality. Sameer Borate has written four posts about the topic in his blog, and I encourage you to check them out: Refactoring: An introduction to PHP programmers Refactoring 1: Conslidate conditional expressions Refactoring 2: Extract method Refactoring 3: …