GUI Interface to the Linux Engine

I would like to spend some time talking about a subject that is near and dear to my heart – the GUI Interface to the Linux Engine. In today’s computing environment, Linux is usually used as a platform. That is, most Linux implementations primarily consist of user applications. They tend to stay out of the kernel. Why, you ask? Because hardware is rapidly changing and it is much easier to port user applications as opposed to kernel changes. Also, it is much easier to debug user applications. And lastly, user applications usually do not crash the kernel. Thus such systems are inherently more reliable.

GUI & Linux Engine

So now that we have established that the majority of Linux systems are user application platforms. How do Graphical User Interfaces (GUI) interface with such systems like the Linux Engine? And I also include Web Applications in this problem. There are two basic ways to solve this problem.

METHOD 1

The GUI gathers data through the Linux Command Line Interface (CLI). This involves running various Linux commands and quite possibly user utilities. At first glance, this approach sounds optimal, in that the GUI is gathering data directly from the source. But there are serious problems with this approach. The GUI has to understand were to get the data. The result is that the GUI has to have intimate knowledge of Linux and application internals. This makes the GUI hard to port to different Linux platforms or different operating system platforms. It also creates a strong bond between the GUI and applications that is cumbersome and dangerous. Problems occur when the application makes internal changes, possibly requiring changes in the GUI. The solutions to this problem are Method 2.

METHOD 2

The GUI uses an application API to gather data. This approach is analogous to the application interface to the kernel. The Linux kernel does not allow user applications to directly read internal structures. Rather, there is a well defined interface (system calls) that provide access. Thus the kernel is free to change internal data structures at will. As long as the system call interface does not change, then user applications are not effected.

The same should hold true for the GUI/Linux API. Linux applications are free to implement as they see fit. The key is defining a strong API for GUI access.

This approach is easy to port to another Linux system or another type of operating system. The GUI interface does not change.

Recommended Linux Engine Interface

Now what should the interface be? I would recommend a database or a RESTfull interface. Be that as it may, I hope that I have motivated you to keep the GUI out of the application and Linux internals.