0

I must do maintenance and add some code to a client website (hundreds of source files in jsp, js, etc.), but first I have two weeks to understand how it works. The source code doesn't contain comments, but it is organized. However, there are a lot of files to go through.

In general, I have worked with a few medium websites, and my method to understand the source code was:

  1. understanding the interface (vue)
  2. analyzing the source code and take comments starting by the Home page

But this website is really huge and I wonder if there is any better methods or techniques to understand it, or if there is software that can help (reports?), or a tutorial online.

I'm looking for any information that can help me to be more productive and fast analyzing the source code.

4 Answers 4

0

You can make use of web development tools, like firebug, F12 developer tools, etc., to inspect, edit and monitor CSS, HTML, JavaScript, etc.

0

Get yourself an IDE, Dreamweaver costs money but other ones like aptana are free. They will allow you to see the folder structure and make the code more readable. Dont think there is another way, just have to keep looking through site and see how the previous developers went about doing things, hopefully there was some type of standard way they went about things

0

You're in luck - there's a book you can buy!

In my experience, once you get to large projects, you need to get some help...

Firstly, install Sonar, and configure it to inspect the project. It provides a high-level overview of the codebase, and highlights areas that look risky - when taking over a codebase, it's important to know if you're looking at a well-designed app, or a pile of badger droppings. Even though static analysis is a very blunt instrument, and likely to be wrong in many cases, it's a pretty good start. Run for the hills if you see "rules compliance" below around 75%.

I'd spend a decent amount of time looking through the Sonar analysis, and maybe adding some additional reports using the plug-ins depending on what you find.

Next, I'd make sure I understand the build and deploy process inside out. Most of the time, you can work out what the code does, even if it is a bit crazy - but deployments are often voodoo, with many exciting failure modes. Get a test environment, and make sure you can compile and deploy the application from scratch - that's really the best way of understanding the moving parts.

While you're doing this, it makes sense to set up your own revision control system, continuous integration environment etc.

Finally, any kind of testing information you can find is a huge help - either automated (Junit, Selenium etc.) or even in the form of test scripts. After all, how can you know whether an application is working as expected if you don't know what to expect? If you don't have any tests, I'd strongly recommend starting by writing your own unit tests. It's a brilliant way of getting to grips with someone else's code - and if you can't write unit tests for some reason, that's usually another sign to look for a new job.

0

You should remember you don't need to know everything about how every piece of code works, you only need to know what you need to know - so to speak.

What I'm saying is, if your client has asked you to add a Bulletin board to his site, for example, you don't need to spend days digging around his JavaScript files to "figure out what they do." You would just need to understand his environment enough to know how to setup the bulletin board and then move on.

Likewise, if he wants you to create a Contact Us form and his page is done in PHP, you don't need to know how every piece of PHP code runs through the site today, you only need to know how to create a mail form in PHP and include that into the site.

As a more advanced note, if you're going to be doing maintenance on this site, I strongly recommend putting the files under Revision Control. Basically, these are systems that help you manage the changes you make to the code. Over days, weeks, months or (hopefully for you) years, a lot changes, and it's nice to be able to see how and why you changed things.

As far as software goes, it's all a matter of preference but I use NetBeans IDE as my IDE and TortoiseHg for Revision Control.

Your Answer

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

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