Article Preview
Buy Now
COLUMN
Refactoring
Making Code Better
Issue: 16.3 (May/June 2018)
Author: Marc Zeedar
Author Bio: Marc taught himself programming in high school when he bought his first computer but had no money for software. He's had fun learning ever since.
Article Description: No description available.
Article Length (in bytes): 12,361
Starting Page Number: 72
Article Number: 16306
Resource File(s):
project16306.zip Updated: 2018-05-09 11:00:01
Related Link(s): None
Excerpt of article text...
Refactoring is one of those concepts that sounds complicated. I won't tell you it
isn't complicated, but it's definitely not something you should fear. Refactoring is simply revising your code to make it better.The trick is deciding what you mean by "better." There are many levels of better. For instance, you could simply rewrite your code to make it more readable. This could include changing the names of variables to identify their values more accurately, combining—or separating—code, and adding comments.
Let's look at an example of some code. Say we've got the following method, which calculates the average nutrients consumed over a series of meals:
Public Sub calcAverageMeal()
dim i, j, k, n, numberOfDays as integer
...End of Excerpt. Please purchase the magazine to read the full article.