Processing Visualization Language Ported To Javascript
Manfre writes "On his birthday, John Resig (creator of jQuery) has given a present to developers by releasing Processing.js. This is a Javascript port of the Processing Visualization Language and a first step towards Javascript being a rival to Flash for online graphics content. His blog post contains an excellent writeup with many demos."
I was a bit excited to read about a JS library that can potentially compete with Flash, but then I saw the writer is the same person behind JQuery. I'll still play around with it a little, but my hopes are somewhat tempered now.
This is some great work....
but this is like a polished-turd. Flash doesn't exist anymore to do animation or dynamic graphics, it exists to run fast. JS engines were not designed to process this kind of data efficiently, as seen by your CPU graph when running the demos.
I don't want to take away from the work, because it's a slick hack, but it's not the right tool for this job.
Regards,
Website Hosting
Second step, actually. Apple and the WHATWG took the first step by introducing the Canvas API to the HTML 5 spec. That gave web developers the ability to do Flash-like content. This language is the second step, in that it gives programmers a standard framework from which to create impressive animations.
Kudos to Mr. Resig on a job well done! I can't wait to play around with this project more.
Javascript + Nintendo DSi = DSiCade
First of all... you got second post. Second of all, TFA is about Javascript, not Java.
Other than that your post was completely relevant.
Spelling mistakes, grammatical errors, and stupid comments are intentional.
Flash itself uses a dialect of ECMAScript (the common parent language of Javascript and ActionScript). So your assertion that Javascript engines were not written to do this is flat out wrong.
All this shows is just how terrible most browser's Javascript engines really are. Notice, modern browsers do considerably better on these demos than older ones, mainly because so much of the web has shifted to using Javascript and dynamic content, such that JS becomes a limiting factor in usability. Once JS engines have caught up to ActionScript in speed, what more use do we have for Flash? We already have Mozilla working to make use of the Tamarin byte-code engine, which will turn JS from being a slow, interpreted language into being a byte-code compiled language (speed on the order of modern scripting languages such as Python/Ruby and to some extent Java/C#).
So sorry, Javascript is the right tool for the job. It's the only tool for the job as far as Open Standards are concerned.
The primary strength of Flash is its single vendor, rigorously portable, rigorously backwards compatible runtime. Javascript is far too fragmented to be a competitor to flash.
StoneCypher is Full of BS
Not true. It wasn't the first post either. Apart from those points, entirely relevant.
-1 not first post
Javascript being a rival to Flash for online graphics content
The article submitter has clearly never actually used the HTML canvas object. There's no way in HELL canvas & javascript together could ever approach the render and execution performance of Flash.
It is very handy to have though, apart, of course, from having to perform kludgery to get it working roughly in IE (by using excanvas.js to emulate the canvas object in VML).
Today's weirdness is tomorrow's reason why. -- Hunter S. Thompson
Regardless if this is usable today for client work, this is insane stuff. The first iteration of Flash eons ago had plenty of nay-sayers. He made this over the course of seven months? Bow down, I say. Very impressive.
Well muddled.
Nerd rage is the funniest rage.
I am sick and tired of people confusing Java and javascript. They are not the same language. They are not even related languages. javascript is crappy scripting language for use with HTML. It is run my the browser and aids in display time processing. Java is a full blown object oriented programming language which runs on the Java Virtual Machine. Sine the JVM handles interfacing with the operating system Java itself is mostly platform independent.
Even using bitmaps instead of vectors, the hardcoded C++ software rendering is the limiting factor above ECMA scripting performance. Theoretically, then, JS/Canvas could approximate the speed of Flash ... other than the fact that Flash has years of optimization on their side.
What really matters, however, is that this *IS* slow, and that it doesn't run *AT ALL* on 50+% browsers.
Jules: Whoa, whoa, whoa, whoa... stop right there. Javascript and Java ain't even the same fsckin' thing.
Vincent: It's not. It's the same ballpark.
Jules: Ain't no fsckin' ballpark neither. Now look, maybe your method of programming differs from mine, but, you know, writing a web page, and coding for the JVM, ain't the same fsckin' ballpark, it ain't the same league, it ain't even the same fsckin' sport. Look, Javascript don't mean shit.
Developers: We can use your help.
Don't get me wrong, I think its a cool toy I will be playing with, but until it actually works in more than one beta browser, its is no threat to Flash at all.
-Em
RelevantElephants: A Somatic WebComic...
Everybody's a libertarian 'till their neighbour's becomes a crack house.
You mean like say, FireFox AND Webkit?
The real Sig captains the Northwestern. This one captains
It looks to me like the big accomplishment here is that he parses processing language code and API calls and converts it to JavaScript that uses a canvas. It's pretty cool that it's possible to do that (similar to the Java -> JavaScript converter or the Ruby VM in JavaScript mentioned a few days ago), but the end product doesn't seem that useful to me, as the processing language isn't significantly better than JavaScript for this kind of thing, anyway. I'd be more interested if this guy had found a way to make processing perform better (translated to JS or otherwise), or if he came up with an entirely new language that made certain graphics really simple to express (certain fractal generators come to mind). Though it feels likely that proofs-of-concept such as this will inspire something really great in the near future.
Duct tape, XML, democracy: Not doing the job? Use more.
COBOL is still alive and kicking in the financial sector and it's fairly decent for what it's designed to do. i really wouldn't want to use it for general programming, but i wouldn't want to write a payroll app in C++ either.
upon the advice of my lawyer, i have no sig at this time
Except that Javascript is much more powerful than Java can ever hope to be. It's the environment thats crappy, not the language.
Seriously, you should at least *understand* the languages before you talk nonsense.
This sig does not contain any SCO code.
has the writer of that claim read chapters 8 and 9 from Flanagan's Javascript 5th ed.? It is a hopelessly messy language that is congenitally unable to do a decent job of OO implementations. Flex has classes in a more normal sense of the word. Sounds like hype. Does the newly offered code somehow bury the variable scoping sloppiness of JS?
SLASHDOT: news for people who can't concentrate on work or have no life at all and got tired of yelling back at the TV.
The author goes to describe a 'Spin' class. Then he defines a SpinArm that extends (concrete inheritance ) the Spin class. So we really have an 'Arm' that 'is-a' Spin. Oh really?
/., it's part of the reason we're still in the OO stone-age.
Then the SpinArm class contains its own function to display itself. Oh really?
This shows that the guy is clueless about what OO is all about.
This kind of stuff, that makes it frontpage on
OO analysis? Anyone?
Now of course I'm not surprised about the lack of good OO practice from anyone spewing random JavaScript or Java here and there: I'm not saying good OO is not possible in these languages, simply that 99.9% of the projects out there written in Java or JavaScript (or C#) are written by people that have no idea what OO is about.
If you're interested in good OO practices in Java, check out the Spring framework (used, amongst other, by Voca to process daily 100 millions of bank-to-bank transactions). Guys behind such frameworks know wtf they're doing.
The dude from TFA doesn't have the singlest clue about OOP, let alone OOD or OOA (he probably never heard these terms).
I'm pissed off by such article containing phrase such as: "this is an example of inheritance".
"This is an example of incompetence", that's all it is.
If you mod me Overrated, you are admitting that you have no penis.
Why is the distinction between objects that you can inherit from (classes) and ones you can't (instances) so important?
(sorry this is tangential to the topic)
:)
This summer my goal is to start working with Processing. I'm at home in C/C++/Lisp and I have a tiny bit of experience with openGL (probably safe to assume it's worthless though - I pretty much recycled other folks' shaders when I was working with it). Do any folks here have some advice, such as where they started when they began working with Processing? Thanks
I think the guy who did this deserves more credit than you give him, if only because re-implementing all the processing functions and parsing the language is a relatively large undertaking for anyone who doesn't have mountains of free time on their hands, and the fact that it works at all is good sign that this guy isn't completely incompetent.
All that said, I agree that a 'SpinArm' extending a 'Spin' isn't the best example of inheritance. I also realize that seemingly small things like this can be very frustrating to read for people who are well-versed in the subject. But it was my understanding that he threw out that 'this is an example of inheritance' line just to show processing syntax (and assuming the reader already knows what inheritance is and that that's not a very good example of its use), and I'm guessing that most of his code is more sensible - if his entire project was written that sloppily it doesn't seem likely that he would have gotten as far with it as he did.
Duct tape, XML, democracy: Not doing the job? Use more.
Which was part of the design criteria for COBOL. It was so that "low level" (PFC) military "grunts" could write code that would work.
Wasn't SVG (with Javascript) supposed to be the Flash killer? We use it a lot in SCADA systems, and it works great.
Just ported our system to Firefox' native SVG as Adobe's plugin reached its end-of-life.
-- The Internet is a too slow way of doing things, you'd never do without it.
Javascript is a full blown power-users' language
It gets a bad rap because poor developers will use that power to write powerfully terrible code, and "smart" developers will typically use that power to write clever but unmaintainable code.
I don't know where you learned to program, but you have a VERY warped view of programming languages. Javascript is not a power-users' language by any means. Furthermore comparing it to Lisp is an insult to Lisp, the programmers who use Lisp, and any machine that Lisp has ever been run on. Javascript sucks donkey.
Vincent: It's not. It's the same ballpark.
Jules: Ain't no fsckin' ballpark neither. Now look, maybe your method of programming differs from mine, but, you know, writing a web page, and coding for the JVM, ain't the same fsckin' ballpark, it ain't the same league, it ain't even the same fsckin' sport. Look, Javascript don't mean shit. I _have_ seen someone thrown out the window for coding in Java.
It is dangerous to be right when the government is wrong.
You nowhere near describing a stackbased cpu with the java language, it's not low level, ok? if you ever done low lewel you know what I mean
if (!signature) { throw std::runtime_error("No sig!"); }
As a COBOL programmer, your comparison offends me.
"Lisp with syntax problems" ???
Man, there's a whole raft of jokes just waiting to come out of that statement.
But I'll refrain -- I don't want to offend anyone with a thpeech impedimenth.
(Spudley Strikes Again!)
You mean like say, FireFox AND Webkit?
No, if you have bothered to read TFA, only beta of firefox 3 is fully supported and nothing else. Webkit is a little more supported than anything mainstream, but latest nightly Webkit (not even a beta!!) can do image handling, but not pixel or text processing.-Em
RelevantElephants: A Somatic WebComic...
Recursive, functional programming can indeed warp your mind if you are referring to that???
Meme of the day: I browse "Disable Sigs: Checked". So should you.
That's funny.
Maybe you should actually look up the very history of Javascript -- the programmer wanted an embedded LISP. Some PHB-type wanted it to look like C, so it would be more approachable. So he took his embedded LISP and gave it a C-like syntax.
Or maybe you should've Googled about Lisp and Javascript. Here, go read.
Don't thank God, thank a doctor!
"dreading js 2"
quite so. The more lovable and perfect it is, the more disruptive it will be to a staggering volume of interactive bits that legions of coders have tucked into all the pages on the internets. We paid a VERY high price for "run everywhere".
SLASHDOT: news for people who can't concentrate on work or have no life at all and got tired of yelling back at the TV.
So what? Java is still a highly abstracted language hence why it is not a low-level language by any definition other than some bizarre one you've created.
What bullshit. A good programmer's ability to produce good code is directly proportional to the language's ability to free him from tedium.
If you mod me Overrated, you are admitting that you have no penis.
GOTO is the most powerful of them all.
If you're just looking for animation in javascript, some much more impressive examples are in the CAKE (Canvas Animation Kit Experiment).
What makes Resig's work interesting to me is his port of the Processing lauguage, so the existing Processing examples can be run without Java. I haven't looked at the processing.js source, but I imagine it would run somewhat faster if you used his API directly, instead of parsing Processing code.
I wish some of this (minus the vector stuff of course) could be ported to plain old DHTML+CSS. Flying pink 1995 unicorns FTW!
captcha: canvas - oh well
I think what's going on with some of the "discussions" in the comments is that some people are confusing JavaScript as an interpreted language with JavaScript manipulating the HTML DOM of a web page. These are very different things! Resig is not trying to suggest that DOM effects could replace Flash rendering! He is using JavaScript around Canvas, a component that renders just as well as Flash. The difference is that Resig's solution does not require the addition of an extra scripting language interpreter (Flash's) over the one already existent in all major browsers.
It seems like he invented a new language instead of merely an API. If so, why? Let JavaScript be JavaScript so that you don't have to waste CPU to translate. If you want Java, then do it in Java for pete's sake. Language zealots can be annoying.
Table-ized A.I.
Now since the thread seems to be drifting into a flash vs javascript (ajax will be along later) flamewar, here's my 2 cents. When java started to get known, one of the touted uses was for rich and complex interfaces - the web page runs an applet that can have all nice shiny things on it - exactly what flash seems to be moving towards with flex and suchlike. I was busy doing other stuff at the time, anybody tell me how that happened?
Confucius say, "Find worm in apple - bad. Find half a worm - worse."
Are you serious? As a software engineer who works with Flash and Flex daily, I've worked exclusively with Flash Player 9 and ActionScript 3 for over two years. Almost anyone who calls him or herself a Flash developer will say the same. I might have let your argument slide a year ago, but with Flash Player 9 installed on well over 90% of web-connected computers, it's silly not to use AS3. Anyone still working with AS2 and Flash 8 is probably a designer building simple "experience sites" or advertisements who knows a little about coding or a developer who doesn't know any better (or is a masochist).
It's scary being a Flash and Flex developer on Slashdot. You guys are unnaturally rabid.
You lose anyway.
College-Pages.com - Online Colleges, Degrees, and Programs
Finding one might be hard these days, but COBOL coding jobs pay very nicely. When I was looking at graduate software engineering jobs, COBOL starting salaries were at least 25% higher than C#/Java.
When Canvas first came out for Safari I knocked up a quick 3d rendering engine to rotate cubes and that sort of stuff. It was incredibly slow. One cube, fine, but when I moved up to 20 or 30 the whole thing ground to a halt.
As it stands, Canvas is not suitable for animations containing more than about 20 faces, not if you want more than about 10f/s
Sure it does- "little or no abstraction from your computer's microprocessor" is what doesn't describe Java. It compiles directly to bytecode for a goofy virtualized processor which is an abstraction around your actual CPU and its instruction set and register set. Bytecode is higher level than machine code because it leaves a lot of work to be done on the side like parsing class files, resolving constants, navigating inheritance trees, etc. Instructions that manipulate the stack or the virtual storage registers are trivially mapped to lower levels, but instructions like invokevirtual require native library routines for correct handling of Java objects in OO hierarchies. So there is a little abstraction. Although in theory a processor could be built to execute Java bytecode directly if there was a demand for such a thing in a market saturated with emulators.
He was pretty cool and doesn't afraid of anything. I'm going to update my sig now.
Me lost me cookie at the disco.