How to start programming | Windmill Testing Framework

After chatting for a long time with a programmer friend of yours, he told you about his profession and you, already quite “expert” in technology, were so fascinated by it that you wanted to try to take the same path. First of all, let me tell you that the world of programming is extremely vast and articulated: to acquire sufficient skills to become a professional in this field requires study, practice and time, which, if you decide to throw yourself headlong into this field, you must never forget.

Nevertheless, you have to start somewhere… and this is exactly where I can help you: in the following guide, in fact, I intend to give you all the necessary tools to start programming, giving you a general overview of the existing categories of programming languages and the most used ones today. Finally, it will be my care to explain you how to realize very simple programs using C, Java and Python languages.

So, what else are you waiting for to start? Cut out a few minutes of free time for you, get comfortable and read very carefully everything I have to tell you on the subject: I’m sure that, once finished reading, you’ll be perfectly able to assess whether or not to continue with this adventure and, if so, you’ll know how to choose the most appropriate language for you. At this point, there is nothing else to do but wish you good luck and good luck for everything!

Types of existing languages

As you know, a program is a computer entity that can process data and automate operations, whose operation is often based on a precise sequence of steps, which is called an algorithm: with this definition we mean the steps necessary to transform a series of “input” information into a series of “output” data.

A programming language, however, is the format with which the steps of the algorithm are “translated” and made understandable by the computer: in the computer world there are dozens and dozens of similar languages, each designed for a specific scenario of use. For example, one of the languages dedicated to databases is SQL, as well as the programming language “typical” of Android smartphones and tablets is Java, those used to create apps for iOS are Swift and Objective-C, while one of the languages to perform mathematical operations between matrices is MATLAB, and the list could go on and on.

In any case, programming languages can be divided into two large families: those at low level, more difficult to learn and less intuitive, whose syntax is closer to that of machine language, and those at high level, which are syntactically closer to the Anglophone natural language and, therefore, easier to assimilate.

Depending on the case, one type of language can be more efficient than the other: it is unthinkable, for example, to create a device driver using a high-level language; in the same way, it would be extremely complicated to write a smartphone app, even a very simple one, using a low-level language.

It is also possible to classify languages on the basis of abstract programming models, dividing them into precise “categories” that define the approach to be used.

Imperative languages – these are languages whose model is based on changes in the state of the machine’s memory: to simplify it, such languages “modify” the content of the memory cells of the computer and, thanks to a series of operations, allow to obtain the solution of the problem. These languages are divided, in turn, into procedural languages (that is, they execute, in sequence, the specified commands, with the specific need to manually allocate the data in memory), object/object-oriented languages (that make use of “pre-packaged” structures, without the need to manually allocate the memory to be dedicated to them) and parallel languages (that is, designed for the interaction between several processors that perform the same task at the same time).

Declarative languages – this type of language, on the other hand, provides an approach that disregards the state of the memory but processes the problem by building relationships between the entities and values of a specific function. Declarative languages are also divided into three distinct categories: functional languages (which base their execution flow on the result of mathematical functions), logical languages (which base their execution on the result of logical conditions) and, finally, relational languages (which operate by relating different entities). The best known example of a relational programming language is SQL.

Within this guide, as you’ll find out shortly, I’ll focus specifically on three of the most widely used high-level imperative languages in existence today: the C language (procedural), Java, and Python (both object-oriented).

Popular programming languages

As I have already mentioned before, in computer science there are many programming languages and, as you can easily imagine, it is not possible to list them all. What I would like to do, however, is to give you an overview of the most popular and used nowadays, so that you can have an idea of the language to choose to start programming, based on the type of program you want to create.

C – is a procedural programming language that dates back to 1972 and that, thanks to its enormous flexibility, can be applied to virtually any type of scenario: for example, the Linux kernel, the Android kernel and many management systems of peripherals in common use (for example, some modems), are written entirely in C. It is not an object-oriented language (as opposed to its successor, C++, which, however, is), so in order to use it in a semi-advanced way, you must at least have the ability to be familiar with the language. It is not an object-oriented language (unlike its successor, C++, which is), so in order to use it in a semi-advanced way, you must at least be familiar with the allocation, reading and writing of memory.

C

Visual Basic – also Microsoft branded, this language was mainly used for creating Windows programs with a graphical interface. Nowadays, Visual Basic is completely incorporated into .NET.

