How to Create a Program

For some time now you have been fascinated by the world of computing and you are seriously thinking of taking a decisive step for what your knowledge is: learning to program. The idea of ​​building an application that works by yourself, for the sole satisfaction of doing it or to undertake a larger project, now fascinates you: the die is cast and the decision is made, however you are still a bit hesitant because do you have a clue of how to create a program.

You may not believe it, but you have come to the right place at a time that could not have been better: in fact, below I will give you all the information you need to enter the world of programming, understand how a program is born and, why not, create your first application from scratch.

Before going ahead, however, I want to make you a premise: the world of programming is nothing short of boundless, there are thousands of different scenarios and approaches to it and tackling them all would be almost impossible. However, do not be discouraged, because in this guide you will find everything you need to know to take the first steps: once you have finished reading and assimilated the basics, imagination and experience will accompany you on this adventure!

What is a Program

Before getting to the heart of the matter, I want to give you some theoretical information that will help you better understand the future steps of this guide: in practice, a program is a capable IT entity process data e aautomate operations. For example, there are programs that can process texts (such as Word), to perform calculations (such as Calculator Windows), to allow browsing on the Internet (such as i browser) and so on.

A program, depending on the task for which it is designed, can be more or less simple: just to give you an example, even the systems operational, designed to allow the user to interact with the "physical part" of a computer through dedicated software, they are in turn programs.

The functioning of a program is almost always based on a very specific mechanism, which is called algorithm: with this last definition, i necessary steps that must be done to transform a datum or a series of "input" data into a datum or a series of "output" data.

Within the programming, the above steps are expressed in the form of instructions is statement, given through a programming language: the complete set of instructions of a program is defined flow of execution, and it is what deals with processing the input data to transform it into what you want to achieve.

Stages of Creating a Program

Now that you have a clear definition of the program, it is time to get acquainted with how it is developed over time. It may seem strange to you, but even a program has a real one life cycle, structured in at least four phases: designimplementationtestingrelease and and updating. Below you can find the details of each stage of this life cycle.

Design

La design of a program is the first phase of its life cycle, as well as the most important: it is here that the objectives of the program are defined, the type of data it must manage and how it must do so. If you were to imagine a program as if it were a house, the design phase is the one in which the architect (or the team of architects) draws the project on paper, defining its shape, structure and position.

The design phase is usually the one managed by the engineers of the development team: just to give you some examples, there are those who define the type of data to be processed, those who develop the algorithm with which to manage the data themselves, those involved in studying the critical conditions (that is, events that should not occur, but could do so) and, why not, also those involved in designing the ideal graphic aspect of the program.

All these "ideas", at the moment purely abstract, are usually reported on gods diagrams or graphics developed through conventional standards (for example using the UML language) and must be approved by the figure of the chief engineer. In this phase, the programming language to be used to develop the software is also chosen. Once approval is received, all material is passed on to programmers, which take care of the implementation.

Implementation

The phase of implementation is the one in which, in fact, the real program comes to life: one or more programmers participate in it (in the latter case, the team is coordinated by a chief programmer), in charge of writing in one or more files the set of instructions that form the flow of program execution.

Instructions are written within one or more plain text files, enclosed within a if necessary specific editor or a whole integrated development environment (in jargon IDE): these elements provide the programmer with useful tools to simplify the work, for example the possibility to automatically complete instructions, to suggest variables or, again, to define pieces of code to be recalled with precise keyboard combinations.

The set of files that contain the instructions written in the programming language is defined source code of the program. Over the course of the implementation, the “in-between” parts of the source code come compiled to be “translated” into machine language and be executed: in this way, the programmer is able to test the goodness of his work and to verify that the program behaves correctly.

Once the entire source code has been written, it is compiled to run through the operating system, thus becoming a real program (like the ones you are used to using on your computer): the implementation phase is completed, the result it can undergo a further testing phase or be directly released to the public.

Testing

The phase of testing, in some respects, it can be considered the most "fun" phase of the life cycle of a program: in it, in fact, the appropriate figures of the team (the so-called tests) have the task of voluntarily causing malfunctions or critical conditions not managed within the program, so as to be able to reveal the bug (i.e. programming errors) and allow developers to remedy them.

The test categories to which a program can be subjected are really numerous and can test different aspects: even if it might seem strange to you, the testing phase is extremely important for the quality of a program, since it is in this that the any errors resulting from the previous phases. If you are interested in learning more, I refer you to the exhaustive entry on Wikipedia that deals with this topic in detail.

