Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed DOM Scripting By Example!
You have completed DOM Scripting By Example!
Preview
Refactoring is a process that naturally follows the initial coding stage, where you go back through your program and make what you wrote more concise and readable.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
We've created an app that
behaves the way we want.
0:00
So it's tempting to
think the work is done.
0:02
But what if you or someone else needs
to change this app in the future?
0:05
If you don't organize your code well,
it could be challenging for
0:09
someone else to step in and
understand how the program works.
0:11
It could even be challenging for
you to return to some of your old programs
0:14
if you didn't take the time
to organize their code.
0:18
When you're working on a project, your
mind often moves around in creative and
0:21
wandering ways.
0:25
Your code follows where your mind goes,
that's a good thing, and
0:26
it can help you come up with creative
solutions you didn't think of
0:29
when you first planned out your program.
0:32
But when you solve those problems,
it's important to go back and
0:34
clean up your code.
0:37
This is called refactoring.
0:39
And it's the process of rewriting
code while leaving the original
0:40
behavior exactly the same.
0:44
In other words,
when you're done refactoring,
0:46
nothing to change in the way
your app behaves externally.
0:48
But your code should be easier to read,
easier to update, and
0:51
maybe even work more effectively and
efficiently.
0:54
So let's look at our app and
see what opportunities there might be for
0:56
cleaning up our code.
0:59
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up