0

iam in a mood right now and thought it would be great to port my existing plain JavaScript projects to CoffeeScript and BackboneJS to get a cleaner structure for future development. I also like the CoffeeScript syntax and its ability to compile Lint-proved JavaScript.

I found some neat Information about how both of them can work together. -> http://spin.atomicobject.com/2011/05/06/using-backbone-js-with-coffeescript/

But my problem is: Iam not quite sure where to start. I usually structured my JavaScript in a pseudo class-based fashion. Like this:

var node = new function() {
    this.add = this.add = function(target) {};
    this.set = function(target, options) {};
};

Iam not very familiar with BackboneJS and CoffeeScript in practice. Is it better to start off with a BackboneJS structure and refactor my scripts into that. Or should i rewrite my code in CoffeeScript and move it to BackboneJS afterwards?

1 Answer 1

1

Depending on the size of the codebase, I would first translate all the JS code in question into CoffeeScript (js2coffee & manual clean-up) and make sure everything is still working. After that, start refactoring. It will be easier to fix problems you meet along the way while doing only one type of changes at a time.

Sign up to request clarification or add additional context in comments.

1 Comment

Sounds like i flexible start. Thanks for your suggestion.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.