Linked by David Adams on Mon 26th Jul 2010 00:57 UTC
General Development Today's commercial-grade programming languages - C++ and Java, in particular - are way too complex and not adequately suited for today's computing environments, Google distinguished engineer Rob Pike argued in a talk at the O'Reilly Open Source Conference. Pike made his case against such "industrial programming languages" during his keynote at the conference in Portland, Oregon.
Thread beginning with comment 434386
To read all comments associated with this story, please click here.
The line beteween prototyping and developing
by Elv13 on Mon 26th Jul 2010 02:05 UTC
Elv13
Member since:
2006-06-12

There two different way of coding: prototyping and developing. The first one require fast and easy languages, normally fault tolerant. The second require design, rules and vision. Those style should not be mixed. A prototype stay a prototype until it die. You can not convert one into a nice and future proof program, even if the code is cleaned and partially rewritten. Look at lua, it is widely used in the game industry and other prototyping heavy industries. It have a really nice syntax for handling NULL values:

local myVar = myObject:myFunction() or array["key"](arg) or array.key2(var) or 10

the first non null value will be used. You can declare a new "class" function by simply writing it and passing the object as the first argument. Then:

myObject:myNewFuntion(arg2,arg3)

will work! You can also define new object property on the fly and do almost everything "for now on" in your code. No formal definition or restriction. How nice! Is it? For a prototype, yes, for anything else, no. This result in spaghetti code and you lose the original "way of doing things" it soon become a mess of hacks. Solid and well designed syntaxes declaration, as painful as they are to write help a project survive the prototyping stage. You can then debug and maintain the code, it is not the case with all these lossy languages. Those who have to maintain (Visual) Basic {6,.NET} or PHP code know that very well.

Reply Score: 4

Gunderwo Member since:
2006-01-03

And what about Java is so necessary. I often find that type safety can be a hindrance causing me to have to write several pieces of similar code or code that is convoluted with extra syntax just to express objects that are obviously similar but don't fit in to an obvious object hierarchy. I often find myself overriding methods for several default values and or types which results in several methods calling other similar methods, in a dynamic language I often reduce half a dozen overridden methods into a single method that shows all the default values in one declaration. The reflection libraries and creating dynamic methods or inner classes in Java is plain ugly compared to languages like Python or Ruby. The rigidity of languages like Java has it's place and it can be useful in some scenarios. But there is a lot of places that it just becomes extra syntax that really doesn't make the code any clearer. In fact there are a lot of cases where you end up writing hundreds of lines of boiler plate code that becomes completely unnecessary when you remove the necessity of explicit typing, Templates (or Generics if you prefer) and method overriding create hundreds of lines of extra code.

Dynamic languages allow you to choose when the best time to use a feature is. If type safety is so important in a specific scenario you can type check. The fact is dynamic languages tend to let a designer have more freedom to chose the right path based on the scenario as opposed to taking the same route regardless of whether there is a better way. For the most part if I can do in 100 lines of code what takes 500 lines in another language the 100 lines of code is likely to be easier to follow and have less errors than the 500 lines.

There is nothing inherently wrong with dynamically typed languages. And the assertion that if you want to build real software you need Java or C++ has been proved incorrect time and time again.

Twitter is one of the fastest growing and highly utilized systems in the world right now, it's written in Ruby. Checkout Plone/Zope, a CMS written in Python that has been used in thousands of websites including some real heavyweight systems like Akamai, NOvell and Nokias web sites. Or maybe you could checkout Django which is used to develop several high traffic news sites. And Wordpress, RoR, Pylons/Turbogears, and probably dozens of other frameworks provide robust, well designed, tested systems that allow you to quickly and effectively build enterprise class software.

I'm not saying that in certain situations where performance is absolutely key or when integrating with some other software or company policy that Java, C++ or C# are better alternatives. But there is certainly a place for dynamic languages. They are not toys and just like Java if you follow good design and testing principles you will be able to construct an enterprise ready system with them. And sometimes, in fact more often than not, you can save time and have cleaner code when you can choose how to use the language you're using rather than have something like type safety imposed upon you as a developer.

