From miguel@nuclecu.unam.mx Received: (qmail 17364 invoked from network); 26 May 1999 00:43:36 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 26 May 1999 00:43:36 -0000 Received: from metropolis.nuclecu.unam.mx (miguel@metropolis.nuclecu.unam.mx [132.248.29.92]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id UAA12779 for <gnome-list@gnome.org>; Tue, 25 May 1999 20:01:45 -0400 Received: (from miguel@localhost) by metropolis.nuclecu.unam.mx (8.8.7/8.8.7) id NAA00698; Tue, 25 May 1999 13:01:32 -0500 Sender: miguel@nuclecu.unam.mx To: James Green <gnome@cyberstorm.demon.co.uk> Cc: gnome-list@gnome.org Subject: Language choices for the GNOME system MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii From: Miguel de Icaza <miguel@nuclecu.unam.mx> Date: 25 May 1999 13:01:32 -0500 In-Reply-To: James Green's message of "Wed, 19 May 1999 00:23:29 +0100 (BST)" Message-ID: <s81zg558qr.fsf@metropolis.nuclecu.unam.mx> Lines: 93 User-Agent: Gnus/5.070075 (Pterodactyl Gnus v0.75) XEmacs/20.4 (Emerald) [ This is about the debate of programming languages in gnome-list ] There are a number of reasons why the GNOME project chose the C programming language. The decision to use the language for our core and foundation libraries, is something that we decided for the specific task of writing GNOME. Some of the rationale, tradeoffs and reasons might or might not apply to other projects. * On code complexity People who contribute to Free Software projects (Open Source) are resources that might appear one day and vanish the next day. There is no way to ensure that somebody is going to stick around for any time. We want people to quickly understand the code: ie, make the learning curve smaller. If the code is simple enough, hackers can become productive quite quickly (ie, hacking new code, improving existing code, or fixing bugs in the code). So a big goal of GNOME is to keep software maintainable. And this is one of the major goals. Keeping software simple to understand is more important than having lots of features. Some of us have learned this the hard way. There are a number of ways of achieving this goal: * Write libraries to handle common tasks. * Split functionality in different components (CORBA or libraries) * Reuse code in libraries. * Avoid code obfuscators as much as possible. Thread programming is a common code obfuscator: the original author might know all the interactions of his code, and might know how to handle them, but to most newcomers to the code base, it is just a very obscure thing, and it forces people to understand the whole model before being able to modify, extend, fix the application *correctly*. C++ is a large language. We do not want to demand from people to understand fully the language before they can become productive in the GNOME environment. A common way of addressing this problem is asking people to stick to a subset of the language (for example what the Mozilla folks have done for their XP code). The problem is that then you should then understand C++ and on top of that remember which things you should use and which ones you should not use. Besides that people will tend to deviate "just a little" from the accepted subset of the code. Now, if you put together 100 hackers that just "deviate just a little" from your spec, after a few months you end up with a program that requires people to understand every single feature of the language to become productive. Now, I personally have problems with C++. It is a language that has evolved over time: there was no clear goal at the beginning, nor a clear goal during its development. What we have now is a mix of language features, many of them good features. But sadly, the language lacks some sort of "internal" consistency. This is purely from a taste-point-of-view. Contrary to what most people think, Ada95 is a much nicer, simpler and cleaner language than C++ is. And Ada95 has nice bindings for GTK (and I think GNOME as well). Now, from the binding point of view: C alone does not provide a good framework for writing language bindings. We have a document that explains how to make the API for our library code be simple to wrap for language binding people. * On Object Oriented Programming Object Oriented Programming is not a solution to every programming problem, it provides some nice abstractions for implementing code that follows *some* design patterns. Typically, OOP is useful within a complete framework, and this framework not necesarly spans the whole project. Code reusability is not very good: it is usually bound to the language in which the class/object is implemented. And exporting this mechanism to other languages is usually painful and hard to integrate well. That is why I am so excited about Bonobo-based component programming: because components can be reused and implemented in various languages and reused in far many more cases than any OOP class. Best wishes, Miguel. -- miguel@gnu.org
From mlepage@cgocable.net Received: (qmail 2463 invoked from network); 26 May 1999 02:04:40 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 26 May 1999 02:04:40 -0000 Received: from mail.cgocable.net (mail.cgocable.net [24.226.1.11]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id VAA03512 for <gnome-list@gnome.org>; Tue, 25 May 1999 21:22:47 -0400 Received: from segv.cgocable.net (cgowave-19-128.cgocable.net [24.226.19.128]) by mail.cgocable.net (8.9.3/8.9.3) with SMTP id VAA04254 for <gnome-list@gnome.org>; Tue, 25 May 1999 21:22:48 -0400 (EDT) Message-ID: <002101bea718$b1a53300$8013e218@cgocable.net> From: "SEGV" <mlepage@cgocable.net> To: <gnome-list@gnome.org> References: <s81zg558qr.fsf@metropolis.nuclecu.unam.mx> Subject: Re: Language choices for the GNOME system Date: Tue, 25 May 1999 21:40:11 -0400 Organization: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Just to pick up on two issues... ----- Original Message ----- > [ This is about the debate of programming languages in gnome-list ] > > We want people to quickly understand the code: ie, make the learning > curve smaller. If the code is simple enough, hackers can become > productive quite quickly (ie, hacking new code, improving existing > code, or fixing bugs in the code). Some would argue that is a reason to use a language such as C++, which provides stronger abstraction facilities, as compared to C. For example, in my game, I have abstracted away coordinate transforms. The average programmer would *not* be able to understand the advanced template tricks I used to do so. However, the client programmer doesn't have to. The type system in C++ takes care of it all behind the scenes, at compile time, just as if it were hand coded... but it's not. And it is enforced by the compiler, so it can't be forgotten. > Now, I personally have problems with C++. It is a language that > has evolved over time: there was no clear goal at the beginning, nor a > clear goal during its development. What we have now is a mix of > language features, many of them good features. But sadly, the > language lacks some sort of "internal" consistency. This is purely > from a taste-point-of-view. I believe you might change that opinion after reading "The Design and Evolution of C++" by Bjarne Stroustrup. It is a book that few who criticize C++ have read. C++ as a language has very clear goals, and they are not what might immediately come to mind. For example, "Did C++ succeed at what it was designed for? ... it succeeded by enabling reasonably educated and experienced programmers to write programs at a higher level of abstraction ('just like in Simula') without loss of efficiency compared to C. It allowed this for applications that were simultaneously demanding in time, space, inherent complexity, and constraints from the execution environment." p196 -- SEGV
From miguel@nuclecu.unam.mx Received: (qmail 15216 invoked from network); 26 May 1999 20:02:34 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 26 May 1999 20:02:34 -0000 Received: from metropolis.nuclecu.unam.mx (miguel@metropolis.nuclecu.unam.mx [132.248.29.92]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id PAA28466 for <gnome-list@gnome.org>; Wed, 26 May 1999 15:20:21 -0400 Received: (from miguel@localhost) by metropolis.nuclecu.unam.mx (8.8.7/8.8.7) id IAA26645; Wed, 26 May 1999 08:20:50 -0500 Sender: miguel@nuclecu.unam.mx To: "SEGV" <mlepage@cgocable.net> Cc: <gnome-list@gnome.org> Subject: Re: Language choices for the GNOME system References: <s81zg558qr.fsf@metropolis.nuclecu.unam.mx> <002101bea718$b1a53300$8013e218@cgocable.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii From: Miguel de Icaza <miguel@nuclecu.unam.mx> Date: 26 May 1999 08:20:50 -0500 In-Reply-To: "SEGV"'s message of "Tue, 25 May 1999 21:40:11 -0400" Message-ID: <s8yaic2ci5.fsf@metropolis.nuclecu.unam.mx> Lines: 19 User-Agent: Gnus/5.070075 (Pterodactyl Gnus v0.75) XEmacs/20.4 (Emerald) > I believe you might change that opinion after reading "The Design and > Evolution of C++" by Bjarne Stroustrup. It is a book that few who criticize > C++ have read. I have actually read this book. And it basically proved my point. Features in C++ are added "because people were requesting them", not because they were part of some "original" plan of the language. Just look at the various features in the language: they feel pretty much orthogonal to each other: templates have a completely different syntax to anything else on the language. The syntax is heavily overloaded with features. Miguel. -- miguel@gnu.org