We have already covered the steps for creating your own application. However, we still get heaps of questions about the best programming language to write that web or desktop application, technologies that will represent a given concept, and tools to make the application as optimal as possible. We asked one of our experts, Tomasz Przedzinski, for his opinion. Tomek has put together a series of posts on the most popular programming languages, which will take a deep dive into the different technologies, take a closer look at the popularity of programming languages and give some tips on what to write a web or a desktop application in.
A number of us occasionally keep an eye on the TIOBE index, an extremely versatile indicator of programming languages’ popularity. It makes for a very useful tool, showcasing not so much the trend of today’s market as its status quo in terms of tools and technologies, used by programmers worldwide. TIOBE is very accurate in pointing out the programming languages with the future while hinting directions in which it is worth developing your skills and what the business needs.
Top 5 programming languages in TIOBE index, July 2022. Source: www.tiobe.com
In its July 2022 ranking, TIOBE notes that Python, C, C++, and C# are currently the top contenders for the 2022 programming language of the year. The presence of Java¹, C, and C++ at the top has been consistent for more than two decades, while Python’s booming popularity has placed it at the top of the ranking for the first time in its history. The C# coding language’s popularity has had its ups and downs, but its presence in the Top 5 has been rather apparent in recent years.
So why is it worth knowing it and what sets C# apart from other languages? More about that shortly.
It should hardly come as a surprise that the contenders listed by TIOBE cover virtually the entire market of software services, with each of them holding a crucial place in different sectors. Choosing a programming language is often determined by the type and purpose of the software. The C language rules in the lowest layers of software and in embedded software. C++ spans a broad spectrum of applications, although it mainly focuses on backend and performance-driven solutions, taking into account stock exchange applications such as High-Frequency Trading (HFT) and Low-Latency Trading. Python, on the other hand, is an invaluable tool for quick solutions prototyping and building test frameworks. It is also widely used by those involved in machine learning C# in combination with the .NET framework, especially after the release of .Net Core, is one of the most heavily applied technologies in cloud solutions in the broad sense, in web, mobile, and desktop applications – and particularly on the Windows operating system. It performs well in conjunction with the emerging popularity of IoT. It is well worth mentioning that all major game engines are written in C++, with the Unity engine being partly written in C#. Games created for the Unity engine are written in C#, which has substantially contributed to the widespread use of this language².
The idea behind the creation of C# was to create a high-level language similar in concept to Java, yet close in syntax to C++. C# was intended to simplify the C++ syntax and provide the tools available in modern programming languages, with a focus on reliability and ease of project development. The success of C# demonstrates this concept has been achieved at least partially.
“Hello world!” program in C#
C# is a statically-typed, high-level coding language. Just like Java, it is compiled into an intermediate language called CL (Common Language). In order to execute the code, a suitable infrastructure such as the .NET platform is needed, within which it is run in the CLR (Common Language Runtime), a virtual machine that operates on similar principles to the JVM (Java Virtual Machine).
Due to its strong association with the .NET platform, it is very common to say that one writes for the .NET platform³ instead of saying that one writes in C#. And that is because writing for the .NET platform entails leveraging the entire ecosystem it contains. This includes the aforementioned runtime environment, as well as a set of libraries.
There are loads of different terms and details associated with .NET, and the process of compiling and running code on this platform itself is quite complex. However, it is not necessary to be familiar with them to get started working in it. However, it is worth noting one crucial point here: most projects are developed on either .NET Core or .NET Framework. The former is oriented towards performance and cross-platform and is mainly intended for web applications, microservices, and mobile devices apps. The .NET Framework is limited in its implementation to the MS Windows platform⁴ but instead allows for easy development of desktop applications and games. Both platforms can be used to write web applications with ASP.NET⁵, though they should be treated separately, as a code written for one cannot be run on the other. Their common part is called .NET Standard.
The .NET platform takes maximum advantage of the possibilities offered by running middleware code. Hence, we are brought with:
Graphical window editing, for instance in Visual Studio, significantly speeds up the process of building desktop applications on the .NET platform and makes it a popular choice when it comes to developing applications in the financial sector. It is also often used to build applications intended to serve as an interface for database management in companies. ASP.NET, on the other hand, is a convenient alternative to PHP or Node.js for creating web services. ASP.NET is appreciated for its reliability and scalability, hence why some of the largest web services, such as StackOverflow, are built with it. The ease with which projects can be hosted on cloud platforms relieves not only developers but also managers from dealing with the infrastructure in which the project is embedded.
Microsoft has made sure the .NET platform can be conveniently used in cloud solutions, especially Microsoft Azure. Azure comes with a number of tools to make it easier to create microservices and, what I reckon is far more important, to monitor their performance and look for errors, including monitoring database queries to help optimize them.
C# is an object-oriented language⁶. It has built-in mechanisms for asynchronous programming, represented by the async and await keywords, among others. These enable efficient programming using both Task-based Asynchronous Pattern (TAP) and Event-based Asynchronous Pattern (EAP) approaches.
One thing that sets C# apart from other programming languages is its built-in query creation mechanism, LINQ (Language Integrated Query). LINQ allows you to create queries that can be executed on both a database as well as a collection of objects. Either a Fluent Interface or SQL-style syntax can be used. The queries are optimized for the databases (or collections) used by the projects and allow for lazy evaluation. They can also be parallelized using PLINQ (Parallel LINQ).
C# escapes many of the problems observed in other languages. A tremendous advantage, which I personally like a lot, is the transparency of compilation errors. Intellisense, running for instance as a plug-in for Visual Studio Code, reports virtually every possible error. Having fixed all of them, I am almost 100 percent sure that the code will compile and run; something that is severely lacking when working with C++.
However, the use of a compilation mechanism to intermediate code and execute it with a runtime environment entails a markup in terms of reduced performance. An optimized program in C++ will execute faster than one written in C#, with an emphasis on the word ‘optimized’, as often hand-written solutions in C++ are more efficiently implemented in the libraries of the .NET platform.
Developing web and desktop applications with the .NET platform poses a challenge due to its level of complexity. Many concepts require learning the details of how this platform works in order to avoid typical errors that slow down program performance. Some of the basic mechanisms simply take some getting used to because, for instance, they work differently from what a programmer would expect.
For instance – structures and classes have a different purpose in C#, so they are handled in a slightly different way. Structures should be used to store Plain Old Data (POD) objects, so assigning or passing them as a function argument creates their copy. Classes are treated similarly to Java – they are passed by reference. This is a detail that is easy to grasp, but it can sometimes catch you by surprise. There are definitely far more exceptions of this kind in C#’s behaviour when compared to other coding languages.
An example of a typical problem in C# – the code above will output ’10, 20, 20,20′, which may baffle some programmers. ‘Test1’ is a structure, so a copy of it will be made on line 14, whereas ‘Test2’ is a class, so on line 23, a new reference to the same instance of the class will be made.
These differences are easy to catch when you can see the definition of ‘Test1’ and ‘Test2’, but in a complex project, when collections of various types are involved, it is harder to keep track of the object types being manipulated and it becomes easier to make mistakes.
It is also worth bearing in mind that, as in Java, projects written in .NET tend to have many layers of abstraction and can be very complex, which is avoided for performance reasons in projects written in C or C++⁷. The threshold for entry into an existing project is quite high and requires heaps of domain knowledge before one can work effectively in it.
We have started off from the end, but we will go through the profiles of all the contenders. Will determine our winner too? Stay tuned. In the meantime, we are leaving you with a brief summary of the contenders’ basic features to illustrate the biggest differences between them.
|The main programming paradigm
|Procedural, functional, object-oriented (and others)
|Yes (can be turned off)
|Multi-threaded programming support
|TAP, EAP, other
|TAP, EAP, other
|TAP, EAP, other
|The most popular package manager
|The most popular project-building tool
|Difficulty in learning a language
|Work in complex projects
A summary of the key differences between the C, C++, Python, and C# languages. The last two items strongly depend on the way the project is organized. We may always end up with one where the difficulty levels are reversed.