Complexity for JavaScript

The control of complexity control presents the core problem of software development. The huge variety of decisions a developer faces on a day-to-day basis cry for methods of controlling and containing complexity.

Cyclomatic complexity as defined by Thomas McCabe in 1976, has long provided the primary tool for measuring complexity. However, node.js/JavaScript contains programming and semantic structures that confound this traditional complexity definition. Continue reading

Posted in javascript, software | Tagged , , , , | Leave a comment

A Basis for Clean Code: Magic 7 +/- 2

Complexity poses a primary obstacle for developers. Our human neurology has a limit to complexity wired into each of us. The basics of Clean Code techniques can ease understanding and productivity by decreasing what we must keep in our working memory.

One of the most highly cited papers in psychology, “The Magical Number Seven, Plus or Minus Two: Some limits on Our Capacity for Processing Information” was published in 1956. This paper reports 7 +/- 2 as the number of objects the average human can hold in working memory. This correlates to about three bits of information: 2**3 = 8 as a maximum performance level of the average human. Continue reading

Posted in code reading, psychology, software, software development, stories, techniques, therapy | Tagged , , | Leave a comment

Test Driven Development

“We are uncovering better ways of developing software by doing it and helping others do it.”

RIPTDD

Test-driven development (TDD) is a technique for ensuring that your code does what you think it does. It’s particularly relevant for JavaScript, with its cross-browser incompatibilities and hidden gotchas. With TDD, you express your intentions twice: once as a test, and once as production code. If the two approaches don’t match, your tests fail, and you’ve caught a bug. Continue reading

Posted in software, test | Tagged , , , | Leave a comment

Duplicated Code

Duplicated code must surely rank near the top for bad code. The problem is that a new feature or bug will surely cause changes to one clone. Then the other clones will be silently ignored. This will likely create incorrect behavior. The tests for the clones likely will not catch these bugs either. Continue reading

Posted in Uncategorized | Tagged , , , | Leave a comment

Duplicated Code: What to do?

How much does duplicated code really cost a project?

I’ve tried to find studies detailing the cost of duplicate code within projects. We can all spout the problems these clones produce, but can we quantify? Apparently not.

One pundit suggests the if our code base has 20% were duplicated, then eliminating it would reduce maintenance costs by 20%. Continue reading

Posted in Uncategorized | Tagged , , , | Leave a comment

Introduction

A major learning for my recent career has been “Clean Code”. This movement was started roughly a dozen years ago and has been building since.

Posted in problems, python, software | Leave a comment