Friday, September 24, 2021

GNOME Developer Talks About GNOME Do

http://www.flickr.com/photos/[email protected]/ / CC BY-SA 2.0

With all the recent heat generated about Mono and the C#
language, it only seems appropriate to take a look at the issue from a
programmer’s perspective. There are a number of open source projects written in
the C# language. Banshee, F-Spot and Tomboy are three of the most popular.
F-Spot has even made it to the status of default photo management tool for several
distributions including openSUSE and Ubuntu.

GNOME Do is a great
example of open source software that started out as the pet project of one
individual. In actuality, it began as the senior thesis project for David
Siegel. David needed to come up with an idea for a software project that would
embrace the development concepts of the open source community. Having most of
his experience in the Mac world, he decided on building a Quicksilver lookalike
for Linux.

Language Decisions

David had made the initial decision to build his tool for
the GNOME desktop environment on Ubuntu. He looked at a number of different
languages including C, Python, Vala, Java, Boo, Haskell, Clojure, and OCaml.
The decision to use C# came through a process of elimination. Here’s how he
answered the language question in response to a post on his
blog
:

“I implemented basic Gtk+ examples in most of those
languages (the ones that had Gtk+ bindings in a reasonable state) and found
that C# on Mono gave me a statically typed language, pretty good performance,
tons of support, preexisting applications to learn from, well maintained
documentation, bindings, and libraries, and published books on .NET/C#/Mono.”

The Mono group also has a lively IRC channel where you will

find many of the principals hanging out and answering questions. “When I first
started coding in C# I ran into a few things that I couldn’t figure out. I went
on the Mono IRC channel, and Miguel answered my questions straight away. He
helped me get through a few rough spots, and that alone really impressed me
about the community support for C#,” says David.

Architecture Decisions

One of the features that made its way into GNOME Do early on
was the concept of a plugin architecture. Writing plugins can be a difficult
task for some environments. One of the examples that David looked at during the
evaluation process was Catapult for
KDE. The first thing he identified when evaluating Catapult was the difficulty
of building plugins. Everything was built using C++, and the whole process was somewhat
complicated.

Monodevelop is the development environment of choice for
building GNOME Do plugins. The best way to learn how to build a new plugin is
to take an existing one and modify it to meet your own needs. You can find a
large list of existing plugins on the GNOME Do wiki site.

The other big lift from using C# and managed code is the
ability to take user contributed code and just drop it in. For example, the
Skype plugin has between 2000 and 3000 lines of code in it. All plugin code is
kept on the launchpad site. The
team builds the plugins as-is from that site and they are available to GNOME Do users
through a preferences menu. The sandbox runtime environment of
the CLI provide an extra measure of security you can’t get with a language like C while
C#’s static typing help take the worry out of runtime errors common to dynamic languages.

From David’s perspective the C# language had many of the things
that were important to him, but it was not until the advent of C# 3.0 that he
really got excited about the language. C# 3.0 brought a number of improvements
to the language including anonymous types, lambda expressions and Language Integrated
Query (LINQ). The LINQ features alone made it possible for the GNOME Do team to
refactor a large amount of their code.

Building on top of the Common Language Infrastructure (CLI —
ECMA 335), or the Mono runtime as it is implemented, makes it possible to take
advantage of other languages such as Boo. Boo is a Python-like language built
on top of the CLI. You could also use IronPython which does run on Linux on top
of the Mono runtime.

The other part of the success story for GNOME Do is the team
they have build. They currently have 4 — 5 core developers to complement almost
100 contributors to the project. David attributes the level of participation to
the use of C#. “We had one guy that came in and wrote a Firefox indexing plugin.
He did all the SQL to index your history and made it available to GNOME Do. Then
he moved on to something else,” says David.

Learning C# is not difficult, especially if you have
experience with languages like Javascript. Running a program on top of the CLI
provides a level of protection in a managed code environment that you don’t get
with languages like C or C++. There are a number of good IDE tools for writing
and debugging code, or you can just use your favorite text editor and the command
line tools to build your code as do many on the GNOME Do team.

Bottom Line

Choosing a programming language often comes down to personal
preference. It frequently equates to comfort level or convenience. Finding an
easy way to program something usually wins out over elegance. In the long run you
will write code that’s both easier to read and maintain if you enjoy the
language and write readable code.

The C# language is just another tool in the toolbox backed
by an international standard (ECMA 334). It also happens to be a favorite
language of the largest software company in the world, making it a target to
avoid in many people’s mind. In the end you’ll just have to go with what makes
the most sense for your needs.

NewsletterDATAMATION DAILY NEWSLETTER

SUBSCRIBE TO OUR IT MANAGEMENT NEWSLETTER



Similar articles

Latest Articles