User Tools

Site Tools



The term logic subsumes all statements in a programming language creating software Behaviour. In particular that is:

  • transformations, e.g. mathematical operations, string manipulaton; transformations convert input data into output data.
  • I/O operations, e.g. reading from a file, accessing the system clock, sending data over TCP; I/O is about accessing hardware resources.
  • control statements, e.g. if, switch, for, try; control statements direct the flow of control through logic.

Since most transformations are function calls to some 3rd party library like I/O operations, logic could be defined even more generally as:

  • API calls
  • control statements

Here's an example of logic:

var names = new List<string>();
while(true) {
  Console.Write("Name: ");
  var name = Console.ReadLine();
  if (name == "") break;

In this block of logic you find transformations, e.g. name == “”, control statements, e.g. while, if, and I/O, e.g. Console.Write().

Please note: Memory allocation and variable assignments by themselves are not considered logic. They do not create software behaviour the user can observe. Also variables often can be viewed as optimisations to avoid repetitive logic execution to improve runtime performance.

Distinguishing logic from other parts of a code base is the foundation for the Integration Operation Segregation Principle.

logic.txt · Last modified: 2018/07/15 11:25 by fdadmin