Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Why and How You Should Move from PHP to Node.js

3,965 views

Published on

As presented at DevDuck #1 - JavaScript meetup for developers (www.devduck.pl)

Why and How You Should Move from PHP to Node.js?

Advantages and Disadvantages of both - PHP and Node.js. Everything what you need to know while changing your tech stack to Node.js

Published in: Software
  • Be the first to comment

Why and How You Should Move from PHP to Node.js

  1. 1. Why & How You Should Move from PHP to Node.js
  2. 2. Piotr Kowalski CTO @Brainhub
  3. 3. Because it’s 2016!
  4. 4. Because it’s 2016!
  5. 5. Some thoughts about PHP (my personal selection) ● Got used to HTTP (rather request processing than application) ● Many PHPisms, inconsise API (past days) ● Many libraries from many sources ● Tremendous community ● Pretty adult
  6. 6. What is JavaScript?
  7. 7. Brief history ● Written in 10 (!) days of May 1995 (name: Mocha) ● Deployed in Netscape Navigator 2.0 in December same year ● Standarisation process since 1996 - ECMAScript ● Browser wars ● Many descendants - JScript, ActionScript and so on… ● NOT DEAD!
  8. 8. What is JavaScript not a.k.a. popular myths ● Given a web page, add me some animation magic ● Do me some AJAX magic ● Some stuff that cannot be kept tidy ● Works different on every browser ● You write $ then some CSSish selector, then you do stuff ● It’s only for the Web ● Some people call it node, but I have no idea why ● There are no classes, it’s not real OO language ● Everyone knows JavaScript, so why bother?
  9. 9. What about node.js? ● A V8 JavaScript engine ● Multiplatform ● Versatile ● Fast (in a runtime) ● Actively developed (current version 7.0.0) ● ...some more
  10. 10. Asynchronous event loop with non-blocking I/O
  11. 11. Asynchronous event loop with non-blocking I/O
  12. 12. Node Package Manager ● Packages count: 344694 (as for today) ● Actively developed
  13. 13. Realtime application > processing requests ● A web server works as a continuous process, doesn’t restart everytime a new HTTP request is coming ● Can be stateless, but don’t have to be so ● We can get beyond the HTTP (WebSockets, HTTP2, SPDY and so on) ● Does a web server should only create response?
  14. 14. Fast prototyping and pivoting
  15. 15. Scalability ● Horizontally scalable ● Since it runs a process it can be easily ran on multiple machines and load balanced ● Thin runtime environment
  16. 16. One can build a desktop app ● Electron ● NW.js ● APPjs
  17. 17. Many frontend frameworks
  18. 18. Isomorphic front- and backend ● Common codebase both for the backend and the frontend ● No more redundant code!
  19. 19. WebSockets is a future of the Web (IMO)
  20. 20. Node native extensions One can write native modules/extensions to node.js (C/C++/Objective-C)
  21. 21. One can run it even on a coffee machine
  22. 22. <
  23. 23. How should I start?
  24. 24. Read some books https://github.com/getify/You-Dont-Know-JS
  25. 25. Read some books http://shop.oreilly.com/product/9780596517748.do
  26. 26. Read some books https://www.manning.com/books/secrets-of-the-jav ascript-ninja
  27. 27. Subscribe to some blogs/feeds ● http://www.echojs.com/ ● https://davidwalsh.name/ ● http://jstherightway.org/ ● https://www.sitepoint.com/ ● https://medium.com/@dan_abramov ● http://javascriptweekly.com
  28. 28. Choose some framework
  29. 29. Play around and bring your ideas to life!
  30. 30. Come to the next #devduck!

×