Win a copy of Head First Android this week in the Android forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Node.js Design Patterns: how different from Java?

 
Ranch Hand
Posts: 512
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
What is the main difference in building a web application in Node as opposed to Java ? You could apply server less techniques to both languages.

thank you,
Paul
 
Author
Posts: 9
jQuery Python TypeScript
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think most of the patterns you commonly use with Java (or other OO languages) can be ported to JavaScript and Node.js quite easily. Although, even if that's the case, I wouldn't recommend doing that just because it might feel more familiar (if you come from Java). In fact, because Node.js has a very flexible module system and being JavaScript a dynamically typed language with closures and a prototype-based object model, the traditional OOP patterns often find different incarnations. Just to give an example, you would rarely need dependency injection and the dependency injection container. Furthermore, being the whole language so dynamic and based on async programming, it creates the need and the opportunity for a number of new interesting patterns that are novel when compared to traditional OOP patterns.

In the book we explore traditional design patterns (and how they can be expressed in the context of Node.js) but also many novel patterns that make sense only in JavaScript/Node.js.

I hope this makes sense even if a bit abstract. I am more than happy to try to go deeper on the topic if you have more specific questions.
 
Luciano Mammino
Author
Posts: 9
jQuery Python TypeScript
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As per building web applications using serverless i think both Java and JavaScript/node.js are excellent choices and i would recommend picking the language that you are more familiar with (unless you are looking for excuses to learn the other ;p).

In a serverless ecosystem there might be benefits in using JavaScript because there are generally better performances in terms of bootstrap time, even though it seems that quarkus and Graalvm are helping to bridge this gap.
 
paul nisset
Ranch Hand
Posts: 512
2
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your answers Luciano. Your comments on patterns make sense .
It should be an interesting book .
-Paul
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic