Slashdot Mirror


Google Ports Box2D Demo To Dart

mikejuk writes with an excerpt from an article at i-programmer about a neat graphics demo written in Dart: "One of the difficulties in getting a new computer language accepted by a wider audience is that there is doubt that it is real. Is it a toy language that just proves a concept or can it do real work? In the case of Dart, which is Google's replacement for JavaScript, the development is speeding ahead at a rate that is impressive but worrying. To prove that Dart is already a language that can be used, we now have a port of the well known 2D physics engine Box2D, the one Angry Birds uses, to Dart." Box2D has previously been ported to Javascript. Source is available at Google Code (under the Apache license). Note that you'll need Chromium to run the demos.

30 of 194 comments (clear)

  1. Not again! by TechGuys · · Score: 2, Insightful

    Note that you'll need Chromium to run the demos

    As a web developer and after all the nuisance old IE's gave me and other web developers back in the day, this is really what's stupid with Chromium and Google's approach. They're mimicking the old Microsoft here - make your own "standards" and break the web by making features and sites that only work Google's browser. I seriously thought we would had been past that and the old IE's were the last browsers that didn't adhere to standards. IE9 is now fully standards compliant, and what does Google do? Oh yes, break the web AGAIN.

    This isn't the only time they're introduced non-standards compliant features, either. Another example is NaCl, or Native Client, which tries to mimic Microsoft's ActiveX, and again, only works in Chrome. But with all the security headaches. It seems like Google is going out of it's way to copy all the stupid mistakes Microsoft made. I guess Google is at the same point now than Microsoft was back then - antitrust issues, breaking web standards and constant flow of news of how they're done wrong again. It's like Microsoft all again.

    1. Re:Not again! by bhagwad · · Score: 5, Insightful

      So how does a company create something better than the standards? Or are you perhaps implying that standards once set are the best for ever and ever? It's not as if Google is DROPPING support for Javascript. That would be...outrageously stupid. What exactly is your problem here?

    2. Re:Not again! by Anonymous Coward · · Score: 2, Informative

      I think you fundamentally misunderstand the purpose of Chrome/Chromium, and that misunderstanding is blinding you to the very obvious differences between what Google is doing with Chromium (NaCl, Dart, SPDY) and what Microsoft did with IE. If you start instead from the right premise, and realize that everything Google has done has been open-sourced, you start to get a better appreciation for what's really going on.

    3. Re:Not again! by Korin43 · · Score: 4, Insightful

      You do know how web standards work right? It goes something like this:

      1. A bunch of people come up with ideas that would be cool to have in browsers.
      2. Some of them add those things to browsers.
      3. After we figure out which approach works / is most acceptable to all browser makers, it becomes a standard.

      For some reason it's a common belief that it works the other way around (make standard -> implement standard), but anyone know hows anything about programming can tell you why setting everything in stone and then writing the software is a terrible idea.

    4. Re:Not again! by bhagwad · · Score: 5, Insightful

      1. Google isn't claiming that this is the new standard. If they did, they would just drop support for Javascript

      2. Insisting on a consensus before every new technological upgrade would be frustratingly slow and the whole process can be held back by one individual. That's not how technology improves.

    5. Re:Not again! by Intropy · · Score: 4, Insightful

      And when you submit your new idea to the standard committee the very first thing they will ask for is demonstration of existing practice. Standards committees do not design new features. They observe existing practices and extensions and adopt them, possibly with some modification. To get something standardized you must first make it, work out the kinks, show why it's helpful, and get people to use it in practice. Only then will a standards committee consider it for the next version.

    6. Re:Not again! by LordLimecat · · Score: 2

      Another example is NaCl, or Native Client, which tries to mimic Microsoft's ActiveX, and again

      And Mozilla's NPAPI plugins....

      But of course thats different, right?

    7. Re:Not again! by peppepz · · Score: 2, Interesting
      Well, they did extend Linux as Android, and then started claiming that Android was "Linux on the desktop".

      And then
      java: dalvik <=> j++
      javascript: dart <=> vbscript
      html: nacl <=> activex
      opengl: renderscript <=> directx

      Now I'm not claiming that Google is the same as Microsoft, I don't think this. But honestly, I still have some concerns.

  2. Some Discrepancies with Your Bitching by eldavojohn · · Score: 5, Informative

    They're mimicking the old Microsoft here - make your own "standards" and break the web by making features and sites that only work Google's browser.

    From Dart's wikipedia page:

    Google will offer a cross compiler that compiles Dart to ECMAScript 3 on the fly, for compatibility with non-Dart browsers.

    And, in fact, dartc already cross compiles Dart code to plain Javascript. Once it's integrated into browsers, use it or don't use it.

    It's like Microsoft all again.

    Right, that's a stretch. You conveniently cherry pick details here. For example, NaCl is released under a BSD license with source code readily available. Are you saying the same was true of ActiveX since it's launch?

    --
    My work here is dung.
    1. Re:Some Discrepancies with Your Bitching by bhagwad · · Score: 2

      There's no point to start learning and using something that will be dead soon.

      But your problem is already solved then. So what's the fuss over?

    2. Re:Some Discrepancies with Your Bitching by walterbyrd · · Score: 2

      But why would anyone start to use this? Google has a huge problem with quickly abandoning projects. They just throw something at wall and see if it sticks

      I have to agree with you on this point. Google does that all the time.

    3. Re:Some Discrepancies with Your Bitching by M.+Baranczak · · Score: 3, Informative

      Seems like they've worked on it since the last time you checked: http://www.dartlang.org/support/faq.html#hello-world-js-size

    4. Re:Some Discrepancies with Your Bitching by IamTheRealMike · · Score: 4, Insightful

      ActiveX was an "open" standard in the sense that Netscape could have implemented it if they wanted to ..... on Windows only. That's because the bulk of the APIs you needed to use to write an ActiveX control were just the regular Win32 APIs. Netscape had a policy of supporting not just Windows but all operating systems. That's why Microsoft made ActiveX - they saw weakness (other platforms gui frameworks kind of sucked at the time, so pandering to them restricted developers a lot), and they attempted to exploit it (by allowing developers to build better apps that were Windows only).

      Was ActiveX "evil"? Well, it was certainly platform specific. Making things like this NOT platform specific is a ton of work, NaCL uses techniques and technologies that didn't exist back then, and they had no incentives to do it. Whether it was wrong to do depends on your views on the importance of features vs platform independence.

      NaCL is different to ActiveX in some really important, fundamental ways. Firstly, the APIs it exposes to native code are really small: just Pepper, which provides you with the real basics along with some well accepted cross-platform APIs like OpenGL. Importantly there's no GUI toolkit. If you want buttons and sliders, you need to use HTML, not Win32/GTK/Cocoa. In fact NaCL will prevent you from accessing these APIs entirely!

      Secondly, it's got a strong focus on security. NaCL code has security properties that are provable using static analysis. It also runs in a sandbox for a second level of defence. This is very different to ActiveX, which relied entirely on Authenticode, and suffered some serious UI problems that made it vulnerable (modal dialog boxes).

      Thirdly, everything you need to implement NaCL is open source, so other browser makers can (and maybe will) adopt it. The core runtime and execution technologies are all open source, with the bulk of the integration work being joining Pepper to your browser. Mozilla already supports Pepper and I guess other browsers will too soon (maybe not IE). It really wasn't possible for Netscape to support ActiveX for all their users in the 90s, but it's quite feasible for Apple, Microsoft, MozCorp and Opera to support all their users with NaCL, especially now the dependency on x86 has been broken.

    5. Re:Some Discrepancies with Your Bitching by anonymov · · Score: 3, Informative

      Net result of any new extension is that users of the browser implementing it get a faster and better version. If it turns out to be a good idea other browsers follow and everyone ends with a net benefit.

      Canvas, for example, was Apple's extension in WebKit, year or two later other engines caught up to it too.

      XHR was created by MS for Outlook Web Access, with other browsers implementing it in a year or two after that, and W3C draft standard appearing only 5 or 6 years later.

      That's how innovation worked in browsers for a dozen years.

  3. Situation: there are n+1 competing standards ... by eldavojohn · · Score: 2, Funny

    The same problem that there would be with lots of people if Microsoft started suddenly introducing their own "standards" again. There's still some issues because of all that bs 10 years ago, but now it has almost gone away. There really isn't any need to broke the web again. And how to create something better? Work out a standard of it.

    What a great idea! I'll hop to it right now!

    Situation: there are n+1 competing standards.

    --
    My work here is dung.
  4. The JS port by LDoggg_ · · Score: 5, Informative

    The article mentions, box2d-js. The more current port is box2dweb: http://code.google.com/p/box2dweb/

    --

    "If they have both, tell them we use Linux. And if they have that, tell them the computers are down." -Dave Chapelle
  5. Other uses for Dart? by Skapare · · Score: 2

    Is this a programming language with an existing shell script interpreter style implementation, too? If so, then I might have actual use for it. Basically, that means a light-weight interpreter (light enough to use it during system boot up to run rc scripts, so not more bloated than bash in its basic form) could be named in the script like having "#!/bin/dart" on the first line, and it would execute the file however it is designed to run them. I'm not talking about using in a browser here. For extended features beyond shell script code, it should have modules (in binary .so files or in Dart) that it can load.

    I'm just starting to use Lua for this kind of thing now. Lua was intended as an embedded language, but has a shell script style interpreter which is pretty much a nice example of simple embedding. If they put Dart in a browser, and implemented it cleanly in the process, then a shell script embedding should be trivial. Have they done that?

    I'd be more impressed if they make Dart do all these kinds of things (including directly run in a web server) than by implementing Box2D in it. That would mean a clear separation of execution from environment, something that Javascript only partially succeeded doing. Something that Lua did succeed at, but I still want a C-like syntax class for.

    Oh, and I would definitely love to have a clean integer-only typing available, something I consider a major problem with Javascript.

    --
    now we need to go OSS in diesel cars
    1. Re:Other uses for Dart? by Anonymous Coward · · Score: 2, Interesting

      Yes, you can run it from the command line via the Dart VM without translating it to Javascript. Haven't tried #!/bin/dart style invocation though - but being open source someone is probably working towards it if it doesn't yet support it.

      I've used Dart a bit and it really is a great language - not so different that it takes ages to learn, but IMHO a big improvement on both Java and Javascript.

  6. Re:TechGuys is an MS Shill. by Anonymous Coward · · Score: 2, Funny

    Well, Google is the new Microsoft!

  7. Re:Micro$oft Shill by ILongForDarkness · · Score: 2, Insightful

    So pointing out that MS screwed up in the past and using concrete examples that another company is making the same mistake is somehow MS propaganda? MS did some crap (works, Vista, IE 7, patent crap threatening without stating exactly what is being infringed, etc), they did some good things (Win 95-8 (for it's day was really cool if not exactly that stable), Win 7, .Ne/VS I'd put in that list), but regardless saying someone other than MS is being stupid doesn't make you an MS shill.

  8. Re:Micro$oft Shill by Overly+Critical+Guy · · Score: 3, Insightful

    Just because people disagree with you doesn't mean you're right.

    Nobody ever claimed such.

    However, just because someone has reached a conclusion you don't like doesn't make them mentally deranged or a paid astroturfer. If you believe a position to be wrong, it's so much more persuasive to respond to the points one by one rather than shoo them off with personal attacks, which only serves to please those who already agreed with you.

    --
    "Sufferin' succotash."
  9. Is JavaScript really that nice?? by Wattos · · Score: 2

    Am I really the only one on Slashdot who dislikes JavaScript? Every time I have to work with JS, I feel like shooting myself in the head -> Little IDE support, no type safety, no compile phase... These things make it extremely hard to work on a large application base. In fact, at work we have a custom Java -> JavaScript compiler, which makes things a lot more manageable. Most of the bugs we get in our issue tracker are related to the web interface which is still written in plain JavaScript.

    I actually commend google on trying to fix this part of the web. I am not sure if this is the correct approach, but we have to start somewhere.

    1. Re:Is JavaScript really that nice?? by dingen · · Score: 2

      Most people working with Javascript don't really know the language that well. It's easy to get frustrated that way, because JS's C-like syntax makes you think it's a C-like language, which actually it isn't.

      There is a lot wrong with JS, nobody is denying that. But it also has its nice elements. And since every device on the planet is equipped with a browser running Javascript these days, the language really is here to stay. So instead of hating it, its a lot more constructive to try and understand it, so you can avoid JS's bad parts and make JS's good qualities work for you.

      I highly recommend Douglas Crockford's video lectures on Javascript if you have to work with JS and want to really get to know the language. It helps a lot to understand why JS is the way it is and how to get the most out of it without going insane.

      --
      Pretty good is actually pretty bad.
    2. Re:Is JavaScript really that nice?? by BZ · · Score: 3, Insightful

      Little IDE support is helped by building IDEs, not coming up with a new language that has even less IDE support.

      Dart doesn't do type safety by default. There have been proposals to add optional type annotations of the sort Dart _does_ have to JS... and they were shot down by certain members of the JS standards committee, last I checked. Don't recall what the stance of Google's representatives on it was, but they weren't the ones pushing it.

      As far as a compile phase goes, Dart doesn't have one either unless you're cross-compiling it to JavaScript. You just load your Dart code directly in the browser, which then compiles it. That's what browsers do with JS too.

      So ignoring for the moment whether these things are good or not, I don't see Dart making much of an improvement over JS here, except in the type-safety department, where Google didn't exactly try to improve JS in the first place.

    3. Re:Is JavaScript really that nice?? by foniksonik · · Score: 2

      JavaScript is really very simple to use.

      Build an object model from your data. Merge your model with your view. Bind your model, view and dat source with PubSub events. Controllers update the model, subscribed views then update to match and the data source gets an async update in the background.

      Was that hard or complicated?

      This is a known and solved architecture that can be applied to DOM views, Canvas views or SVG views.

      If you want to get fancy you can add support to filter, sort or mutate your data. You can add animations to visualize this or not. You can use the data to describe a form, a blog, a bitmap, a chart a tax return or a movie review. It's all pretty much the same.

      You can store your data in a DB and access it via REST or cgi or SOAP/WSDL or a socket connection. You can persist it with a cookie token session key or in client side storage or as OpenGraph meta key/values. It's all pretty much the same.

      None of the above is unique to JavaScript excepting the client side storage. Which ever language you use it's all pretty much the same stuff and JavaScript does it all just fine.

      --
      A fool throws a stone into a well and a thousand sages can not remove it.
  10. Care to explain? by afabbro · · Score: 2

    the development is speeding ahead at a rate that is impressive but worrying.

    Worrying because...?

    --
    Advice: on VPS providers
  11. Re:Micro$oft Shill by symbolset · · Score: 3

    Slashdot posts cannot be censored or filtered off the site. We don't do that here. They can't even be taken back by the author after you've pressed "submit" and believe me, I've put a few I'd like to have back. On the balance I prefer it this way, and well, as the post accepted page says, you should have thought of that before you pressed "submit".

    Shill posts detract. Pointing out shill posts detract. But there's nothing to be done. There are financial interests involved, and they will spam. There are folks who want to white-knight slashdot as a forum for Truth, and I'm guilty of that now and then even though I know that's not what it's for. As a wise someone once said (and I paraphrase), "the value of a free thing approaches zero over time". The moderation system works.

    Dart looks to be interesting tech. No doubt Google will look to make it an open standard that anyone can implement - even IE. And that will move us closer to the day that all apps are web apps, which cannot be anything but a good thing. It's time that the client architecture was unhooked from the application ecosystem at the network layer. In fact, it's at least 15 years past time for that. That was the goal of X Windows (not to be confused with the upstart), back in the day (onion, belt, lawn, etc).

    --
    Help stamp out iliturcy.
  12. Re:Micro$oft Shill by justforgetme · · Score: 2

    I don't understand what the big fuz is about. It's not like they wrote a AAA game engine in dart, it's just an over hyped physics approximator. The demos aren't even interactive (and one performs @5fps). For all you know (no, not really) the bytecode it loads is just a predefined animation. So what if they are trying to do it wrong? Let them go that way, as long as they don't break support for the standardized www framework, I have no problem with them wasting cycles.
    There are enough devs out there, with enough intellectual lucidness, that can see through the hype and understand that nacl and dart are non viable solutions. For everyone else, happy grinding fella. I'm not going to get involved with this.

    --
    -- no sig today
  13. Re:Google Shill by Anonymous Coward · · Score: 2, Funny

    Anonymous Coward is a known Google shill.

  14. Re:Micro$oft Shill by ILongForDarkness · · Score: 2

    I still don't see how the poster was promoting a specific company by pointing out there mistakes but okay I'll give you that new accounts going off pushing a particular idea might be astro-turfing. One could argue a lot of new accounts get away with pushing No-Company (TM) products though as in it is okay to go off on Richard Stallman like rants of craziness as long as you are pushing FOSS without being labelled an astro-turfer. Techies have their preferred tech and likely will post about what they care about. So I'd say with something this subtle give the guy/girl the benefit of the doubt.