DEV Community

Tea Reggi
Tea Reggi

Posted on

1

Site Wish: Code Editor + Code Golf + Rosetta Code

I wish there was a site where a user could specify the input and output of some code. Users or the author of the challenge could then submit bodies of code in any language that satisfies the output.

The site would run the code and verify the solution passes the test. Users could the submit alternative solutions to the same problems and in any programming language.

This results in the following:

  • A way of measuring "Code golf", to explore a solution with the smallest number of characters.
  • A benchmarking tool. Comparing solutions and allowing a way to check the most performant.
  • Help people learn programming. Once solutions for a given problem are created different languages, people can compare languages they know and ones they don't to possibly learn another programming languages, or point out differences / similarities across languages.

Rosetta Code

This last idea isn't new Rosetta Code is a wiki site that has examples of how to do the same thing across programming languages. For instance here's how to do a simple for-loop in C++ and in bash:

for(int i = 0; i < 5; ++i) {
  for(int j = 0; j < i; ++j)
    std::cout.put('*');

  std::cout.put('\n');
}
Enter fullscreen mode Exit fullscreen mode
for i in {1..5}
do
  for ((j=1; j<=i; j++));
  do
    echo -n "*"
  done
  echo
done
Enter fullscreen mode Exit fullscreen mode

I'd love if there was a site that instead of of just having these samples, actually verifiably executed and passed a specific criteria.

Hacker Rank

Hacker Rank is a tool that allows companies to provide coding challenges to candidates and has a code editor interface and compares the written code against some set of output criteria, which is very similar to what would be required here.

There are things that are similar to this idea but nothing fully hits the nail. The site would need an enormous amount of compute to evaluate the code samples, which would be potentially very costly.

Let me know if something like this already exists, if not perhaps we can make it happen together? Drop me a line.

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more