Friday, March 11, 2011

Grok Your Code

I just have realized how easy it is to put up a service for searching my own codes.
During an architect-meeting the code reusing issue came up. Some of the colleagues wanted to create a storage for all written codes that must be tagged somehow to be searchable. Others wanted to generate and share documentation in html format, and search that one.
The problems with these solutions are obvious:

  • people under pressure do not care for putting their code into searchable archive 
  • poorly documented code cannot be searched
  • overdocumented code breaks the DRY principle
  • programmers speak programming languages - so it easier for them to search that one

One of my friend threw in that Google is quicker and probably smarter than any kind of archive that we could put together. Maybe he was right, but I was eager to find some possibility to combine the two, and put up an in-house code search site.
Actually I thought that there are tons of apps like this out there in the Open Source world. But it came up that the only relevant candidate is OpenGrok. I tried it, and I was completely satisfied. It is not only making a fulltextsearch on the code, but it uses ctags, to get some insight knowledge on the structure. It can even browse VCS history, which might came in handy when studying the meaning of the code.

Putting up the OpenGrok is easy:

  • unzip the archive
  • create a basedir for projects
  • checkout the projects from the VCS
  • setup the etc/configuration.xml (mainly just setting the path)
  • run bin/OpenGrok index
  • build the webapp
  • deploy under tomcat

Now what you might need automate is that the projects should be updated on regular basis and the indexing must be called afterwards. But that one does not require a master degree.

However when I presented this to the architects it turned out that I was not the only guy who worked on this item. One of the fellows showed us a nice wiki page on comparison of documentation generators.
The point why I cite this is that I want to emphasize the difference between reading some docs or doing something relevant.
I still believe in Experience By Doing...

1 comment:

  1. Emperor Casino | Shootercasino
    This is worrione the casino you'll be looking for! This casino 제왕카지노 is powered by Playtech. It's งานออนไลน์ located in the state of Gauteng. It's an extremely well-known casino,

    ReplyDelete