Differences between Apache Deft, Webbit and Vert.x [closed] - node.js

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I see a lot of potential of doing Node.JS-like development on the JVM, with its heavily optimized runtime.
At this moment in time, I see three projects that aim to bring a node.js-like style of development to the JVM:
Apache Deft
Webbit
Vert.x (formerly Node.x)
Should these projects team up?
What are their relative strengths and weaknesses?
Which project has the most momentum?

Disclosure - I'm the vert.x guy :)
Vert.x is a fully fledged platform for building polyglot, scalable, asynchronous web-enabled applications.
It is heavily inspired from node.js but goes further than node.js and provides a distributed event bus which reaches from the server right into client side JavaScript thus creating a super simple model for so-called "real-time' web applications. We also ship with a mailer and a mongodb persistor. There's a full tutorial here http://vertx.io/tutorials.html
But the probably the main thing that sets it apart from other async frameworks is it's polyglot nature. The same (or similar) API is available in Java, Ruby, JavaScript and Groovy (with Clojure, Python and Scala support to follow).
Vert.x really takes advantage of true multi-threading on the JVM to provide scalability and performance than node.js cannot touch.
If you don't want the whole platform. Vert.x can also be used as a library for providing HTTP, TCP, websockets, sockjs, eventbus, etc support in your Java or Groovy application.
For more info pls see the website http://vertx.io

Disclaimer: I'm the Webbit guy
There is definitely a lot of overlap between the 3 projects. When I built Webbit I was not aware of the other two - had I been, it may well not exist, or I may have spent my time contributing to the others.
I can talk a bit about Webbit...
It is not a multi-purpose evented IO framework. Or network protocol toolkit. Or filesystem abstraction. Webbit only does a small fraction of what the others do.
Webbit is also not a full-featured web-framework. Like Node.JS or the Servlet API, it provides the core building blocks for building higher level frameworks, but leaves this to external projects (like Webbit-EasyRemote or Webbit-REST).
What Webbit focuses on is being a simple, embeddable, non-blocking, HTTP and WebSocket server.
Because it takes the 'do one thing and do it well' approach, it has also been designed to be used in conjunction with other libraries. It allows external java.util.concurrent.Executors to be passed in and avoids singleton thread contexts, making it particularly well suited for integrating with Actor style concurrency libraries such as Jetlang and HeySync.
Vert.x and Deft bring complete frameworks for out-of-the-box Node style development. Webbit is just a small tool that can help HTTP/WebSocket enabled your application. There is a need for both of these and it really depends on your needs (and personal style) as to which is more appropriate.

Disclaimer: I'm an Apache Deft committer.
Apache Deft has more in common with tornado and twisted than to node.js, whereas vert.x is heavily influenced by node.js. Tim Fox from wmware is doing a great job with vert.x and the development speed is really impressive.
vert.x has a couple of examples available.
Some Apache Deft examples.
Apache Deft also has a bigger "demo application" that should give you an idea of how you could use the framework for other things than http.
AFAIK webbit is currently aiming to be a "WebSocket and HTTP server".
If they should team up? Absolutely :)

Related

javascript with webdriverjs or java with selenium-webdriver? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
Our team is planning to develop a framework to automate manual test cases. But we are stuck in choosing between javascript and java. With a bit of search, we found that Webdriverjs is the selenium bindings for javascript. Now, the main hurdle is whether we should go for javascript with webdriverjs or java with selenium-webdrier?
We already know java with selenium-webdriver but and as we are moving ahead for a new framework we just want to open easy, fast and more reliable option.
Please suggest javascript with webdriverjs(we need to learn javascript for this) or java with selenium-webdriver?
We ran into the same challenge that you are seeing now.
There are a lot of selenium engineers on the Java stack but not much on the Node.js and selenium-webdriver stack.
Most newer modern testing frameworks are done in Node.js since both the front-end and back-end are done using NodeJS and will continue this trend. The question that I would ask is whether the development team is using Java (e.g. Tomcat) or are they using Node.js to develop their product. If they are using Node.js then it would be ideal to have the test framework written in the same language as well.
This is to facilitate
Collaboration between development and automation team, locators and etc..
Lessen the friction for developers to write selenium tests
There is a very good presentation on this by Marcel Erz at one of our South Bay Selenium meetups. I highly recommend you to go through it before making a decision.
Java vs. JavaScript (for UI testing)
Most tests written by Front-end Engineers
Unfamiliarity with Java and its eco-system
Context switching
Less likely to embrace testing
http://www.marcelerz.com/blog/talk-nodejs-based-selenium-testing-south-bay-selenium-meetup
Now if you are set on using Javascript the main challenge is of-course async-ness. Most automation engineers are used to sync patterns in Python and Java. It will take some time to get used to the async behavior of javascript. But the end result is worth it.
Our framework is mainly written in Node.js and we use Mocha as our harness and test runner. The recommended assertion library is Chai but you can use others if you need specific needs.
Our selenium library of choice is WebDriverJs (case sensitive) aka selenium-webdriver on npm which is the official JavaScript port. One of the main reasons that we went with selenium-webdriver is code readability and the ability to achieve sync-like syntax out of the box to keep Java test engineers in mind. This is achievable by leveraging the built-in Promise Manager control flows and Mocha Test Wrapper that automatically handles all the calls into the promise manager which makes the code very sync like.
https://code.google.com/p/selenium/wiki/WebDriverJs#Writing_Tests
Then it's a question of adding in your own framework and building the page objects. Page Objects in Javascript is a whole new beast you will have to get a good grasp of Prototypes and how you can emulate Java's inheritance.
You should also use selenium-standalone in npm as your only communication point to selenium for both local and remote execution instead of creating Driver instances (local/remote) in the test. This is so that the framework has the same interface and make things consistent. You don't want to keep track of multiple local driver executables and updating them. One package takes care of everything.
If you have read until here and you are pretty much certain that you will go with the Node.js route instead of Java. Below is a very simplified version of our framework that can help you get started. It has all of the implementations that was described above. Also any pull request is welcomed!
https://github.com/mekdev/mocha-selenium-pageobject
I'd personally choose selenium-webdriver package and instantiate the different drivers as needed. You're then not locked into just js driver.
Our team utilizes the selenium remote / grid for parallelization but in many instances we need a js driver.
Example in its:
WebDriver wd = new WebDriver()
RemoteWebDriver rwd = new RemoteWebDriver()
ChromeDriver cd = new ChromeDriver() // for chrome browser
JavaScriptDriver jsd = .....

How to decide which framework to use for node? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
So we've been using node for quite a while now and I must say, with the growing community for node, people are developing lots of awesome modules and frameworks too. But as we are working on more and more projects, I get confused sometimes as to which framework to go for. So far we've used following frameworks:
Express - One of my favorite frameworks for node and this was the first too when we started making apps in node.js.(I think this also was the first to gain so much popularity). We do have issues like callback hells but provided that the routing and the code organization is much more cleaner, we were pleased to use it.
KoaJS - Another one from the TJ and team, and this is just awesome! Using ECS 6 when any of the browsers hardly support them. (Specially when it helps you remove the callback hells completely). We had some issues with https compliance with Koa and had to re-write the entire server using hapi and also the fact that it depends on the unstable version on node for now.
Hapi - This is our most recent adoption and haven't done much with it, but the most fun part of this is the joi module that helps us validate requests(easily) even before they hit the actual server and also the automated docs generation.
Synth - I haven't interacted much with it, but while reading the docs, I came across
Use services and dependency injection just like AngularJS but on the
back-end!
which is awesome, but since it's in beta still, I'm not thinking of using it anytime soon.
So when trying to go for a framework for your app, Is there any specific set of features that one framework is good at and the others don't? Because honestly, we adopted most of the frameworks just with the intent of trying them out and apart from syntax differences (except Koa that uses ECS 6) and how they handle routes, I couldn't find much differences among them.
So my question is should we adopt any framework just by looking at it's popularity(which is what people generally do) or there is some checkpoints we need to consider while doing the same?
Any suggestions/help appreciated.
Edit
I wanted to add on that my intention for this question is to find out the key points to consider while opting for any of the node.js framework (rather than just depending on it's popularity or how many big names are using it). For the front-end we can easily tell because we already know or have been told the key features that would help development easier(the diff between angular & backbone can be an example) But for the node.js frameworks that isn't any way.
I would request others to consider my edits too.
I'll try and keep this answer as non-opinionated as possible. Please edit and help me improve this. This is a important topic and should get a good answer.
Express.js
Pros
Express.js is the big guy, fairly old and incredibly popular.
Easy to use views
Very Lightweight
Cons
No fancy features
Koa.js
Pros
Lightweight
Koa is the maybe successor to Express
No callback hell, thanks to ES6 generators
Built by the same guy as Express
Cons
Fairly new, not super refined
Uses ECMAScript 6 features, meaning you need Node.js v0.11 (unstable)
Hapi
Pros
Many official modules, but not a ton of third-party ones
Developed by a large corporation that uses it for their own products
Cons
Built by Walmart
Different syntax for specifying routes than Koa or Express.
Itself and all the official modules have weird names
Synth
The first back-end framework specially designed for single-page web applications.
Pros
Designed for being the backend single-page websites, ala Angular.js
API First
Dependency Injection, familiar to those coming from Java
Designed to do a ton of the backend things, allowing you to work on the frontend
Cons
Dependency Injection, disliked by quite a lot of people because Java is the only reason it exists
Very new, currently in beta
Doesn't work well with more traditional websites
More Resources
TechEmpower Framework Benchmarks (limit to Node.js) Benchmarks of lots of web frameworks, currently only has raw Node.js, Express, and Hapi for Node.js.

Should my Google Cloud Endpoints API backend be thread-safe?

I want to be clear: I am asking about the case where I am not using any concurrency in my own implementation. I just want to know if the framework within which my backend will be invoked (ie google app engine) itself imposes thread-safety requirements on the code running on it.
Thank you!
P.S. as a related but separate question, is there any guidance on how to do multithreading in our own backend code (which then obviously needs to be appropriately thread-safe). Specifically, can we use java's standard executor services / thread pools, or there is some google-approved API? Thanks.
So google app engine or any other platform won't ensure thread safety for you because all the critical sections which your concurrency control techniques are trying to make thread safe are defined by the developer (you) and there is no way for the OS to know when reads and writes should occur. For the JVM, the two main concurrency libraries which are heavily used are the Guava libraries (made by google! ;-) ) and the Akka framework.
Both are great libraries, I've used both and have had a pleasure from their learning curves. I would also recommend looking into the Play Framework, they support the akka framework, and building reactive web apps is their main focus. If you're interested in learning some cool aspects of production frameworks, I would highly recommend learning and implementing Dropwizard (Google app engine doesn't support it, but the take aways you get from it definitely outweigh that con).
Please let me know if you have any questions!

Technology for Server side DOM manipulation (Java vs Node) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am doing a POC in which I have to manipulate DOM before giving HTML content to client/browser.
Some Use Cases:
Inject a javascript in html page and this javascript is customer
specific.
Inject the stylesheet according to the theme chosen by user earlier.
... More such cases are there with some business logic.
I have finished all use-cases. I have implemented it in Java using Jsoup. I have also done it in Node Js. I have to decide which technology to choose ?
Does anyone know any pros/cons in both techniques ?
Please suggest how should I test which of the two is better. Any tools available to test out the memory used/resource usage/time taken etc.
Though I have already computed time in both cases.
PS: Please feel free to suggest any other technology for server side DOM manipulation and tools to test out its performance and memory.
Choosing between Java/Node.js depends on the application you are building and people will always come up with benchmarks to show performance on one is better than the other. Most of these suggestions will not suit your use case, so instead consider your application, TCO, time to develop etc as parameters apart from raw performance and take a call.
Remember that node.js is a single threaded async i/o model vs the multithread sync i/o model of java, and that node can be ridiculously fast out of the box whereas java comes with lot of features that can come in handy later. Again, these are subjective too.
I would suggest DOM manipulation is something you should avoid serverside and try to offload it to client side javascript or use better templating engines. If it is unavoidable, Node.js has good options - try to use the module cheerio which is faster than heavy weight jsdom.
Again, using these libraries has its tradeoffs. Cheerio does not have advanced DOM manipulations - it tries to achieve jquery like API on the server while jsdom is a full fledged DOM engine.
It depends on your needs and setup. The question is what's the purpose:
small app - use NodeJS, it will probably consume less memory than Java
larger (modular app) - Java
You have to test them yourself. Regard the performance, resource usage and the speed of development.
We cannot choose for you.

What is the point of Node.js [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
Ok this is probably a little blunt and to the point, but what is the point/need for Node.js
I've noticed it mainly through CloudFoundry but just not too sure what its supposed to be doing. However I am guessing its probably something pretty big as why else would VMWare be supporting it.
Thanks in advance.
It's an...
Efficient and 100% event driven IO framework,
flexible enough to use the best underlying OS features it can find,
presenting an API in a high-level programming language (the same language your client-side will most-likely use),
implemented on top of the best available intepreting engine for that language, and
supporting more and more third party libraries with each passing day.
Effecient in server side api, avoid using for CPU intensive operation
:)
Node.js does IO right. It's asynchronous and non-blocking and the beauty of using js is that it does not have a standard blocking IO.
It's fast (v8 is a beast), it scales well, It's got a vibrant community and it's popular.
There are lots of wonderful libraries that run on node like now and socket.io.
It excels at real time communication and highly concurrent websites.
It also has the added bonus of less code duplication. You can write the same MVC code on the client as the server and easily support non-js users.
Further reads:
Usages of Node.js - What obstacles is it aiming to provide a ramp for?
Why and when to use Node.js?
What so different about Node.js's event-driven? Can't we do that in ASP.Net's HttpAsyncHandler?
What is Node.js?
Node.js is an event based,
asynchronous I/O framework that uses
Google's V8 JavaScript engine. Node.js
is commonly used for heavy
client-server JavaScript applications.
The node.js tag has some more background information to point you in the right direction: https://stackoverflow.com/tags/node.js/info
Node leverages Javascript's first class functions to allow you to program the server in a dynamic scripting language while getting very competitive performance.
Node isn't as fast as Haskell, Erlang or Go. But it is competitive with Java, and it outperforms Ruby, Python and PHP.
Haskell, Erlang, Go, Java, Ruby, and Python all have evented IO webframeworks, but they also have blocking libraries to serve as pitfalls.
Despite it's warts, Javascript is the lingua franca of the web and since browsers are evented, not only is Javascript built for evented style programming, most web developers are used to writing evented Javascript.
Also check out this register article: http://www.theregister.co.uk/2011/03/01/the_rise_and_rise_of_node_dot_js/
This post might help:
Why Developers Should Pay Attention to Node.js

Resources