Automated Programming Assistant

Increase clarity and performance

Source++ is an open-source automated programming assistant with source code runtime and context aware functionality. Source++ works by displaying source code runtime metrics as tooltips and virtual text contextualized to the source code artifacts which they reference. This greatly decreases the cognitive load necessary to debug runtime issues as the underlying source code always remains in focus.

Source++ works best in your IDE but feel free to try it out on the source code throughout this website. Simply hover your mouse over the S++ symbol to see the source code artifact's live runtime behavior.

Java
public class JavaErrorExample {
    public static void main(String[] args) {
        while (true) {
            try {
                invokesMethod();
                throwsException();
                neverInvoked();
            } catch (InterruptedException ex) {
            }
        }
    }

    public static void invokesMethod() throws InterruptedException {
        Thread.sleep(500); //pretend we’re doing something interesting
    }//S++{fa53e250-a5ee-4c20-92cd-a043940e2cea;JavaErrorExample.invokesMethod();13}

    public static void throwsException() throws InterruptedException {
        throw new InterruptedException();
    }//S++{fa53e250-a5ee-4c20-92cd-a043940e2cea;JavaErrorExample.throwsException();17}

    public static void neverInvoked() {
    }//S--{fa53e250-a5ee-4c20-92cd-a043940e2cea;JavaErrorExample.throwsException();21}
}
Groovy
while (true) {
    try {
        invokesMethod()
        throwsException()
        neverInvoked()
    } catch (InterruptedException ex) {
    }
}

static void invokesMethod() throws InterruptedException {
    Thread.sleep(500) //pretend we’re doing something interesting
}//S++{fa53e250-a5ee-4c20-92cd-a043940e2cea;GroovyErrorExample.invokesMethod();10}

static void throwsException() throws InterruptedException {
    throw new InterruptedException()
}//S++{fa53e250-a5ee-4c20-92cd-a043940e2cea;GroovyErrorExample.throwsException();14}

static void neverInvoked() {
}//S--{fa53e250-a5ee-4c20-92cd-a043940e2cea;GroovyErrorExample.invokesMethod();18}
Kotlin
fun main(args: Array<String>) {
    while (true) {
        try {
            invokesMethod()
            throwsException()
            neverInvoked()
        } catch (ex: InterruptedException) {
        }
    }
}

@Throws(InterruptedException::class)
fun invokesMethod() {
    Thread.sleep(500) //pretend we’re doing something interesting
}//S++{fa53e250-a5ee-4c20-92cd-a043940e2cea;KotlinErrorExampleKt.invokesMethod();13}

@Throws(InterruptedException::class)
fun throwsException() {
    throw InterruptedException()
}//S++{fa53e250-a5ee-4c20-92cd-a043940e2cea;KotlinErrorExampleKt.throwsException();18}

fun neverInvoked() {}//S--{fa53e250-a5ee-4c20-92cd-a043940e2cea;KotlinErrorExampleKt.neverInvoked();22}

Why display runtime behavior in the IDE?

It can be difficult to predict the behavior of complex software referencing only the static textual source code. Performance issues can be easily overlooked and given that they do not cause compile time issues, their impact can go completely unnoticed throughout development and testing until surfacing in a production environment under real traffic. Software also builds on itself making the performance of new code dependent on previously written code.

For an example of just how subtle performance losses/gains can be, there are two Java classes below which are exactly the same except for a single letter difference. This single letter difference causes one of the classes to perform a large amount of unnecessary autoboxing.

Visually the code seems identical, but do you notice the difference in their runtime performance?

Primitive access

Java
public class LoopAdder {
    public static void main(String[] args) {
        while (true) {
            calculateSum();
        }
    }

    static void calculateSum() {
        long sum = 0L;
        for (int i = 0; i < Integer.MAX_VALUE; i++) {
            sum += i;
        }
        System.out.println(sum);
    }//S++{24e92339-8770-4a0c-bef7-67e7b847f13e;LoopAdder.calculateSum();8}
}

Unnecessary autoboxing

Java
public class LoopAdder {
    public static void main(String[] args) {
        while (true) {
            calculateSum();
        }
    }

    static void calculateSum() {
        Long sum = 0L;
        for (int i = 0; i < Integer.MAX_VALUE; i++) {
            sum += i;
        }
        System.out.println(sum);
    }//S++{6636fe3a-fe90-4475-a9d1-3fbc19cb29f7;LoopAdder.calculateSum();8}
}