Home » Uncategorized » Dissent on Gnome’s Javascript decision

Dissent on Gnome’s Javascript decision

Yesterday I read a blog post / announcement about how Gnome is moving to Javascript and I wanted to write some feedback.

It is great that they are trying to use a garbage-collected language for as much code as possible. For a component-based shell UI, Javascript is surely better than C, C++, or Java. I realize they started down this road towards Javascript years ago, but I think it is worth re-considering whether they are on the right path.

With big decisions, it is nice to have a paper trail. I can find no supporting documentation backing up the decision other than one blog post written after the fact, which doesn’t give very much information.

It appears the decision was made in a meeting. It is great to have meetings to discuss things, and it is great to make decisions in meetings, but oftentimes the best results are about moving the decision-making process forward, not actually committing to big things. Even if there were many in that room, there are surely facts they didn’t have, and other interested parties who were not there. There is the risk of “tyranny” by a self-selected cabal. Hopefully the decision wasn’t made at a bar 😉

I believe the best choice for Gnome is Python, not because the language is necessarily a lot better than Javascript, but because it is already close to the standard scripting language of the Linux desktop. My Mint-Debian repository has 1809 Python packages, and only 301 for Javascript. (Vala has 68.) Was data like this taken into account during the decision-making process? Without a paper trail, there is no way to validate the analysis or circulate it for feedback. There are many reasons to use Python, but the most important is that it is already so popular on the free desktop. The best reason to use Javascript is if you plan on running inside a web browser. Anyone writing code for the Linux desktop and not constrained to a web browser can do better.

To be clear, some of the reasoning is explained. Here are my responses:

1. Our language of choice needs to be dynamic and high level.

Python and many languages fit that description.

Next, it says:

2. There is already momentum in the GNOME Project for JavaScript — it’s used in GNOME Shell and GNOME Documents.

Unfortunately, that is not really much of a reason. In fact, it could be perpetuating a bad plan with this logic.

Next:

3. There’s a lot of work going into the language to make it especially fast, embeddable, and framework-agnostic.

Every language works to make itself fast. There are lots of efforts to make Python fast such as Cython and PyPy, and as many Gnome libraries will remain in C, this is hardly an issue even with the standard CPython implementation.

I’m not sure what the benefit of being embeddable is for a desktop UI. And Python is embeddable as well, inside apps like LibreOffice. I don’t undertand what the benefit of being framework-agnostic is. Every language needs libraries, and a rich set of libraries is a good thing.

4. JavaScript is increasingly being seen as a first class desktop programming language — it us being used in Windows 8, mobile platforms, and for local web applications.

Aren’t Windows 8, mobile, and local web applications supposed to be a worse experience than a Linux desktop? I imagine living exclusively in any of those platforms and shudder at the thought. They also aren’t planning on sharing code with any of those groups. Please don’t try to convince people the Gnome future is bright by using those three examples!

There is another post by John (J5) Palmieri who appears to be a fan of Python but who nevertheless endorses Javascript for Gnome. In it, he says that Python has a lot of baggage. Unfortunately, he doesn’t describe or link to a document describing what he’s talking about. In addition, it is important to weigh the good (the existing libraries and free software programmers) against the baggage. Every language has some baggage. For example, there is a book called Javascript: The Good Parts, which says something about Javascript’s. Furthermore, Python is setup to evolve and periodically break backward compatibility via things like the Python 2.x / 3.x branches. Can Javascript ever remove its cruft?

My day job is trying to finish a movie (trailer) endorsing Python as part of math literacy. Changing how math is taught to children could take a generation. But if Gnome get going now, they will be ready, and hopefully also be better than Gnome 2.x by then 😉 (I’m stuck in MATE. I believe the decision to remove Gnome 2.x is as good an idea as LibreOffice removing DOC import. This decision can be revisited also, but given how long ago it was made, I’m sure people are tired of the topic, so I will end here.)

