There has been some bloggers complaining lately about the callback pattern and its spaghetti code structure. Some even compare it to GOTO statements, although that post is less about coffee/javascript. The beauty of javascript, especially written in coffee-script, is that you can conceptualize parallel and dependent tasks based on code indentation. Commands executed in the same depth are executed at the same time, while code resting deeper (in the particular case of callback patterns) are deferred until dependent execution is complete.
The following image on the left depicts what I am explaining above. Blue lines are executed at the same time. Red lines are dependent on their blue parent's completion before they execute, and so on.
I then take the idea a step further and mix batches of parallel tasks with tasks dependent on the batch to complete.
This is a sample gist of personal work I am doing on a Project Management webApp. The goal of this gist is to show how non dependent tasks can be parallelized and dependent tasks can be run after those parallel dependencies are run. eachTask iterator takes a task object and a callback. It uses the Function prototype method call to pass scope to each parallel task.
Blog Archive
-
▼
2013
(50)
-
▼
August
(18)
- Remembering Martin Luther King
- Babysitter sexually abused young boys
- How the Video Game Sacked Its Rivals
- Mutoh America Exhibits
- Using classical inheritance to contain express con...
- Always Consult A SBI Car Loan EMI Calculator to Ge...
- Kean computer science students in Union travel 'be...
- Latest traveling exhibit to open at ECHO
- Custom Nagios Notifications, now with Jade
- Simple Callbacks - Executing parallel and dependen...
- Police storm camps supporting ousted president
- School around the corner
- Capital's role in the economic crisis
- With a Little Bashing
- Okanagan College Esthetics program scores
- 2013 Ford Escape
- Async HTML5 File Uploads with Node / Express Frame...
- Tictail’s trick for easy e-commerce
-
▼
August
(18)
Popular Posts
-
I recently found an interesting article on a simple hack to get the existing image upload feature in CKEditor 3 enabled and functioning wi...
-
Mutoh will be introducing a new G7-enabled process control solution for its ValueJet family. Working in conjunction with ColorMetrix Technol...
-
A global leader in professional skin care has partnered with Okanagan College to offer students in the new and enhanced Esthetics and Nail T...
-
Firefighters know the importance of home fire safety. That's why the men and women of your Los Angeles Fire Department urge you to chan...
-
ENCINO - Over 100 Los Angeles Firefighters battled a huge blaze raging at an Encino home that injured two Captains and two Firefighters on ...
-
SAN FERNANDO - The Los Angeles Fire Department (LAFD) including a Hazardous-Materials (Haz-Mat) Team battled a small fire on October 30, 2...
-
The Los Angeles Fire Department and Los Angeles County Fire Department are joined by the world renowned Grossman Burn Centers in asking y...
-
For the estimated 80 million domestic cats that are kept as house pets, there are as many roaming free. Those numbers shouldn't be surpr...
-
Did you know there are different types of smoke alarms that are better at alerting you to different types of fires? Ionization smoke alarm...