• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

When to implement Java REST and when to implement Node JS REST instead?

 
Ranch Hand
Posts: 2954
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We can create  Node JS REST web service too apart from java REST web service. When should be create Node JS REST and when should be choose Java REST as the implementation?

thanks
 
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My take on this is that it depends on too many variables to give a straight forward answer.

For someone who knows Java really well then they may begin by thinking of a solution in Java.
The opposite could be true about someone who know NodeJS really well.
Why limit yourself to only these two languages. Some people may excel and really like Ruby, C++ or Perl.
Any one scenario may lend itself more to a particular language or framework then others, but currently we are talking about generalities.
There is no perfect language or framework for each situation and each was originally created to solve some specific problem(s).

Sometimes the language or framework is dedicated to the programmer by environment they are using (MS Windows Programmers, Linux Bash, etc).
Other times the language or framework is dedicated by the senior members on the team or management.
 
Monica Shiralkar
Ranch Hand
Posts: 2954
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks

For someone who knows Java really well then they may begin by thinking of a solution in Java.
The opposite could be true about someone who know NodeJS really well.



And what is someone knows both well?
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then you flip a coin.

You've asked this before in another post and the answer doesn't change: there isn't any magic formula. It depends on many factors including the knowledge level of the implementing team.
 
Monica Shiralkar
Ranch Hand
Posts: 2954
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Based on this which one should be choosen for the below scenario:

The UI developed using AngularJS needs to interact with the SQL Server database and display the data on the UI. It can call the REST API which can do the actual job of fetching data from database. If the team knows both java and NodeJS then which one would be more suitable for this scenario and why?

thanks.
 
Pete Letkeman
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Monica Shiralkar wrote:And what is someone knows both well?

Invariably people have favorites for languages and frameworks which would guide the choice.
(I think) it may be unlikely that someone would know two different languages along with their frameworks equally well unless they can say that they don't know that language or framework at all.

If there is a project which comes along in which either language or framework would work then you have to look at other factors such as:
  • the server environment
       - if you are unable to get the JVM installed on the server then you can't use it
  • the tools provided by both the vendor and by third parties
       - some people like particular IDEs which may not be the best for a particular language or framework
       - the cost of some IDEs or libraries may be too much
       - the learning curve for a IDE may be too steep for some people
  • the estimated time to complete the project using either language and framework
       - if someone can complete the project using NodeJS in half the time it takes them to complete the project using Java then maybe they should use NodeJS

  • As Bear stated:

    Bear Bibeault wrote:there isn't any magic formula. It depends on many factors including the knowledge level of the implementing team.

    So you will have to take this on a case by case basis.

    Many times companies will hire Java developers expecting them to do a majority of the programming in Java.
    Or they will hire NodeJS developers expecting them to do a majority of the programming in NodeJS.

    Mixing and matching more then one language for a project is also a possibility and that is indeed what NetFlix has done for it services under the guise of microservcies.
     
    Ranch Hand
    Posts: 239
    12
    Scala IntelliJ IDE Eclipse IDE Java Ubuntu
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    This same question came up at work recently in an unexpected context. We observed after moving some services into AWS Lambda using Java that cold start times were unacceptable. If you're not familiar with the AWS Lambda service, AWS auto-scales according to request volume. When requests are at a pretty steady level, whatever algorithm they use has scaled your lambda to the right size of nodes and can handle all requests on "warm" nodes. If a burst of requests comes in and AWS Lambda's algorithm has to spin up new nodes to handle the volume, those are called "cold" nodes and they suffer startup and initialization time. AWS gives no guarantee that a given request to a Lambda will hit a "warm" node. If it hits a cold node, the request might take a second longer to be serviced.

    We ran our own microbenchmarks and found that Node.js lambdas have shorter cold start times by about half. So now we're starting to think, well maybe we should move certain Java implementations to JS on Node.
     
    Ranch Hand
    Posts: 52
    1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    1. Node JS is good at solving certain type of problems with its own limitations
    2. Server side programming with Java is proven for many decades

    Is your API depends on more IO and more computation needs (complex logic), then would suggest Java, for simple rest apis Node JS is good
     
    Lakshman Arun
    Ranch Hand
    Posts: 52
    1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    With some example, for apis like which gets product description/user review comments Node JS is a better candidate. For APIs like, getOrderTotal Java Rest is a better choice
     
    Bartender
    Posts: 7645
    178
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Lakshman Arun wrote:Is your API depends on more IO and more computation needs (complex logic), then would suggest Java, for simple rest apis Node JS is good
    ...
    With some example, for apis like which gets product description/user review comments Node JS is a better candidate. For APIs like, getOrderTotal Java Rest is a better choice


    Both these have low complexity, and low I/O and CPU needs, so I don't see much of a difference. Not that I think a complex logic argues for using one language over the other, mind you.
     
    Lakshman Arun
    Ranch Hand
    Posts: 52
    1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Tim Moores wrote:

    Lakshman Arun wrote:Is your API depends on more IO and more computation needs (complex logic), then would suggest Java, for simple rest apis Node JS is good
    ...
    With some example, for apis like which gets product description/user review comments Node JS is a better candidate. For APIs like, getOrderTotal Java Rest is a better choice


    Both these have low complexity, and low I/O and CPU needs, so I don't see much of a difference. Not that I think a complex logic argues for using one language over the other, mind you.



    getOrderTotal usually wont be just fetch the value from db/order, it involves, pricing different components of order and total it. And each component(shipping/discounts/promotions/tax etc) pricing will have its own logic. Hope you get my point.

    The Complexity (in this context involves more number of sub tasks/operations it needs to do), and recommend Java Over NodeJS for this usecase.
     
    Monica Shiralkar
    Ranch Hand
    Posts: 2954
    13
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks all. Is it true that for simple task NodeJS REST should be used and for complex one Java REST should be used?
     
    Pete Letkeman
    Bartender
    Posts: 1868
    81
    Android IntelliJ IDE MySQL Database Chrome Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    There is no rule or guide as to what is simple and what is hard. Plus each language has its pros and cons. You have to take this on a case by case basis. Is no uncommon to use multiple languages in a project especially with microservices.
     
    Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
    Gift giving made easy with the permaculture playing cards
    https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
    reply
      Bookmark Topic Watch Topic
    • New Topic