LinkedIn principal author Doug Winnie explains the principles of refactoring code and how updating code can help improve your projects and your skills as a programmer. Refactoring code usually is based on three rationales. The first being improved performance, the second is to better support new features, and the third is to improve legibility of your code.
- View Offline
- Coding is an iterative process.…You'll create code that solves a problem and then,…perhaps weeks or months later,…you'll come back to that same code,…and wonder what you were thinking when you wrote it.…Perhaps you learned a new practice…that makes the code better,…or you overlooked something when you first wrote it.…Regardless of the reason,…when you update your code to make it work better,…you are refactoring it.…Refactoring is a common practice with programming.…As you add new capabilities to your programs,…you'll revisit and update older code.…
The trick with refactoring is to make sure…that any changes you make won't have…adverse affects on the rest of the program.…Take this example.…If I have a program that stores three values,…I might later decide it makes more sense…to store those values in an array.…When I refactor the code,…I set up the values differently as an array.…But I'm only partially done.…Because I need to make sure that…all the old references…to the previous variables are updated.…Otherwise I'll introduce errors into my code.…
Join Doug Winnie as he explains the principles of programming and helps you connect to core concepts by exploring three ways that programmers perform their jobs. Doug starts by sharing the history of coding and then dives into functions, values, variables, and parameters used to define actions. He covers capturing input from users, creating conditional tests, using loops with arrays, and object-oriented programming basics. He also takes you beyond programming, into processes like debugging, refactoring, and building iteratively.
- Working with values and variables
- Breaking down tasks
- Customizing functions and parameters
- Building conditional tests
- Creating and changing arrays
- Working with objects and classes
- Debugging and refactoring code
- Going beyond the code as a programmer