• 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 ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Javascript Promises - overall application architecture, use in server side Javascript?

Ranch Hand
Posts: 125
Clojure Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rami Sarieddine, thank you for participating in the book giveaway.

I understand that Promises are an escape from the nested callback headaches you get in a lot of Javascript code. I am curious if your book includes recommendations for how to structure a Javascript application differently now that this tool is in available.

I'm also curious about the implications of promises for writing applications in Node.js or Meteor.js. Do you have any thoughts on that?

Thank you for your time. The free sample material from Packt Publishing was well-written and easy to follow, even for someone like me with Javascript knowledge barely past the novice level.
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Michael. Thank you for the question.
As you noted, nested callback gets to be more problematic once it grows in lines of code and depth of nesting. Promises give you a neat solution for that, by providing you a more readable and "debuggable" approach. In the book there are examples on how structure the new code written with promises and talks about the ways that are currently used to make the callback nesting better and how Promises stand out as a better solution.
Regarding Node.js, the book doesn't go there. But Promises are now actively used in Node.js.
Q library by Kris Kowal is the dominant promise implementation in node.js. There is also Promised-IO by Kris Zyp.
Happy reading
    Bookmark Topic Watch Topic
  • New Topic