CSC/ECE 517 Fall 2013/ch1 1w07 d

From Expertiza_Wiki
Revision as of 14:20, 18 September 2013 by Djkernic (talk | contribs) (Created page with "==Background== The practice of [http://en.wikipedia.org/wiki/Code_refactoring code refactoring] deals with changing the content or structure of code without changing the code's f...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Background

The practice of code refactoring deals with changing the content or structure of code without changing the code's function in

its execution. Code refactoring has become a standard programming practice, as it potentially promotes readability, extensibility, and reusability of code.

Whether done through an IDE or by hand, large-scale code projects can prove tedious to refactor. If minimal non-functional benefits are achieved through refactoring, time is

wasted. Furthermore, if not done properly, code refactoring can actually break the functionality of the code.

Metrics

There are a variety of metrics that are used to quantify the merits of refactoring.

Complexity

Cyclomatic Complexity is a metric whose value is determined by the number of decision points in the code.

public void makeDecision(condition) {
  if(condition a) {
    choose(a);
  }
  else {
    choose(b);
  }
}

Lines of Code

Change Over Time

Duplication

References