46 000 lines of code

by Market Tree

Our buying and selling service is handled by just over 46 000 lines of computer code. This number will get larger as we add more features to our service.

“So what?” you might ask, or “Who cares?”, or even “What is code anyway?”. If you want to know what computer “code” is, then read on….

Computer code is just another name for computer commands or instructions in a computer program or application that tell a computer to do something. Below is an example of a simple computer method (a certain lump of code), written in the Java programming language, which adds up all the whole numbers from 1 to whatever number is specified.

Before you dive in, I just want to give you a very quick introduction to Java code.

  • The “//” characters are comment markers. Anything from these characters to the (right-hand) end of the line are ignored by the computer. These comments are for software developers to remind them what is going on – and here as a guide for you too.
  • The “{” and “}” brace characters group related lines of code together.
  • Most commands end with a “;” character.
  • A command like “int nSum = 0;” does two things; it declares a variable called “nSum” which stores an integer number, and then it sets this variable to store the value 0.

Okay, here’s the code:

// If n is more than zero then sum all the integers between one and n inclusive
// and return this sum.
// If n is less than or equal to zero then return zero.

public int sumWholeNumbersUpTo(int n)
  int nSum = 0;         // Declare and initialise our sum to zero

  int i = 1;            // Start counting from one
  while (i <= n)        // Do the next four lines if we have not finished yet
    nSum = nSum + i;    // We add the value of the counter to the sum
    i = i + 1;          // We increase the counter by one
  }                     // We go back to the "while" line

  return nSum;          // Tell the outside world the result

If we use this code by executing the following line (of code):

  int m = sumWholeNumbersUpTo(3);

we will find that the variable m is set to 6, which is 1 + 2 + 3.

Well, how was that for you?

How many lines of code are there for the “sumWholeNumbersUpTo(…)” method? Ignoring the 3 blank lines (put in to improve readability) and the 3 lines that are just comments without any computer instructions, we have 11 lines of code. More code will be needed (at least 1 line, as we have done above to get the result of 6) to use the method to actually work values out or do other useful stuff like talk to our database or interact with service users.

The number of 46 000 lines of Market Tree code excludes over 8 000 blank lines and more than 14 000 lines of nothing but comments.

Well, we hope that you have learned something interesting today!