Peter Cooper has developed a simple source code snippet repository with tagging that I like. It’s far from perfect, the syntax highlighting is often squirrelly and if you enter in a multi-word tag like this “unit test” when you go to edit the code you get your tag back as two separate words so you always have to put the quotes back in place. Nevertheless, it works and it’s a good start. Plus people aren’t being shy about putting code out there.
What we need at this time are a small army of Java developers putting their code snippets into this repository. In no time it could be the place to go for a quick routine to fix a problem.
Here are my snippets thus far:
- Ant 101
- Getting A Data Source From Tomcat
- Data Source 101
- Velocity 101
- Velocity 101 Unit Tests
- Email 101
- Email 101 Unit Tests
They will even give you a feed for when I post new snippets. Unfortunately they don’t have feeds for individual tags (e.g. Java) working yet. That’s a shame and it’s actually one of several glitches I’ve noticed. But even with the bugs this is still a more believable code snippet repository than many I’ve seen over the years. The tags go a long way towards making it really searchable and usable. But it will only be really useful if _everybody_ enters in some of their favorite utility functions and classes. So go sign up this minute and put in just three Java code snippets! It will take you less than 15 minutes and we will all benefit.
If there aren’t any more improvements or he never releases the source code or it never gets full text search then maybe I’ll move my snippets to another repository in the future. But it needs to be one with syntax highlighting, an easy framework for inserting the code in the first place (this is very very easy), and tagging.