Your best Buddies

Learning about the project

How can we learn about the project/issue/library?

  • Coworkers knowledge
  • Documentation
  • Issue Tracking System
  • Version Control System
  • Source code

Coworkers knowledge

Who should I even ask for help? 

Spoiler alert: watch out for Context Buddy!

Documentation

Issue Tracking System

  • Some tickets already archived
  • Too many different issues to find something useful
  • Vague issue description
  • No information about the solution
  • Sometimes not connected to the source code at all (no MR link)

Version Control System

$ git log --all --pretty=format:"%h" \
> --grep='\(^\| \)\+\(\(refactor\)\|\(rename\)\|\(move\)\|\(remove\)\)' | wc -l
2253
$ git log --all --pretty=format:"%h" --grep='^fix$' | wc -l
118
$ git log --all --pretty=format:"%h" | wc -l
53420

Spoiler alert: watch out for Context Buddy!

Source code

import cats.data.OptionT
import cats.instances.future._

def findUserById(userId: Long): OptionT[Future, User] = { /* ... */ }

def findAccountById(accountId: Long): OptionT[Future, Account] = { /* ... */ }

def getReservedFundsForAccount(account: Account): OptionT[Future, Money] = { /* ... */ }

def getReservedFundsForUser(userId: Long): OptionT[Future, Money] = for {
  user <- findUserById(userId)
  account <- findAccountById(user.accountId)
  funds <- getReservedFundsForAccount(account)
} yield funds

Source code - reality

scanf ("%d",&steps);
for (count = 0; count < steps; count++){
    static int bbk = 0, bk = 1;
    int k = bbk + bk;
    bbk = bk; bk = k;
}
  • Poorly structured
  • 5k lines long files
  • Complicated dependencies

Spoiler alert: watch out for Graph Buddy!

It all boils down to working effectively with the source code.

IDEs evolution

Turbo Pascal - 1992

Pajączek 1997

Eclipse 2001

Intellij 2012

Intellij 2019

What is really changing?

  • Various integrations straight in IDE
  • Language Server Protocol adoption (multi-language support in an easy way)
  • Advanced language support
    • refactoring
    • smart completion
    • suggestions (recently based also on AI)

Improving existing tools and bringing more context closer to the source code

Still a lot of places to improve...

contextbuddy.virtuslab.com

Meet Graph Buddy

Idea

//File A.scala
package com.virtuslab.graphbuddy
class A(a: String)
//File B.scala
package com.virtuslab.graphbuddy
class B(b: String, a: A)

AST + SemanticDB *

  • AST (scala trees, scalac AST)
    • information about the code structure
  • SemanticDB:
    • Unique stable symbols across the source code
    • Additional semantic data (signatures, types, modifiers, return types and more)

* Or we can just ask Context Buddy

Abstract Semantic Graph

  • Abstract syntax in which expression of a programming language is represented by a graph
  • Higher level of abstraction than AST

Bird's eye view

Bird's eye view

Never get lost again

Never get lost again (VSCode integration)

Appropriate scale

Find the path

3D

Possible use cases

  • Learning about the project
    • Project visualisation
    • Project evolution visualisation
  • Refactoring (Rory Graves, ScalaClean – deep code analysis)
    • Dead code elimination
    • Automatic module extraction
    • Complex dependency elimination
  • Maintaining
    • Anomaly detection (automatic with CI)
    • Architecture advices

Context Buddy:
The semantic platform

  • Provides simple API on top of languages and build tools
  • Design for cross-language usage (no AST)
  • Model is flexible enough to support non-code data (logs, unit tests results and more)

Context Buddy:
The context platform

  • Our first goal is to suggest experts to talk to
  • Next step: Reviewers suggestion [Master Thesis in progress]
  • We want to learn from local mistakes and development
  • Knowledge base about the project is ultimate goal

R&D at Virtuslab

More yet to come!

Made with Slides.com