Java – is one of the most popular and appreciated object-oriented programming languages, which, thanks to its flexibility, is suitable for a large number of uses: it’s enough to know that Java programs can be executed by any desktop operating system, simply by installing a dedicated software (called JRE or Java Runtime Environment). A small curiosity: a large part of the Android operating system, which you will surely have used at least once, is made in Java.

Swift – is an object-oriented programming language introduced by Apple in 2014 and allows you to build applications for macOS, iOS, watchOS, tvOS and Linux in a fairly intuitive way. The Objective-C language is also used for iOS apps.

Python – is one of the object-oriented programming languages with the widest possibilities for use: in this case, it can be used to create distributed programs (running in a “broken” way on multiple computers simultaneously), testing routines, automation scripts, numerical calculations and much, much more.

Delphi – is a programming language still used today for the realization of management software dedicated to the management of large amounts of data, but without expecting much from its graphical interfaces.

MATLAB – is a programming language mainly dedicated to mathematical computation, particularly oriented on operations between matrices.

R – again, this is a structured programming language for performing complex mathematical calculations, primarily used for graphical computing operations and statistical computation.

Assembly – is one of the low-level programming languages that most closely resembles processor-understandable machine code, with an extremely complex syntax but immense power. For example, Assembly is used to implement motherboard bus controllers and peripheral drivers.

How to start programming in C

After this general knowledge about programming languages, it’s time to understand, in fact, how to start programming: in this section of the tutorial I’ll explain all the tools you need to write a small program in C that, simply, prints on the screen the words “Hello, world!”.

Preliminary Operations

For a start, if you are using Windows, you must first get the Visual Studio Community component, which contains the tools required to compile a source file (that is, a file containing the program’s code) written in the C language.

To proceed, connect to the program’s website, click on the Free Download button and, once the download of the file (vs_Community.exe) is complete, launch it and click on the Yes and Continue buttons to start the setup process. When you arrive at the next window, check the boxes Developing desktop applications with C++ (located in the central part of the window) and C++/Cli support (located on the right side); finally, click on the Install button and close the window.

On macOS, on the other hand, you don’t need to install anything, since the basic components of the C language are already included in the operating system.

helloworld.c

Now that you have all the tools you need to create a program, it’s time to write the code, using the instructions best suited to your operating system. To begin with, you have to create the program’s source file using one of the following procedures.

Windows – start Notepad from the Windows Accessories folder located in the Start menu (the flag-shaped button in the lower left corner of the screen). When the program starts, click on the File menu in the upper left corner, choose Save As…, select the All Files option in the Save As drop-down menu and type helloworld.c in the File name box. Save the file to the Windows desktop, leaving the Notepad window open.

macOS – start the Terminal from the Launchpad, type the command cd ~/Desktop followed by the Enter key and then touch helloworld.c, followed by Enter. After that, open the file by double-clicking on the newly created icon on the Desktop.

macOS – start the Terminal from the Launchpad, type the command cd ~/Desktop followed by the Enter key and then touch helloworld.c, followed by Enter. After that, open the file by double-clicking on the newly created icon on the Desktop.

At this point, type within the previously opened text editor window (Notepad or XCode) the following code.

Once this is done, save the file you created earlier and close the editor. At this point, you just have to compile the source, thus creating a file that can be executed by the operating system.

Once this is done, save the file you created earlier and close the editor. At this point, you just have to compile the source, thus creating a file that can be executed by the operating system.

If, instead, you are on a Mac, use the previous open Terminal to issue the command gcc helloworld.c -o helloworld followed by pressing the Enter key, and then start the small program by issuing the command ./helloworld.

As you can see, the little software you just made does nothing more than print “Hello, world!” on the screen. Did you see that then it wasn’t so difficult! If you are interested in deepening the discourse and discover more about the C language, I recommend you to refer to the exhaustive thematic guide of HTML.it.

How to start programming in Java
Is it your intention to approach the world of programming using the Java language? Then this is the section of the tutorial for you: below, in fact, I will provide you with the necessary information to create a small program that prints on screen the words “Hello, world!”.

As I mentioned earlier in this guide, in order for a Java program to run, the Java Runtime Environment component, or JRE, must be present on the operating system you are using. However, if it is your intention to create a program, you must, instead, rely on the Java Development Kit, or JDK component, which contains everything you need to program using the language in question.

