Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing Maintainable Event-Driven Code [closed]

I have just recently started playing with event-driven architectures, coming from a pretty standard object-oriented mindset.

The first thing I noticed was that the difficulty in understanding and tracing through programs seems to increase exponentially with the size of the program. While small pet projects are easy to follow, it feels like the code will rapidly turn to spaghetti.

I understand that I am new to this development mindset and not all of my object oriented worries carry over. Are there any resources on writing maintainable, understandable event-driven code? What do people who use node.js or Twisted or Event Machine do about this?

like image 677
Mantas Vidutis Avatar asked Apr 08 '11 15:04

Mantas Vidutis


Video Answer


3 Answers

I did a talk on this topic at Yahoo last year.

like image 133
sh1mmer Avatar answered Sep 23 '22 10:09

sh1mmer


Try to look at these articles:

  • Understanding the node.js event loop
  • Control Flow in Node
  • Control Flow in Node Part II
like image 20
yojimbo87 Avatar answered Sep 19 '22 10:09

yojimbo87


Martyn Loughran wrote an excellent short article entirely about avoiding the callback spaghetti.

What I really enjoyed about his article is the process of improving spaghetti into something nice and clean; it might seem a little formalized at first, but when you see the end result I think you'll agree he shows real artistry in clean, legible, code.

like image 42
sarnold Avatar answered Sep 20 '22 10:09

sarnold