Maker Pro
Custom

Which Programming Language Should I Choose? Graphics and GUIs

July 20, 2018 by Robin Mitchell
Share
banner

This article explores the pros and cons of different programming languages' graphical user interfaces, or, GUIs.

If your project requires a better user interface than a command line, you will probably want either a graphical user interface (GUI) or a graphical window. In this article, we will look at the main languages and how they compare in the world of GUI.

Catch up on the rest of the programming languages series here:

A Command Line Can Only Go So Far

When the first home computers were first introduced, the most common form of input and output was a keyboard and text display. Commands could be entered and text would display results, but this was both daunting for new computer users and inefficient. It was not long before the first graphical systems came around (thanks to Xerox), and ever since, nearly all computers use a GUI as their primary interface.

So with this in mind, if you are planning to make a project that requires user input, a half-decent GUI would not be a bad idea. But how do the different languages fare when it comes to GUI applications? How are they when it comes to graphics in general?

C/C++ GUI

C and C++ are interesting because they are commonly the go-to language for graphics rendering. However, this is not because they are easy to use in said environments, but because of the fact that they are compiled. The compilation into native machine code usually means they outperform most other languages, which is very important if an application (such as a game) requires high FPS. 

While there are cross-platform GUI libraries available for C/C++, they are not the easiest to use simply due to their complex nature compared to other languages. Therefore, you may want to consider using C/C++ in a graphical environment if speed is very important. If, however, you only intend to use a few buttons, edit boxes, and lists, this may not be the language for your project.

Java GUI

Since one of Java’s focuses is to be cross-platform, the GUI packages available work on most Java-enabled devices. The two main packages available for Java GUI applications are AWT (now depreciated/not-recommended), and Swing. One neat feature when using an IDE like eclipse is that you can graphically design a GUI application (in a near identical fashion to VB.net), which can save huge amounts of time during the design stage. 

Java also has libraries available for graphical routines, which allows for both 2D and 3D rendering of graphics (one popular example is Minecraft, which is a 3D-rendered voxel game written in Java). However, one disadvantage of Java as a graphical coding environment is its speed, which is why there are very few 3D games written in Java. Because Minecraft has been written in Java, it does not perform well on low-end computers and mid-range computers that are available to most home users (this is why a few optimization mods such as Optifine came out). 

If your project needs to be cross-platform and moderate processing power is required, Java would be a good choice of language.

Python GUI

Python is interesting because it describes itself as an easy-to-use and read language, but creating a GUI application can be tedious. Python is an interpreted language and is all written in code (unlike Java’s GUI or VB.net’s GUI graphical construction), so making programs will be harder, but using a GUI library such as wxPython is somewhat daunting. 

Having said that, Python is still considerably easier to use than one written in a language such as C/C++ since library names are more readable, there are fewer lines of code needed, and Python has a habit of being less error-prone. 

Making graphical applications for 2D games, however, is incredibly easy with libraries such as PyGame, and a decent FPS can be achieved. But since Python is interpreted, you can expect a heavy penalty on processing speed. So it is not suitable for programs that may need to process large amounts of data while updating a graphical window. 

If you need to get a program out fast and don’t mind coding the individual buttons, Python is a good language for graphical routines. However, if you need processing power and a high FPS, you are better off looking at other languages.

VB.net/C# GUI

Out of all the languages shown in this article, VB.net and C# in conjunction with Visual Studio are the easiest languages to use with graphical routines. Visual Studio provides an editor that allows for the creation of form applications by graphically designing them (drag and drop), which significantly decreases the time needed to make a GUI app. 

However, VB.net and C# do suffer from one massive drawback — they are not cross-platform (Windows only). Both languages rely on the .net framework to create graphical applications which is not available on Mac, Linux, or Android. However, there are some libraries that allow for cross-platform form applications, such as Mono, but as a result, have less functionality than what is provided by Windows. 

If your project only needs to target Windows devices, VB.net and C# are the languages of choice (assuming that you do not need to do 2D/3D rendering). If you need to do graphics rendering, you could use the XNA framework, which works with both VB and C#, but since these are bytecode languages, you will have a speed penalty.

Conclusion

It's amazing how more modern languages (Java, Python, VB.net, etc.) have adapted themselves to suit modern needs, such as the use of graphical interfaces, while older languages are slowly falling behind. That is not to say that older languages cannot do the same tasks, but to do the same tasks takes more code and effort to get working. 

Of course, older languages such as C and C++ have massive performance boosts being compiled into native code, but this causes issues when trying to make a cross-platform application. 

Overall, the decision is up to you which language you choose, but if you can get away with using Windows only, then the .net framework could be your best friend. Otherwise, Java will probably be the best language to use.

Author

Avatar
Robin Mitchell

Graduated from the University Of Warwick in Electronics with a BEng 2:1 and currently runs MitchElectronics.

Related Content

Comments


You May Also Like