Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

A LAMP project I am currently working on is pretty well organized on the backend. However, there are a ton of pages that just have a diarrhea of javascript and html squirted all over numerous locations with little discernible architecture, rhyme, or reason. In a few cases, some kind of javascript prototype was created for a common control, and the MVC framework in place is taking care of templating pages.

How do we start to get all this spaghetti code under control? On backend projects I would start with getting some unit testing in place, CI, refactor common MVC or model/mapper code out etc..

share|improve this question
1  
Talk about mixed metaphors! Diarrhea squirted all over... Spaghetti... –  Jim G. Apr 3 '13 at 7:09

1 Answer 1

Do the same things. Unit testing is available via phantomjs or other runtimes and testing frameworks like Jasmine, Mocha, and etc. You might also look at Karma. It is possible to do CI builds using these tools.

You can refactor in JS just like you would in other languages.

In short, take all your knowledge for dealing with this problem in backend code and use the tools that are available to start applying it to your frontend code.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.