Update: Some suggest that Javascript is more popular than Python as being a reason. Google trends show that Javascript popularity is dropping dramatically and the two are close today. Furthermore, most of those people are building random websites, not writing code that ships in Debian. And as pointed out in the comments, a recent TIOBE survey shows Python as more popular than Javascript. Python is also replacing Java in introductory CS classes.


25 Comments

  1. Baggage: The python standart library. It is huge on python, I think this is baggage as well. node.js for example doesn’t include zip or unrar functionality by default, python does … and many more libraries which should be subject to dynamic package based development.

  2. The best language for GNOME is Perl because Perl was designed for system administration from its beginning. Why would you want a hammer to drive screws? Use the correct tool for the job.

    And Perl has CPAN, the world largest library of free software. For any task you want to do, someone else has already done, tested it, and placed it in CPAN.

  3. Perl == Practical Extraction and Reporting Language

    Perl == Pathologically Eclectic Rubbish Lister

    Larry Wall says both are correct. 😉

    Perl is a MUCH better choice for system administration than Javascript. I have used perl in the past on a variety of occasions when I was a sysadmin in a previous life. CPAN is a remarkable repository.

    PyPi doesn’t have quite the breadth, but to some degree it’s not necessary when the Python standard library is so good. (No, I don’t regard it as ‘baggage. At all. Quite the opposite in fact.)

    Python, has become my go-to language of choice for all the reasons that Eric Raymond cited back in 2000. It’s easier to write new projects in, and it’s much, MUCH easier to maintain over the long haul. That’s critical.

    There’s another data source that should be considered when looking to make such a drastic change. TIOBE’s language tracking shows that Perl has been losing ground against a range of other dynamic languages for about 8 years. By contrast, Python has seen quite a bit of growth over the same period. In fact, the only dynamic language above Python on TIOBE’s chart is PHP, which I think we can both agree would be a lousy choice for sysadmin tasks.

  4. There are many different and bizarre thing you can make with duck tape. You can make shoes, or pants, or fix your car or make a cannon. Duck tape is flexible, popular easy to use etc. JavaScript is a duck tape of programming languages: fast, sticky, dirty and good for temporary jobs. Is it really good for serious things? Personally I would also prefer Python instead.

  5. I use both languages daily and I can confirm that Python continues to be a much better alternative than javascript for daily use in many scenarios. I think the perfect convination is a micro python (twisted) server for complex non-graphical parts and javascript for the GUI. And if we want GNOME to be something else than a light browser client we need those complex parts. Javascript is not yet ready for full program development because it has language design mistakes like the “changing this pointer”, the lack on namespaces, module handling or C binding for complex task (Python not only already have C bindings, but also OpenCL ones).

  6. this maybe a big jump –
    but could this coincide with current Microsoft Office-on-linux rumors?
    maybe gnome are in with them and they are doing this so that, MS-office will work… it could have been a condition put my MS in order to make gnome compatible with ms-office as opposed the vice.

    who knows,

    something smells fishy to me..

  7. There is a small flaw in your Google trends comparison. Most of the hits refer to ‘Monty Python’. If you restrict the search to the computer-domain, the number of hits drops 50%. The drop in Js though seems to be real.

    • I didn’t notice they had added ways to restrict search to various domains till you pointed it out. I played around with it a bit. In some domains, Python has more traffic! In any case, I’ve now updated the link to a better graph under the domain of software. Thanks.

  8. Despite many great advantages Linux have, unfortunately (also for me as I am using Linux in my work, home and mobile), Windows7/Windows8 UI stability, UI design and UI performance is far better than any desktop environment available in Linux I tried so achieving at least similar experience is great (but unrealistic at this moment) goal.

    In company we used python for several projects but at the end we think this was a mistake for most of them. If you are unsure what am I talking about, try to take a complicated/larger project and debug it without any help. Weak typing is so hard to follow.. I would say, without domain knowledge I can read java/c/c++ twice as fast as python code (and I know python).

    • I don’t believe it is any harder to read code with weak typing. It is impossible to read code without domain knowledge.

      You might be unhappy with Python in your projects, but I think that is analogous to a failed writer blaming the English language rather than himself 😉

      • To be honest, I like python but for smaller projects and some server side stuff. Your analogy is missed. If your are debugging code with many python modules distributed by PyPi I can assure you, you will get lost at some point. You need to consider that our world is not full of perfect software engineers and somebody&somewhere will mess a few of these modules you will have to work with. When I see opinion of people that python is good for complicated projects at this moment I know these people have never seen python in complicated projects at all. By the way, this is not even only my opinion by most of people in the team based of a few different projects. And when you need to describe everything deeply in javadocs, why not use language with harder typing in the first place? On the other hand, I’m also not for JavaScript option. The good way in my opinion was Qt in KDE but they failed when they started paying more attention to visual effects than stability and performace. C++ + Qt is really fun and can be really fast. It is even not comparable with python or javascript.

        And one more thing, in the past I could fix a lot of c++ and java related easier runtime bugs without really deep domain knowledge by doing pretty small investigation and proper debugging but usually it was harder with python.

        Sometimes you just get someones code to debug and/or maintain as in the IT rotation is pretty high. In such case, at the beginning you just want to focus on the problem in the smallest area possible, not starting from investigation of the full product stack. Business critical means time pressure;)

        • C++ is a bad language: http://yosefk.com/c++fqa/defective.html

          Software is complicated, in Python, and every other language. Ever tried to understand a million lines of code? A printout of it would be 4 feet tall. The reason why you found easier to jump into a new codebase and fix C++ bugs than Python bugs is because most of the types of problems you found can’t happen in Python. The bugs that exist in Python will therefore be more complicated.

          I remain convinced that anyone who thinks Python fails for large projects is wrongly blaming the language when it was the programmers who were at fault. Anyway, I don’t expect to convince everyone of this here.

          In any case, this discussion is about Javascript versus Python. I don’t see any reason why Python would be worse for Gnome.

          • I won’t even bother to talk about http://yosefk.com/c++fqa/defective.html because most of it is nonsense. One thing is true regarding this article, the language was just too complicated for author of this article:) “The reason why you found easier to jump into a new codebase and fix C++ bugs than Python bugs is because most of the types of problems you found can’t happen in Python” – again, wrong.

            Now, regarding Javascript vs Python – both solutions are not suitable for desktop, slow and not comparable with Windows experience (at least till Windows7, we will see what Windows8 brings). In a matter of this decision I would choose Javascript because:
            -Microsoft went this road and Microsoft has still far more better UI experience than linux even with Qt
            -was used so far in gnome so why bother changing wrong solution to wrong solution.

          • It is pretty hard to critique something in a detailed way without understanding it. How can you point out problems if you don’t see them? I can dig up other criticisms of C++ as well.

            Microsoft used Javascript because it is compatible with the web and they don’t use Python. Recommending Javascript because Microsoft does is following without thinking which is especially bad because Python is better.

            Python is not slow if well-written. That is another common fallacy. Mercurial is about as fast as Git. Sage is about as fast as Mathematica: http://www.sagemath.org/tour-benchmarks.html

            The key is to just write the few bits of high-performance code in C or Cython.

          • I’m still debating if it was we or Python that failed while I was cutting and pasting code while refactoring. At some point after jumping back and forth between files I couldn’t remember what indentation a line of code needed.

            Never had that problem in C/C++, Ruby, or JS.

  9. One think is what we think about the best language,and the other what is the most used by the community. If we see into gnome.git we can see that the most used is c, after, vala, c++, after python and last javascript and others like c#. Vala is fast and uses all the librarys from c. Vala is cool, and it will be the language choiced by gnome, only give time.

    :->

  10. One problem with Python is that it can’t be cross-compiled. That alone will keep me from depending on Python.

Leave a Reply to Stefan Cancel reply

Your email address will not be published. Required fields are marked *