Programming

Programming in eCommerce

Programming is an essential part of developing and maintaining for every ecommerce web site and related software. In this article you’ll find some basic concepts about programming, without going to study computer science. If your role in ecommerce is not technical, you may be perfectly fine without any deeper knowledge about computer software. Never than less, it’s always  good to have some additional knowledge. It might serve you when evaluating the options to update web application or discussing with the professional. Or maybe you’ll even find the topic interesting enough to study it a bit further. Programming can be addictive!

The majority of software developers in eCommerce are specialized in developing web applications. Web applications are displayed to users by web browsers like Firefox, Chrome or Edge. But web page of the application is really just the tip of the iceberg. It’s major part and most complex part is usually ran on a web server. From the web server all the data is served to be shown in the the browser.  Desktop applications, on the other hand, are stand alone programs with their own graphical user interface – GUI. They don’t need web a browser to be shown to the user. They also may interact with web or other type of servers, but not necessarily. Instead of being executed by the browsers, they are executed by the operating systems, like Windows, Linux or Mac OS.

The main focus point of every eCommerse is the online store. From the perspective of programming, that means the development and maintenance for web applications. However, every web application, especially its server side part, interacts with other software services that are not exclusive to the web. Those include database servers, software for data analysis, accounting, stock management and many more. Therefore, it is not possible to define programming for eCommerce only as programming of web applications.

Basic concepts of programming – a simple C program

A computer program is a set of instructions for the computer to execute certain tasks. Computers don’t understand human language. Therefore, a program is written in a programming language. There are many different languages. Some are most suitable for certain tasks than others. Remember –  no language is better or worst than the other. There are only languages more or less suitable for different kind of computer programs. Very often, developers pick up the most suitable language among several possibilities. They make selection based on the pros and cons of the suitable languages. There are also cases, when only one exact language is the most obvious choice due to the specifics of the program to be developed.

Let’s see a simple program now. The program reads two numbers from the command line. It performs arithmetic operation of addition on the entered numbers and then writes the sum on the screen. It is written in language C. The largest part of world’s most demanding software is written in C or its younger brother, C++. Operating systems are mostly written in C and C++. Interpreter for PHP, world’s most widespread web server scripting language is written in C. MySQL, popular open source database server is written in C and C++. Many millions of world’s eCommerce sites and other web applications retrieve their data from databases ran by MySQL.

#include<stdio.h>
int main()
{
 int num1;
 int num2;
 int sum;
 printf("Enter two numbers to add\n");
 scanf_s("%d%d", &num1, &num2);
 sum = num1 + num2;
 printf("Sum of entered numbers = %d\n", sum);
 return 0;
}

Image shows the output of the executable program built from the sample code.

Programming sample application

Programming sample application

To make an executable program out of the above code, the program must be compiled and linked. Compiling is the process of translating the programming language code into the sequence of machine instructions. Computer chips only understand those. They don’t have a clue about programming languages. Those are for humans. Compiling is performed by a special computer program, the compiler.

Our sample program, although full of some strange instructions, would not be capable of performing the “simple” task of reading and writing to the console windows without some additional help. That help comes from the so called external library.  Library is a piece of another program, (to say it in a simple way) which our program calls to execute some functions. In our code those functions call are printf(…) and  scanf_s(…). The code for that functions is defined in a library called stdio.
In there first row of our code, there is a line #include<stdio.h>, saying to the compiler: I’m gonna use some of the code written in the library stdio. After the code is compiled, call to functions defined in the library stdio are linked to appropriate library code. Linking is performed by a special program, the linker. Compiler and linker are usually part of the integrated development environment – IDE, that we use to develop programs.

Programming is a tough job. As we saw in the example, even the simplest program requires specific knowledge. To develop real, professional programs, it requires years of experience to be really good at doing it. And learning never ends, as technology constantly improves.