This is another Packt review, and this time , its a book titled “Mastering NodeJS”, this might be my biggest review so far because this book packs a lot of information. I hope you read and enjoy the review on the book.
Chapter 1 : Understanding the NodeJS Environment
Chapter 2: Understanding Asynchronous Event-Driven Programming
This is arguably no doubt one of the most important and longest chapter in this book, and it deserves to be; as Asynchronous Event-driven Programming is a bit different from other pattern of programming especially coming from a Blocking environment like PHP. The chapters requires a careful read and also this will serve as a reference point due to its complexity. The chapter dives into the asynchronous pattern used in writing NodeJS applications and explains the various concepts around it. The “EventEmitter”'s role will be explained in this chapter, Signals and Forking (creating child processes) are also explained in a detailed manner. A lot of useful tools are really explained here and especially the most important part “Event Loop”. My personal advice is to read this chapter repeatedly so as to get a good grasp.
Chapter 3: Streaming Data Across Nodes and Clients
This chapter covers the various interfaces needed for the abstract Stream. It covers the readable Streams, publishing,pulling,writable streams and Duplex streams,the author shows how an HTTP Server can be created in node and send data to the client, personally if you are using NodeJS for web applications, you might want to spend a lot of time looking at this chapter. It covers a lot on the Request Object; and using the Query String to parse GET variables from the URL, handling of POST Data, setting of cookies, Responses and writing to HTTP headers.
Chapter 4: Using Node to Access the FileSystem
This chapters givers a history and overview of the file system, and the interface that NodeJS provides to enable you write data easily and also manipulate file information systems. The author was kind enough to throw some important foundation knowledge such as how UNIX treats files. As usual numerous examples are carefully constructed to introduce you to various types of operations ranging from “reading from directories,reading files,creating a writable stream, file operations and also handling file uploads”. By the end of the chapter; the reader would gain a lot of information about NodeJS and accessing and writing to files and streams.
Chapter 5: Managing Simultaneous Connections
This chapter talks mostly on concurrency and multiple connections, it talks about the C10k problem, the design architecture of a network that handles 10,000 simultaneous users. In this chapter the author will break down the principles of concurrency and also parallelism. This is the first chapter that introduces Third Party libraries; it talks about managing routes with Express ; a popular NodeJS Framework and Redis an in-memory database. It covers other topics such as authentication,session,cookies and handshakes.
Chapter 6: Creating Real Time Applications
This chapter focuses on the development of a real time application , and it covers the following by touching 3 different approaches AJAX, WebSockets and SSE (Server Sided events). This chapter also provides codes and the type of real time application that can be built for collaborative purposes. In this chapter you will be shown how to build a similar Google Doc- like application and how others can edit it. However I would advise for readers to take time to practice with an idea of a collaborative simple application to gain more experience.
Chapter 7: Utilizing Multiple Processes
Chapter 7 speaks about achieving parallelism, and working with numerous processes, it also sheds light on both the pattern of Single Thread programming and Multi-Threaded and explains the complexity behind Multi-threading such as thread synchronization. This chapter really goes deep by giving a detailed explanation behind Multi-threading and also the project “libuv”, a C++ project that is based on asynchronous programming and event-driven pattern. You will be introduced to the ChildProcess object which is responsible for spawning (creating) processes, with this you can fork a child process to run a task such as invoking the terminal to get PHP information or running a python script and returning the result into NodeJS, you can supply command and arguments. What's more interesting is that, when a parent forks a child processes, the child process can communicate with the parent object and vice -versa. This chapter is highly detailed and interesting.
Chapter 8: Scaling your Application
Building your application is half of the job, scaling become an issue especially when the application becomes extremely popular, in this chapter the authors explains a lot of topics ranging from Network latency,HOT CPU and others. The readers will also be introduced to tools to monitor performance and memory usage, such examples being the AB Apache Bench, a popular tool used for benchmarking web application and simulating HTTP Requests. A lot of tools and services are covered in this chapter.
Chapter 9:Testing your Application
NodeJS just like any other environment has certain tools to enable you ensure your application performs in the intended manner, luckily with the advent of NPM (NodeJS Package Manager) testing in NodeJS is quite easy. This chapter iterates on the principles behind testing and types of testing to be made. e.g such as Unit Testing, Functional Testing , Integration Testing. It also covers native debugging tools provided by NodeJS and covers the two terms “Errors” and “Exceptions”. The author covers testing a NodeJS application using the following tools : ZombieJS, Mocha,Grunt and PhantomJS
Appendix A : Organizing your Code
Simply put this chapter talks about using NPM and the style/manner in which NodeJS modules are installed. It covers guides on code organization and how you can share your repository with others. Remember someone out there might need your module.
Appendix B : Introducing the Path Framework
This chapter introduces the Path Framework to the user and gives reasons why users should adopt the framework for NodeJS Development.
Appendix C : Creating your own C++ Addons
This chapter covers how you can create your own C++ add-ons and expose them through the NodeJS header file. This chapter might be a bit complex to users with no C++ knowledge therefore a good knowledge on C++ and OOP would be essential.
About the Author
Have a question regarding the post above?
Or any of my designs?