2

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..

maple_shaft
26.6k12 gold badges60 silver badges136 bronze badges
asked Apr 3, 2013 at 1:38
1
  • 1
    Talk about mixed metaphors! Diarrhea squirted all over... Spaghetti... Commented Apr 3, 2013 at 7:09

1 Answer 1

3

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.

answered Apr 3, 2013 at 2:04

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.