Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.


The Nature of Code

Processing Foundation via Kadenze


Can we capture the unpredictable evolutionary and emergent properties of nature in software? Can understanding the mathematical principles behind our physical world help us to create digital worlds? This class focuses on the programming strategies and techniques behind computer simulations of natural systems. We explore topics ranging from basic mathematics and physics concepts to more advanced simulations of complex systems. Subjects covered include physics simulation, trigonometry, fractals, cellular automata, self-organization, and genetic algorithms. Examples are demonstrated using the p5.js environment with a focus on object oriented programming.

Video featuring original artwork in P5.js by:
Particle Equalizer #1 by Sehyun Kim
Look at me! by Muqing Niu
Dancing Spring by Yue Hu
FireWork by Yue Hu
Nature Of Code final at ITP by Joe_Mango
Nature of Code - midterm by Marcela Nowak
Sound And Motion Coding by Marcela Nowak


  • Steering Behaviors
    • This session, we’ll examine a special kind of force (pioneered by Craig Reynolds) — a steering force — that moves an object according to its own goals or desires. Examples are wandering, seeking a target, path following, obstacle avoidance, and more. We’ll then look at how group behaviors can be simulated by combining multiple steering behaviors according to local interactions between objects.
  • Introduction / Overview
    • In this session we’ll review the basics of p5.js and get everyone up and running with posting sketches online. We’ll look at how object-oriented programming works in JS and create simple sketches of objects moving around a canvas.
  • Fractals
    • In this session we will cover the concept of a fractal and look at ways of generating fractal patterns with code.
  • Genetic Algorithms
    • This session will look at the key concepts of Darwinian evolution — variation, selection, heredity — and examine how they can be applied in a computer simulation.
  • Vectors / Forces
    • This session will look at the concept of a vector and implement sketches using a p5.Vector object. By creating objects with vectors for position, velocity, and acceleration, we’ll build a simple “hello world” physics engine.

Taught by

Daniel Shiffman


5.0 rating, based on 14 Class Central reviews

Start your review of The Nature of Code

  • Anonymous
    Dan is an unbelievable teacher! I always wanted to go to NYU but in reality I could never afford it. Thank you for sharing this knowledge with the world. I bought your book last year but this class really helped me step through it piece by piece. It is not an easy course. But I can't believe what I was able to create! The best part was seeing what other students were making at the same time from all around the world. Thank you. Thank you. Thank you.
  • Anonymous
    This was a great course. Dan is a very dynamic, entertaining and funny teacher. The video lectures were well done and the assignments appropriate to the content. The last session seemed a little compressed – a couple of advanced subjects that might have been better as separate session/assignments – but overall it was an excellent course. I have done several courses on Kadenze and this was one of the best.
  • Anonymous
    Dan Shiffman has great courses on his youtube channel. Coding Rainbows! But this course is so well made. Only on week 1 but cant wait for the next sessions to be released! Also great to see other students work in the gallery.
  • Anonymous
    I stumbled upon Dan Shiffman's one-hour of code video a few months ago and I'm now officially hooked and trying to watch every tutorial videos/course he makes. I didn't know anything about code before and the way he explains it make it very accessible and also pushes me to know more and more. I highly recommend his course.
  • Anonymous
    Easily the best online course I've taken so far!
    I really appreciate the focus on just getting things working from the start, as opposed to (most other courses) lecturing on and on about 'theory' without application.
    As others have said, Daniel Shiffman's youtube channel "Coding Rainbow" is definitely worth checking out as well. It's a looser/informal version of this course, covering loads of cool topics.
  • Anonymous
    Daniel Schiffman is a great teacher : bright, enthusiastic, interesting and entertaining.
    That mooc is a really good way to level up your practice in p5js and your understanding of physics simulations.
  • Anonymous
    This is the most interesting course for creative programming, or simply if you are a programming enthusiast. The course materials are excellent, and provide a wide range of personal exploration, and you are able to model many interesting, real or fictional, natural scenarios.
  • Anonymous
    I have been following Daniel sir since couple of years and as coding is not my primary field still these tutorials helped me a lot. There is no way I could express my gratitude and best wishes.
  • Anonymous
    Love this course! Also love the YouTube tutorials, can't wait for more! So far, what seemed really too complicated for me is made easy.
  • Anonymous
    Dan is one of the most engaging teachers I have ever seen, the content is superb, I just wish it was longer! Love this course and his YouTube channel!
  • Anonymous
    I could not go till the end of the course. But it was great and I am looking forwards for the next section. Dan is really a very good teacher, his teaching is great. And fun at the same time. Thanks.
  • Anonymous
    Great course with a terrific teacher (I started following Dan Shiffman on Youtube after completing the course). I learned a lot and there are many connected topics and areas that got me interested — simulations, games, P5.js in general, etc.
  • Anonymous
    Excellent Introduction for new concepts. Instructor with a charisma of transferring Knowledge..
    Do at your own pace scheme offers flexibility for completing assignments and deepening of understanding of concepts. Multitude of potential application of acquired knowledge on completion of course.
  • Anonymous
    Great course if you already know the basics of programming, it will also strengthen your OOP skill.
    It also showed me the importance of math formulas.

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.