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
-
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...
-
Today I will be updating my box to the latest nodejs and after doing so, installing the coffee-script command line interface which allows fo...
-
Nestled under ancient trees beside the First Presbyterian Church in Elizabeth lies a cemetery, richly studded with gravestones. Even through...
-
There are lot of online calculators available in the market. And when it comes to utilizing the same for the car loan, we have some special ...
-
PANORAMA CITY - Firefighters quickly extinguished an apartment fire, where a woman was found deceased and three others were injured, on Octo...
-
Riot police backed by armored vehicles, bulldozers and helicopters Wednesday swept away two encampments of supporters of ousted President Mo...
-
From the wiki article , a closure (computer science) is a function or reference to a function together with a referencing environment-- a ta...
-
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 c...
-
There has been some bloggers complaining lately about the callback pattern and its spaghetti code structure. Some even compare it to GOTO s...
-
The best bank that has been the favourite of people as well to avail any sort of loan is State Bank of India . That is why when people think...