Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

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

 
Ranch Hand
Posts: 125
1
Clojure Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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.
 
Author
Posts: 7
5
  • Mark post as helpful
  • send pies
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic