A look at canyoucodebetter

Posted by Angelo Lakra Mon, 18 Feb 2008 08:44:00 GMT

Recently, I have been questioning the validity of my project, canyoucodebetter.com, because my efforts haven’t been as strong and consistent as I would have hoped due to my other commitments. To get back on track, I have decided to hash out some of my ideas and issues for this project in my blog. So for those of you tuning in, I apologize for this public brain dump.

The Purpose

I was reading Paul Graham’s latest posts, Six Principles of Making New Things and Trolls, and was glad to see that he once again describes the substance of creativity, its unfortunate consequences and how he deals with it.

Well, I have to say that his article on principles seems right on track. I need to find a simple, overlooked solution to my problem (and what I believe are many other developer’s problems): the storing and retrieval of important chunks of code.

This has been done before and has been done fairly well on many levels. There are a handful of websites boasting great numbers of code snippets with tag clouds and web 2.0 style. Not to mention that every coder who has a clue is using some type of version control system. And, of course, there is always Google. So these archetypes are there, and they work and people are using them. But are they really solving the original problem well?

The Problem

My problem, at the most basic level, is that I need to store and retrieve important chunks of code. I want to do this is fast as I can encountering as little distraction as I am able. I want to type, click and read as little as possible. Command-line version control seems to offer the best bet, but I don’t want to spend time looking for someone else’s master branch, pulling it, and then greping it only to get some code without some type of context. So when looking for something that I don’t know how to do, I turn to the web.

When I use these code snippet sites, I always feel like I’m looking for a tool in someone else’s toolbox ; on top of that, I’m not sure I will even recognize the tool when I come across it. This is to be expected, but I’m not convinced that many of these sites spent much time on efficient usability as they did making sure that their sites look and acted in a trendy web 2.0 manner.

Now, I’ve run into a couple code repository sites that definitely had an essence of simplicity and unobtrusiveness, which I greatly appreciated, but the content wasn’t what I was looking for and it still felt like more could have been done to quickly retrieve code into my editor.

More Problems

Let’s say that I found a piece of code that says it is what I am looking for. How do I know this code even works the way I need it to or even as described by the author? The other day I nabbed a snippet of Ruby code in method form off a site for a fairly elaborate algorithm that returned the current time minus another time as text (e.g. “5 days ago”, “yesterday”, etc.). After copying the code and testing it, I found it had an off by one error. It couldn’t tell the difference between yesterday and the 2 days ago (it would always display yesterday).

I ended up rewriting the whole method, using the basic idea that the original author came up with and wrote what I thought was a better solution, but even my code could be missing a case I didn’t think of. There’s a definite quality issue here. How can these snippet sites ensure that their code has a certain measure of acceptable quality? Peer review! Of course (but you already knew that, right?) I’ll write more on this later in this post.

Written code takes space on the screen and if you are trying to make an impression, do it by acting like a killer application and not a menace. Be as unobtrusive, yet useful as possible. I hate chasing after an already worked solution link by link. I also really hate when my focus is minimized for the content I’m looking for compared to things I don’t care about. Multiple advertisements, grossly over-sized logos and unnecessary site descriptions are the worse culprits. This is the garbage of the web.

So in summary, these are the current problems with all snippet sites:

  1. It can be hard to find the right code solution.
  2. Quality isn’t guaranteed.
  3. Code content is surrounded by distraction.
  4. Everyone is hashing out the same solution without learning from history.

A Solution

I like Paul Graham’s essays. People says he just got lucky and they are right, he did. But he has considerable wisdom in the the things he says because of his basis on experience and history. This is my take on his principles to solve my problem: storing and retrieving code snippets via a website and my code editor.

  • I’m going to imitate what I like.
  • I’m going to code the solution as simply as possible.
  • I’m not going to use a single graphic on my website (it’s just not important for this application).
  • I’m going to make sure that I don’t have to leave my editor to get/search/post/comment/whatever a snippet.
  • I’m going to be informal with my releases while quietly listening to feedback from users and site usage.
  • I don’t care about my competition, their solutions don’t solve my problem efficiently anyway.

Snippets will be organized as lists that can be modified and saved by the users using regex, plain text, tags, or languages.

Snippets can have many revisions/branches with authorized access/modifications controlled by an original author.

Revisions will be ranked by its users which will inherently rank the authors who write the code to ensure quality is maintained.

Snippets may have references to source sites and nested comments per revision.

Users will have the options of saving snippets they find useful. Users will also have a message wall (similar to facebook’s wall without all the crap) and an inbox so they can communicate directly with other users publicly and privately.

Users will be able to watch other users actions of their choosing on their wall. (provided a watched users allow their actions to be tracked)

Anonymous/Unregistered users can read and download from the site as much as they desire (except for private snippets). Only registered users can post. And only ranked users can branch/revise other users snippets (revision with authorization from original author)

Registered and anonymous users can make requests for code they would like to see on the site. Rank will be rewarded to those who offer solutions to these requests.

Spam will be allowed to be marked by registered and ranked users.

New languages can be added by registered/ranked users.

Merging will be available for original authors to merge their master code with other branches.

Webservice API will be made available.

An Implementation

canyoucodebetter.com will take the best ideas from the web interfaces of gmail and reddit, the power and speed of git, the thread safety of mERB, and the flexibility and expressiveness of Ruby.

I’ll give more details about this when I’ve got an initial version out.

The Money, Money, Money

Right now, there is no model. I’d hate to pollute my site with advertising, but I think I have time to think about this one.

Conclusion

It’s late. I’d hate to end so abruptly, but I think this hash is good enough to start hacking. Let me know what you think if you care.

Posted in , ,  | Tags , , , , , , ,  | no comments