Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you have callback hell, it is an expression of muddled thought.

If you have broken your code up into small enough modules and functions, and you know which tasks depend on other tasks, you will not have callback hell.

If you are unclear on the logic of your code, you can often make it work in a messy way with the "laundry list approach". This involves formulating a sequence of tasks that happens to work, without needing to understand the actual dependencies. Many synchronous languages facilitate a laundry list approach, as their inefficient blocking paradigm removes the need to formulate the laundry list as a sequence of nested callbacks. It's still messy code.



> If you have callback hell, it is an expression of muddled thought.

No. It's an indication that you're using a FOTM runtime environment. There's a reason why no production-ready runtime uses continous passing / callback models.


I know a lot of people running node in production, and getting very high performance out of it. It may anger hacker news that such a thing is even possible, but there you have it.


Really? How do you suppose nginx does it?

Or any of the other top-end (in requests/sec) webservers?

Hint: they aren't utilizing green threading and/or a scheduler.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: