Connascence Examined. Jim Weirich, Chief Scientist at Edge Case.

Connascence)

  • The common birth of two or more at the same time; the production of two or more together.
  • That which is born or produced with another
  • The act of growing together.

Connascence between two modules means when I change module A, module B should change.

Connascence of Name: “def foo” must match with calling “foo”

Connascence of Position: Order of parameters must match.

  • def bar(name,title,address); end; bar(‘jim’,’cs’,’chicago’);
  • At four-ish parameters, start to question whether connascence of name to be traded in place of connascence of position.

Connascence of meaning: Where data values have particular meanings that must be interpreted consistently across the program. Migrating toward named connascence is good in general.

Control coupling: Occurs when one component passes a piece of information that is intended to control the internal logic of the other. Warning signs: function uses OR in its description, data that has no intrinsic meaning (symbols, true/flase, nil)

Connascence of algorithm: Occurs whenever two components must agree on a particular algorithm.

Connascence of Value: Occurs when the values of two components are related.

Connascence of Timing: Occurs when the timing of execution is important.

Connascence of Execution: Occurs when the order of execution of two components is important.

Connascence of Identity: Occurs when two components must refer to the same object.

Connascence of Type: Set of data and a set or operations on a data type (stack: push, pop, empty). Involves connascence of name, connascence of position, connascence of expectation. Occurs whenever two components must agree on the same type.

Contranasence: If you change the child you possibly break the parent. Occurs when two components must agree on different names. A problem with the inheritance chains.

Actions to take:

  • Reduce degree of connascence 
  • Increase locality
  • Don’t repeat yourself
  • Single responsibility principle
  • Prefer stability

Slides and full video from talk available from Chariot Solutions.