In some cases, the software house may decide to ask "help" from the end users to whom the program is dedicated, releasing an incomplete version for testing purposes: in this case we speak of alpha versionbeta version of the software. The end user is asked to try the program and report any problems encountered to the manufacturer: in jargon, this procedure is called feedback.

At the end of the test phase, two things can happen: if the program has problems, these are reported to the development team, which takes care of solving them by modifying and updating the source code. If, on the other hand, the program has no problems, it gets the OK for the phase release.

Release / Update

The phase of release of a program is one in which the latter is distributed to the public, free of charge, or made available for purchase, if the software is designed to operate after purchasing a license.

For market needs, or for the simple evolution of times, the software house can decide to add new features to the program, to modify its graphic appearance or to change its dynamics in whole or in part: in this case, a new version of the program is screened and re-runs through the entire life cycle process.

When the updated source code passes the testing phase, it is made public or marketed as updating of the original software.

A program ends its life cycle when the company behind it definitively stops updating it, effectively leaving it to itself: once development is stopped, the program is said to is no longer supported (discontinued in English).

Programming Languages

As I have already mentioned to you a moment ago, the programming language is the set of syntactic and logical rules used to structure instructions within the source code of a program.

The end user of the software, that is, those who use it every day for production, may have no idea of ​​the programming language used to develop the software itself, but you should know that not all languages ​​are the same: some are more suitable for building programs that work from the command line, others are better for managing graphical interfaces, still others are dedicated exclusively to processing calculations, designing games and more.

Here is a list (very limited, considering there are hundreds of them) of the most popular and well-known programming languages ​​currently available.

  • Java - is a programming language to objects extremely well-known, which lends itself to a very large number of uses. Its strength lies precisely in its flexibility: programs in Java can be executed simply by installing additional software (called Java Runtime EnvironmentJRE), from any desktop operating system. One thing, too, might surprise you: much of the Android operating system is written in Java. I have already told you about how to program in Java in my dedicated guide.
  • C - another extremely well known language. C is a programming language that dates back to 1972, it is of type procedural and it is applicable in virtually any type of scenario. It is not an object-oriented language (although its successor, C ++, is) and this makes it slightly more difficult than Java, however this aspect makes it adaptable to an immense number of practical applications. Suffice it to say that the Linux kernel, as well as the Android one, are written completely in C.
  • C# - despite the syntactic similarities with C, it is instead specific for the Windows graphical interface, the related programs and applications based on the framework . NET. Although owned by Microsoft, C # went open source last 2014.
  • Visual Basic - it is another programming language owned by Microsoft, used for the creation of software with graphic interface and dedicated to Windows operating systems. To date, Visual Basic has been incorporated into the framework . NET.
  • Delphi - successor of Pascal, this programming language is mainly adopted for the development of management software dedicated to managing large volumes of data, but which do not require complex graphic interfaces.
  • Objective C/Swift - these are the programming languages ​​with which apps for Apple operating systems are created MacOSiOSWATCHtvOS.
  • R - is a programming language used to process complex data, mainly for statistical calculation or for graphical computing operations.
  • MATLAB - another programming language dedicated to mathematical calculation, it is widely used in the management of operations based on matrices.
  • Assembly - it is a low-level programming language that approaches the real machine code (what the processor is able to "understand"). It is typically used for designing controllers and device drivers.

In the next section, I'll teach you how to design a simple C language calculator, which you can use from Command Prompt or from terminal macOS / Linux.

Create a Program

If you have made it this far, it means that you have learned all the theoretical notions on what concerns programming and that, finally, you are ready to get to work. Clearly, in this section, I will teach you how to create a very simple program, not designed for "global" distribution, and which therefore does not need to go through all the steps I explained to you earlier. All this will just build a small source code file and compile it using the most suitable compiler.

Simply put, at this stage you will learn how to create a simple one calculator in C, which you can use at your convenience via the Command Prompt Windows or the terminal macOS / Linux. The latter operating systems are already set up for managing files in C; for what concerns Windowsinstead, you need to install the component Visual Studio Community.

To proceed, connected to the dedicated website, click on the button Free download placed inside the box Visual Studio Community. Then open the downloaded file (eg. vs_Community.exe), presses the button Continue, put the check mark next to the item Desktop application development with C ++ in the window that appears, then in the box C ++ / Cli support located on the right and, finally, click on the button Install. When the procedure is complete, close the setup file window.