A bad developer can shoot himself in the foot regardless of the language or the framework he/she is using. It may be that dynamic languages provide bigger guns that can be used to shoot off your whole foot more easily. But it all comes down to the developer/designer and their ability with the tools they have to use.

Reply Parent Score: 2

arbour42 Member since:
2005-07-06

Twitter is one of the fastest growing and highly utilized systems in the world right now, it's written in Ruby.

This is incorrect. Twitter was initially written in Rails, but the performance was dismal and it wouldn't scale; plus they basically had to implement an entire type checking system in the test suite.

So they switched the entire back end to Scala, the JVM-type-safe functional language. That saved them. You can read about it here:

http://www.artima.com/scalazine/articles/twitter_on_scala.html

a quote from this article:

Another thing we really like about Scala is static typing that’s not painful. Sometimes it would be really nice in Ruby to say things like, here’s an optional type annotation. This is the type we really expect to see here. And we find that really useful in Scala, to be able to specify the type information.

As our system has grown, a lot of the logic in our Ruby system sort of replicates a type system, either in our unit tests or as validations on models. I think it may just be a property of large systems in dynamic languages, that eventually you end up rewriting your own type system, and you sort of do it badly. You’re checking for null values all over the place. There’s lots of calls to Ruby’s kind_of? method, which asks, “Is this a kind of User object? Because that’s what we’re expecting. If we don’t get that, this is going to explode.” It is a shame to have to write all that when there is a solution that has existed in the world of programming languages for decades now.

Reply Parent Score: 2

Neolander Member since:
2010-03-08

I couldn't agree more. Some languages are excellent at prototyping (python, the basic family...), other are good at real software developement.

However, it's also true that since Pascal became out of fashion, computer science still lacks a language that's at the same time easy to learn and suitable for complex software development tasks.

Learning C is reasonably easy, sure, but it's not suitable for big software development (headers quickly become messy due to the lack of object orientation, and you don't reuse code as easily as in modern OO languages. And let's not talk about security and memory leaks).
Learning C++ is a pain. Really. Seriously, can a language so poorly designed that you have to manage the class1 = class1; case yourself still exist and be popular today ? And let's not consider the lack of array limit storage, function pointer syntax, the painful way dynamic memory allocation has to be managed when an exception occurs...
The little defects of C were acceptable for its times, but in C++'s core syntax (I'm not talking about the STL here) there's just too much failures which make it painful to understand and use.

I would like to see a real compiled OO language, in the Pascal Object and C++ tradition, that comes with C++'s popularity (and hence libraries) and with a much easier learning curve. It would make the compiler more complex, sure, but that's not an issue : the compiler is written once and runs once in a while, but when a language has a crappy syntax it's millions of future developers which suffer...

Edited 2010-07-28 14:13 UTC

Reply Parent Score: 2

Zifre Member since:
2009-10-04

The little defects of C were acceptable for its times, but in C++'s core syntax (I'm not talking about the STL here) there's just too much failures which make it painful to understand and use.

Many of the failures of C++ are caused by syntax. SPECS (http://www.csse.monash.edu.au/~damian/papers/HTML/ModestProposal.ht...) is a really nice redesign of the C++ syntax that fixes most of these problems.

I would like to see a real compiled OO language, in the Pascal Object and C++ tradition, that comes with C++'s popularity (and hence libraries) and with a much easier learning curve. It would make the compiler more complex, sure, but that's not an issue : the compiler is written once and runs once in a while, but when a language has a crappy syntax it's millions of future developers which suffer...

I have been waiting for a language like this. See my post below for a description (all the features exist in separate languages, I just want to combine them).

However, I think a compiler for a language like this would actually be a lot simpler. C++ is probably the hardest language to write a compiler for. The grammar is ambiguous and not LALR.

I'm actually working on a language like this. The grammar is actually really simple because it is LL(1), so it has been really easy to just write a recursive descent parser in C++ and not waste time fighting Bison or ANTLR. I have found that, by far, the hardest part of writing a compiler is dealing with forward references.

Reply Parent Score: 2