PurpleJS – A JavaScript application framework running on the JVM
purplejs.io
purplejs.io
[1]: http://ringojs.org/
[2]: http://helma.org/
[3]: https://www.sitepen.com/blog/2010/01/19/commonjsjsgi-the-eme...
> It's an alternative to Node.js for Java projects. PurpleJS makes it easy to build performant and lightweight Javascript server applications without the complexity of Node.js asynchronous programming model.
Do you have any benchmarks that show what performance is like?
I don't think you can avoid "the complexity of ... asynchronous programming model". The world is async, and we should build better tools to interact with it, not cover our ears and pretend otherwise. They also mention isomorphic applications, but the browser is async, because everything is event driven! How are you expecting to avoid that? Even if allowed to do some things synchronous (e.g. data fetching), it'll cause your UI to freeze.
Both the browser and node use the `console` global for logging, but you've chosen to create a `log` object instead of following the existing convention. Even though I think `log` is a better identifier, I would've opted to maintain compatibility with existing ecosystems instead of doing my own thing.
This got me to look up some info on Nashorn and I landed an Oracle article [1]. They use a `with` statement in one of the examples. I don't think I've ever seen someone using `with` in the wild. It's generaly frowned upon, and justifiably so, IMO. I couldn't find any info on what version of JS they support.
Although full compatibility with node would be very challenging, I think you could get pretty far just by supporting CommonJS and the built-in modules.
[0] https://github.com/purplejs/purplejs/wiki
[1] http://www.oracle.com/technetwork/articles/java/jf14-nashorn...
I tinkered with the idea of using a library called Spark on Netty to make web services in JS, but this library (and others mentioned here) actually did the job :-)
https://docs.google.com/presentation/d/19KTud9_3I3MgJiYlVdF9...
For the little string mashing benchmark I put together (originally to compare sequential / fork / thread performance in various languages), Nashorn's (Java 8) JIT eventually catches up and passes Node. Alas, it's one of those "O(n) for large n" problems where n has to be around a million before this happens.
... And Perl still mops the floor up with all of them. (Perl is good at string handling, even if not so much at many other things)
While that may be true, most algorithms, recipes, procedures, and instructions are synchronous. So human beings are used to synchronous programming.
As soon as two parties are involved, instructions start making sense asynchronously. Try writing a recipe for baking a cake by two bakers, keeping both chefs occupied the entire time. You'll see that the instructions must be read asynchronously otherwise each baker would not be able to continue reading his/her instructions when a "thread" of operation for the other baker has been called out.
- Async: PurpleJS is a pure server-side framework. Thanks to the JVM it is capable of providing traditional multi-threaded approach to SSJS development which is both easier to understand and debug. The JVM helps you cope with the parallellism. I assume it should even be possible to add event driven capabilities to PurpleJS as well given that Java has a powerful event system.
Isomorphic: I see your point. However isomorphic scripts are naturally limited to anything that will successfully run on both server and client. For instance the DOM is just as little accessible to Node as it is to PurpleJS.
Apparently there is a new issue for 'console' in PurpleJS issues now - seems reasonable.
I don't mind new libraries but it doesn't even explain how it is different or interesting or if prefers async to sync (I think it is sync).
Hell you can even use Rhino Servlets like 15 years ago. The only thing that is new is Nashhorn but even that isn't that new. It is sad that Javascript is this sticky now.
Then we could run JavaScript on top of that!
I wonder if it is compatible with node js frameworks like express. I think that node has a lot of native code to implement various functions, so it would probably require a lot of work.
I guess it hit some roadblocks.
https://blogs.oracle.com/theaquarium/entry/project_avatar_up...
This thing that we programmers do is supposed to (I thought) reduce the complexity of writing code so we can focus on the problem. This takes it to a whole new level of "where the hell is the code that's actually doing what I want it to".
It may work great and be horribly useful. But having to dig thru 4 subdirs just to get to the code that actually does something ... that was a horrible experience.
> Combine the power of Java and your existing investments with the simplicity of JavaScript.
I would much rather use Clojurescript and Clojure to cover this technical area.