LDP/LDP/howto/linuxdoc/Programming-Languages.sgml

470 lines
14 KiB
Plaintext

<!doctype linuxdoc system>
<article>
<title>Programming Languages mini-HOWTO
</title>
<author>Risto S. Varanka
</author>
<date>Jul 22nd 2000
</date>
<abstract>A brief comparison of major programming languages for
Linux and major libraries for creating graphical user interfaces
(GUIs) under Linux
</abstract>
<toc>
<sect>Introduction
<p>Linux is a fascinating operating system because it lets any
user participate in its development. The variety of available
languages, however, can be confusing to beginning Linux
developers. This document lists the most common options for
everyday development and states some key facts about them. (Well,
``most common'' and ``key'' as I perceive them.)</p>
<!-- point to possible larger howto -->
<p>My aim is neither to review the languages nor to determine
which one is the best. Each language is a tool that fits some
jobs and some tastes. You can get further (often conflicting)
information easily, if you ask around or keep your ears open. The
Links sections in this document will give you some pointers for
your own research.</p>
<!-- perhaps there should be some freeform discussion in the
Comments part of the tables -->
<!-- why is my language not included? perhaps explain that in
detail -->
<p>There is a plethora of languages and libraries for Linux, so
this document only covers the most common languages and GUI
(Graphical User Interface) toolkits at the moment. This document
is intended to be fairly neutral, but I haven't included all
languages available. Since my judgment is undoubtedly biased in
many ways, I advise serious developers to check out the sites that
do a better job in listing all languages and libraries. Also note
that only the Linux implementations of the languages and GUI
toolkits are covered, their features on other platforms are not
discussed or implied.</p>
<p>This document is a recent addition to the LDP, so there has not
been opportunity for much community feedback. However, it is
released in hopes that it will prove useful for people interested
in programming under Linux, especially beginners. A question mark
in the tables indicates lack of information. If you can fill it
in, please contact the author. </p>
<sect1>Latest Version of the Document
<p>You can find the latest modifications at <url
url="http://www.helsinki.fi/~rvaranka/Computer/Linux/HOWTO/"
name="http://www.helsinki.fi/~rvaranka/Computer/Linux/HOWTO/"></p>
<sect1>Copyright
<p>Copyright (c) 2000 Risto Varanka.</p>
<sect1>License
<p>The following license terms apply to all LDP documents, unless
otherwise stated in the document. The LDP documents may be
reproduced and distributed in whole or in part, in any medium
physical or electronic, provided that this license notice is
displayed in the reproduction. Commercial redistribution is
permitted and encouraged. Thirty days advance notice via email to
the author(s) of redistribution is appreciated, to give the
authors time to provide updated documents. </p>
<sect2>Requirements of Modified Works
<p>All modified documents, including translations, anthologies,
and partial documents, must meet the following requirements:</p>
<p>
<enum>
<item>The modified version must be labeled as such.
<item>The person making the modifications must be identified.
<item>Acknowledgement of the original author must be retained.
<item>The location of the original unmodified document be identified.
<item>The original author's (or authors') name(s) may not be used to
assert or imply endorsement of the resulting document without
the original author's (or authors') permission.
</enum>
</p>
<p>In addition it is requested that:</p>
<p>
<enum>
<item>The modifications (including deletions) be noted.
<item>The author be notified by email of the modification in
advance of redistribution, if an email address is provided
in the document.
</enum>
</p>
<p>As a special exception, anthologies of LDP documents may
include a single copy of these license terms in a conspicuous
location within the anthology and replace other copies of this
license with a reference to the single copy of the license without
the document being considered ``modified'' for the purposes of
this section.</p>
<p>Mere aggregation of LDP documents with other documents or
programs on the same media shall not cause this license to apply
to those other works.
</p>
<p>All translations, derivative documents, or modified documents
that incorporate any LDP document may not have more restrictive
license terms than these, except that you may require distributors
to make the resulting document available in source format.</p>
<sect1>Disclaimer
<p>THIS DOCUMENT COVERS A LARGE AND CONSTANTLY CHANGING
DOMAIN. THEREFORE, THE INFORMATION CONTAINED IN THIS DOCUMENT MAY
BE INCORRECT OR OUTDATED. ALL USE OF THIS DOCUMENT AND ALL
INFORMATION CONTAINED IN IT IS AT YOUR OWN RISK. THE AUTHOR DOES
NOT GIVE ANY WARRANTY OR GUARANTEE, EITHER EXPLICIT OR
IMPLIED. </p>
<sect1>Author
<p>You are welcome to send feedback to the author at: <url
url="mailto:risto.varanka@helsinki.fi"
name="risto.varanka@helsinki.fi">.</p>
<p>Author's web site can be found at <url
url="http://www.helsinki.fi/~rvaranka/"
name="http://www.helsinki.fi/~rvaranka/">.</p>
<sect1>Credits
<p>I am thankful to several people who commented on language
issues. These conversations have given me a better view of the
different languages, and I hope future conversations will allow
this mini-HOWTO to mature over time. Especially I would like to
thank the people at the IRCNet channel #linux: Morphy, Bluesmurf,
Vadim, Zonk^, Rikkus and others whose names I have
forgotten. Thanks go also to Stig Erik Sandoe for helpful
comments.</p>
<sect1>Links
<p>Exhaustive lists of Linux development libraries and tools:</p>
<p>
<itemize>
<item><url url="http://www.freshmeat.net/appindex/development/"
name="Freshmeat">
<item><url url="http://www.hotfeet.ch/~gemi/LDT/" name="Linux
Development Tools">
<item><url url="http://www.linuxprogramming.com/"
name="linuxprogramming.com">
</itemize>
</p>
<p>The <url
url="http://www.tuxedo.org/~esr/faqs/hacker-howto.html"
name="Hacker FAQ"> by Eric S. Raymond is another interesting text
for novice Linux developers. It concentrates on some cultural and
psychological aspects of open source development. </p>
<p>Other <url url="http://www.linuxdoc.org/" name="LDP documents">
covering general programming subjects include the Reading List
HOWTO and the Linux Programmer's Guide - several more have been
written on specific subjects.</p>
<sect>Programming Languages
<!-- explain concept? -->
<p>C, Lisp and Perl are traditional hacking languages in the
GNU/Linux culture; Python, PHP, Java and C++ have gained new
ground recently.</p>
<sect1>Concepts in the Table
<p>
<descrip>
<tag>Language</tag>
A common name of the language.
<tag>Beginner</tag> Indicates how well suited the language is for
people with little programming experience. A language marked with
``yes'' should be viable for a beginner's first programming
language.
<tag>Performance</tag> How fast your applications are likely to
run when you put them into production use. Performance depends
more on your algorithmic programming skills than the actual
language. As a rule of thumb, C, C++ and Fortran are sometimes
necessary because they can offer better performance than other
languages - at other times they might be unwieldy for the desired
purpose. (One idea for unscientific ``benchmarking'' of the
languages would be to implement a simple sorting algorithm in all
of them and compare running times. This of course does not measure
the performance of the actual language - since that concept does
not make sense - but only the implementation. Of course it's also
not a very reliable or thorough method, but it would give an
example how running times in different languages can
differ. Anybody want to help me with this?)
<tag>OOP, Object-Oriented Programming vs. other paradigms</tag>
Object-oriented programming is an important programming paradigm
that is gaining popularity. In object oriented programming, data
structures and algorithms are integrated into units, often called
classes. OOP is often contrasted with procedural programming
(which uses separate algorithms and data structures). It is not
strictly dependent on language: you can do OOP in languages not
listed as such (C for example), and program in the procedural
style in languages that are listed as OOP. I've listed as OOP
languages that have special features or add-ons to facilitate OOP.
Functional languages (Lisp for example) are a bit different breed
- among other things, functional programming is a superset of
OOP. Logic programming (Prolog), also called declarative
programming, on the other hand, is not related to the other types
of programming in a similar sense.
<tag>RAD, Rapid Application Development</tag> More dependent on
the tools you are using than the actual language. There is a
HOWTO on GUI development tools for Linux, although it's out of
date. With a good graphical tool you can do RAD. RAD can be
powerful when based on code reuse as well, so free software could
provide a good starting point.
<tag>Examples</tag> Mentions fields of programming the language is
most often used in. Other good (and bad) uses exist, but they are
less typical.
<!-- explain categories in a future version -->
<tag>Comments</tag> Additional information on the language, like
capacities and dialects.
</descrip>
</p>
<!-- Check case of languages: UPPER or Capital? -->
<sect1>Major Languages
<p>
<verb>
Perl
Beginner: Yes - OOP: Yes
Examples: Scripting, sysadmin, www
Comments: Powerful for handling text and strings
Python
Beginner: Yes - OOP: Yes
Examples: Scripting, application scripting, www
Comments:
TCL
Beginner: Yes - OOP: No
Examples: Scripting, sysadmin, applications
Comments:
PHP
Beginner: Yes - OOP: Yes
Examples: Www
Comments: Popular for web databases
Java
Beginner: Yes - OOP: Yes
Examples: Cross-platform applications, www
Comments: Spreading to new areas, eg. e-commerce infrastructure
Lisp
Beginner: Yes - OOP: Functional
Examples: Emacs modes (for Elisp), AI
Comments: Variants Elisp, Clisp and Scheme
Fortran
Beginner: No - OOP: No
Examples: Mathematical (scientific) applications
Comments: Variants f77 and f90/95
C
Beginner: No - OOP: No
Examples: System programming, applications
Comments:
C++
Beginner: No - OOP: Yes
Examples: Applications
Comments:
</verb>
</p>
<!-- is Prolog really major?
Prolog
Beginner: Yes? - OOP: Declarative
Examples: Databases, AI
Comments:
-->
<sect1>Shell Programming
<p>Shells are an important programming environment, too. I haven't
covered them because I don't understand the field very thoroughly
yet. Knowledge of shells is important for anyone who works on
Linux regularly, more so for system administrators. There are
similarities between shell programming and other kinds of
scripting - often they can achieve the same goals, and you have
the option of choosing between native shell and a separate
scripting language. Among the most popular shells are bash, tcsh,
csh, ksh and zsh. You can get basic information on your shell with
the <em>man</em> command, <em>man bash</em> for example.</p>
<sect1>Other Languages
<p>Other languages of note: AWK, SED, Smalltalk, Eiffel, Ada,
Prolog, assembler, Objective C, Logo, Pascal (p2c converter)</p>
<sect1>Links
<!-- integrate these in the "table" perhaps -->
<p>
<itemize>
<item><url url="http://www.tunes.org/Review/Languages.html"
name="A general info site"> on programming languages, lots of info
and opinions
<item><url url="http://dev.scriptics.com/" name="TCL">
<item><url url="http://www.perl.org/" name="Perl">
<item><url url="http://www.python.org/" name="Python">
<item><url url="http://www.php.net" name="PHP">
<item><url url="http://www.javasoft.com/" name="Java">
<item><url url="http://clisp.cons.org/~haible/packages-clisp.html"
name="clisp">
</itemize>
</p>
<sect>GUI Toolkits
<p>The standard graphical subsystem for UNIX and Linux, called X,
has its own libraries for GUI development. They provide a
low-level programming interface to X, but tend to be hard to
use. Old end-user applications and other toolkits of course make
good use of them. Nowadays the Linux GUI scene is dominated by
GTK+ and Qt, since two popular, complete user environments - GNOME
and KDE - are based on them.</p>
<!-- Explain concept? -->
<sect1>Concepts in the Table
<p>
<descrip>
<tag>Library</tag>
Common name or abbreviation of the toolkit.
<tag>Beginner</tag>
Whether the toolkit is suitable for a newbie programmer.
<tag>License</tag>
Different licenses for different GUI toolkits have practical
significance. GTK+, TK and GNUstep licenses allow you to develop both open
source and closed source applications without paying for a
license. Motif license requires payment, while the QT license
requires payment only if you write closed source programs.
<!-- refer to freedom as in free speech, check validity -->
<tag>Language</tag>
The language that is most often used with the toolkit.
<tag>Bindings</tag>
Other languages which can use the toolkit.
<tag>Examples</tag>
Applications that use the toolkit.
<tag>Comments</tag>
Additional information on the toolkit.
</descrip>
</p>
<sect1>Major GUI Toolkits
<!-- Change to the other format? Would be good since could include
more info on WINGS and the GNUstep project. -->
<p>
<table>
<tabular ca="llllll">Library|Beginner|License|Language|Bindings
|Examples|Comments@
TK|
Yes|
Free|
TCL|
Perl, Python, others|
make xconfig, TKDesk|
@
GTK+|
No|
Free (LGPL)|
C|
Perl, C++, Python, many others|
GNOME, Gimp|
Very popular@
QT|
No|
Free for open source|
C++|
Python, Perl, C, others?|
KDE|
Very popular@
Motif|
No|
Non-free|
C/C++|
Python, others?|
Netscape, Wordperfect|
<url url="http://www.lesstif.org/" name="Lesstif"> is
a free replacement@
GNUstep|
No|
Free (LGPL)|
Objective C|
Guile, Java?|
None widely known, but see the
<url url="http://www.gnustep.org/resources/apps.html"
name="application list">|
GNUstep is still under development@
</tabular>
</table>
</p>
<p></p>
<sect1>Links
<p>
<itemize>
<item><url url="http://dev.scriptics.com/" name="TK">
<item><url url="http://www.gtk.org/" name="GTK+">
<item><url url="http://www.troll.no/" name="QT">
<item><url url="http://www.metrolink.com/" name="Motif">
<item><url url="http://www.gnustep.org/" name="GNUstep">
</itemize>
</p>
</article>