The Nature of Code

  • My Role

    Front-end Engineer

  • Client

    Daniel Shiffman

screenshot of website, showing chapter 2

“The Nature of Code” is a book about computer simulation of natural systems authored by Daniel Shiffman, a professor at the Interactive Telecommunications Program (ITP) at NYU. The original version was published in 2012. Recently, Dan has been working on a second edition of the book, for which I lead the software development. This includes updating the build system to generate both the PDF and website versions. We anticipate its release by the end of 2023.

The Previous content was written in HTML files with manually added class names and data attributes that can be picked up by the building tool for customized blocks. In this update, we added Notion as a CMS (Content Management System) and used Notion API to fetch the content and generate back the HTML files. In this way, we can have a much better editing experience while still maintaining the flexibility of having all content on hand in case we need to migrate to another service someday. Although some compromise was made to fit the original content inside, I am glad that Notion supports most of our needs (code snippet, nested block, multi column).

As for the output part, the website was built with Gatsby.js. And the previous builder (Magicbook) remained for generating the PDF since it has great support for publications like pagination and table of contents. The whole system finally became the following:

sketched storyboards

Content and the building system are open-sourced on GitHub: https://github.com/nature-of-code/noc-book-2023