Please help me understand how programs are layered

Dotan Cohen dotancohen at gmail.com
Tue Oct 3 22:01:02 UTC 2006


On 03/10/06, Dariusz J. Garbowski <thuforuk at yahoo.co.uk> wrote:
> On 10/03/2006 08:00 PM, Dotan Cohen wrote:
> > Please excuse the newbie-question, but I'd like to know why certain
> > apps are "gnome apps" and others are "KDE apps".
>
> Dotan,
>
> These are excellent questions. So good that I will try and answer them :-)
>
> > If I understand
> > correctly, programs are written in languages (C, perl, mono), using
> > toolkits (QT, GTK), for certain operating systems (Linux, Windows).
> > Now, as I understand it, programs written with the QT toolkit are KDE
> > apps, and those written with the GTK toolkit are Gnome apps. Is this
> > correct?
>
> Toolkits (GTK/Qt) provide (for the sake of simplicity of my answer, I'm
> sure others may elaborate more ;-)
>
> - widgets like buttons, labels, edit fields, etc. and even file selectors
> - methods for handling user interaction (e.g. event loop or callbacks)
> - some other things depending on toolkit
>
> http://en.wikipedia.org/wiki/Gui_toolkit
>
>
> Now desktops, like Gnome and KDE, build on top of a toolkit and
> operating system providing things like menu, desktop with icons, basic
> applications (e.g. text editor, clock), windows (window manager), file
> manager, etc.
>
> http://en.wikipedia.org/wiki/Desktop_environment
>
>
> > Now, I understand that changing a program from C to mono is impossible
> > without rewritting the whole program from scratch.
>
> It's not necessarily as "black&white". But this is long discussion and
> depends on many factors...
>
> > But can a program
> > be switched from GTK to QT or vice-versa? How involved is that? Can
> > there be a QT version and a GTK version of the same app?
>
> If your application core is nicely separated from frontend (GUI) it's
> possible to do so. In fact it's very common in Unix/Linux world -- quite
> a few apps are written as command line utilities and there are different
> frontends for them. Example: K3b is a frontend for bunch of CD/DVD
> mastering and recording tools.
>
> This by no means is the only way. You can for example write a library
> that is used by the different frontends. See how xine engine is used by
> Amarok and other applications.
>
> There are other possibilties too...
>
>
> > Also, I understand that programs written in C can work on either linux
> > or windows, but those written in Java can run on both, because the
> > Java runtime environment is specific to the OS. How does the toolkit
> > affect this- are they written in only QT || only GTK || neither?
>
> Java is yet another "animal". Java Runtime Environment (JRE) provides
> two GUI toolkits:
>
> - AWT, which is simpler and uses native OS widgets, thus looking and
> behaving slightly differently on different OSes
> - Swing, which is more advanced and OS indepentent (yet, it can
> integrate with underlying OS, e.g. look more Windows-like on Windows, or
> GTK-like on Linux); it draws its own widgets without using native toolkits
>
> There's another native toolkit, SWT/JFace, used by Eclipse platform and
> application built on top of Eclipse (http://www.eclipse.org/swt). This
> one is not part of JRE. It uses native toolkits for widget rendering and
> so integrates better with underlying OS (e.g. on Linux it uses GTK).
> There is an effort to write Swing implementation of SWT allowing for SWT
> to be OS-independent. Currently application developers need to include
> different native part of SWT for different OSes, which somewhat defies
> Java's "write once, run anywhere" motto.
>
>
> > Thanks for the info. Nothing I've been able to google has explained
> > this very well, for non-developers like myself.
>
> Hope this helps :-)
>

That does help, thanks. I now understand that a program like F-Spot,
which is a "gnome app" must have gnome installed and will not run on a
KDE-only system. So, if I want to lean out my system, I must find a
KDE replacement for F-Spot.

Tell me, does having Gnome stuff running in the background slow down
KDE? For instance, if I fire up F-Spot, will it use considerably most
system resources than, say, DigiKam, because it must load the gnome
libraries? Am I essentially, then, running two desktops at once and
therefore killing the computer? I'm on a 1.2 gHz Duron processor with
512MB ram, and I feel that the system is extremly slow. Would I be
best off eliminating the Gnome apps? How can I know, before starting a
program, what libraries it will load, and therefore how much resouces
it will take?

Thanks.

Dotan Cohen
http://lyricslist.com
658




More information about the kubuntu-users mailing list