To get it, go to the program’s website, check the Accept License Agreement box (located under the Java SE Development Kit XX heading) and then click on the link to download the JDK version that suits your computer: Windows or macOS. For your convenience, make sure you download the files in exe or dmg format respectively.

Once the download is complete, if you’re on Windows, launch the downloaded file and click the Yes, Next (twice in a row) and Close buttons. When you are done, proceed to adjust the environment variables of your computer so that the Java compiler is easily accessible: to proceed, right-click on the This PC icon located on the desktop, select Properties from the context menu and choose Advanced System Settings from the sidebar of the window that opens.

After that, click on the Environment variables… button, click on the New… button under the heading System variables, type the string JAVA_JDK in the Variable name field and the JDK path (e.g. C:Program FilesJavajdk11.0.2) in the Variable value field; finally, click on the OK button to save the changes.

After that, click on the Environment variables… button, click on the New… button under the heading System variables, type the string JAVA_JDK in the Variable name field and the JDK path (e.g. C:Program FilesJavajdk11.0.2) in the Variable value field; finally, click on the OK button to save the changes.

If, on the other hand, you are on macOS, you simply have to launch the .dmg package downloaded earlier, launch the .pkg file located within it and proceed with the installation by clicking on the Continue button, then on Install (typing, when prompted, the password of your Mac) and, finally, on the Close button.

HelloWorld.java

At this point, you just have to create the source code of the program: following the same steps that I indicated above, create the HelloWorld.java file using the procedure best suited to your operating system. When you’re done, write the following code inside.

When you’re done, save the source file, close the text editor, and run the program using one of the methods I outline below.

Using the previously opened macOS Terminal, type the command cd ~/Desktop to move to the Mac Desktop and perform the same instructions as seen on Windows to compile and run the program.

Using the previously opened macOS Terminal, type the command cd ~/Desktop to move to the Mac Desktop and perform the same instructions as seen on Windows to compile and run the program.

As you can see, the newly created program shows a simple dialog box with the words “Hello, world!”: that wasn’t difficult at all, was it?

However, to learn more about Java, you can freely consult my guides on how to learn Java and how to program in Java, in which I taught you the basics of programming in this language. For even more specific information, I suggest you turn to the thematic tutorial available on HTML.it.

How to get started with Python
After reading the introduction of this guide, you were intrigued by Python and now you would like to understand how to start programming using this language? Perfect, I think I can help you: below, I’ll show you in detail how to get the tools you need and, finally, how to create and run a very simple program. Ready to go? OK, let’s go.

So, first of all, go to the Python website and click on the version of the software best suited for your operating system (e.g. Python X.X.X installer EXE for Windows x86-64 if you’re using 64-bit Windows, Python X.X.X installer for Mac OS X 64-bit/32-bit if you’re using a Mac, and so on) and, once the download is complete, run the file you just obtained.

At this point, if you are on Windows, check the Add Python X.X to PATH box, click on the Install Now and Yes buttons and wait for the installation process to finish automatically. To finish and exit the setup program, click on the Close button.

If, on the other hand, you are using a Mac, launch the downloaded .pkg file, press the Continue button three times in a row, then the Accept and Install buttons, enter the Mac password in the appropriate field and finish the process by pressing the Install Software and Close buttons.

HelloWorld.py

Once you have installed everything you need, you can finally create and run your first program in Python. So, for starters, create a new file called helloworld.py using the instructions I provided above, open it and write the following code inside.

Don’t be surprised by the simplicity of this code: Python is as powerful as it is flexible, and has many basic “built-in” functions that don’t require importing external libraries. Now, save the file and follow one of the steps below, depending on your operating system.

macOS – using the previously opened Terminal, place yourself on the Desktop by issuing the command cd ~/Desktop and pressing the Enter key.

Since python is an interpreted and not compiled language, you only need to type the python command HelloWorld.py to run immediately the small program you have just created. For further information about this language, I invite you to consult the specific guide realized by HTML.it.

How to create a program

Now that you have all the knowledge you need to start programming, you might want to think about taking it a little more seriously and actually figure out how to create a real program using the language you prefer.

In this regard, I recommend you a careful reading of my thematic guide on the subject: in it, I’ve been able to explain in detail all parts of the life cycle of a program, and then provide you with the practical example of a working calculator written in C language. Trust me, it’s really worth a look!

Leave a Reply

Your email address will not be published. Required fields are marked *