Coffeescript has +1'ed itself for me lately. I will tell you why and try to explain. As far as I know, there is no native support in coffeescript for having a class extend multiple parents classes. In plain javascript, scope and prototypal inheritance can be confusing, as you'll see later on.
Lets imagine we are taking our express web application and isolating out the app routes and the socket events. The reason for this is simple: when a Web class extends the controller and event classes, they can share important pieces of information related to the web server such as a user session or login information. This will help us later on when implementing socket events for authorized users.
Here is the entire bit of code to get you going. It is simple, elegant, and for the most part completely readable as long as you have a bit of understanding in regards to the way prototypes in javascript work.
Here is the compiled, fully javascript compliant version. As you can see, its a bit messy and definitely not as readable as the coffeescript version.
Happy coding.
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...