Now that you have all the tools you need, it's time to develop the source code of your program following the instructions that best suit your operating system. To start with, create the file that will contain the source in one of the following ways.

  • Windows - start the Block notes calling it from the folder Windows Accessories resident in the menu Start (accessible by clicking on the flag-shaped button located in the lower right corner of the screen). Then click on the menu Fillet located at the top left, select the item Save with name ... from the latter, choose the item All files give menu to tendin Save eat, type in the box File name the name calc.c and save the file on the Windows desktop, leaving Notepad open.
  • MacOS - avvia il terminal calling it from the Launchpad (the rocket-shaped icon located in the Dock), then type the command cd ~/Desktop followed by Submit and, again, the command touch calc.c, always followed by Submit. Without closing the Terminal, open with a Double-click the file thus created on the Desk.
  • Linux - start the terminal recalling it from Activity view or from your distribution's main menu, type the command cd ~ / Desktop followed by Submit and, again, the command touch calc.c followed by pressing the key Submit. Without closing the Terminal, do Double-click on the file created on the Desk to open it.

Once you open the text editor best suited to your operating system (eg. Block notes for Windows, Xcode for macOS or Gedit for Linux), type in the following code (exactly as shown below). I have decided to include in the source a brief description of each statement: the descriptions will not be read by the compiler, as they are preceded by symbols // (in jargon, this is Comments).

#includes #includes // tell the compiler which libraries to use int main (void) {// the main method, the actual char calculator chosen; int t1, t2; // declaration of variables printf ("Insert the first term of the operation:"); scanf ("% d", & t1); printf ("Enter the second term of the operation:"); scanf ("% d", & t2); printf ("What operation do you want to perform? Type n + for addition n - for subtraction n * for product n: for division nOperation:"); scanf ("% c", & choice); choice = getchar (); // requests and scans of keyboard commands switch (choice) {// cycle that takes care of performing the actual calculations case '+': t1 = t1 + t2; break; case '-': t1 = t1 - t2; break; case '*': t1 = t1 * t2; break; case ':': t1 = t1 / t2; break;} printf ("The result of the operation is:% d n", t1); // the result is shown on the video system ("PAUSE"); // wait for a key to be pressed to terminate the program return (0); // the program ends without errors}

Once all the text is pasted, save the previously created file, then quietly close the editor.

At this point, you can proceed with the compilation of the program using the instructions best suited to your operating system.

  • Windows - recalls the Command Prompt for Developers from the folder Visual Studio placed in the menu Start. Inside, type the commands in sequence cd %USERPROFILE%Desktop cl calc.c, both followed by the button Submit. Once this is done, you can run the program simply by typing the command tracing and pressing Submit, or by doing Double-click on the file calc.exe generated on the desktop.
  • macOS / Linux - from terminal previously opened, type the command gcc calc.c -o calculator followed by Submit, then start your calculator with the command ./calculator, always followed by pressing the key Submit.

In this chapter of the tutorial I explained how to create a very simple program without a graphical interface, however the power of the various programming languages ​​is limitless and software complete with graphical interface can also be created: everything is in the skill and in the fantasy of designers and programmers.

for Further

As you have noticed, create a program it is not a feasible operation, provided that you know at least one programming language: the source code of our calculator was very, very simple, but I'm sure it helped you to understand roughly how the instructions are structured (statement ) of a programming language.

Wait, are you telling me that this fascinates you a lot and that you intend to continue your studies to become a programmer? Perfect! I am happy to help you by suggesting resources available on the Internet that will be very, very useful to you.

  • How to learn Java - my guide dedicated to the basic steps to take to learn programming in Java.
  • HTML.it guides section - here you can find a large number of guides dedicated to the most famous programming languages, including C, C ++, Objective-C, Java and many others.
  • Microsoft, Introduction to Visual Basic - An introductory guide to the Visual Basic .NET language and the Visual Studio framework.
  • Eclipse - an entire IDE capable of handling various programming languages, including Java, C / C ++ and others, which can also be used for testing and developing UML graphics.
  • Notepad ++ - a minimal but complete editor for writing (and formatting) source code on Windows. It supports numerous programming languages.
  • Programs for programming - my guide containing a detailed list of software useful for programming in general.