Guessing what may be: Static Analysis of Dynamic Languages

Guessing what may be: Static Analysis of Dynamic Languages

In cooperation with our research partners in academia, we offered a bachelor thesis in the field of program analysis. 

The recently finished thesis of a Bachelor student who was supervised by Axivion investigated static analysis of Python programs by creating a program dependency graph. Features like "late bound everything", "monkey patching", missing entry points or the fact that "everything is a mutable object" pose a challenge in static modelling of dependencies and make it hard or impossible to create an exact dependency graph. 

Anyway, a useful approximation of the program structure of Python code can still be easily achieved if we make the assumption that runtime modification of the code is possible but not the first thing programmer's think about when coding. With this assumption in mind, a full analysis of Python projects was build based on Python's AST module and Axivion Suite's API and GUI in less than three months. 

Dependency Graph for the static analysis of the static analyzer.

The fun part of this thesis was the iterative and incremental approach allowing visual feedback to the student by using Axivion's extensible GUI. As soon as the implementation of the first bits of the parser were ready, the results could be visualized and inspected. And by implementing the static analysis itself in Python, continuous self-application was possible... "if it is worth doing it, do it to itself".

The performance of the basic analysis steps was surprisingly good. Even though it is an interpreted language, it takes just minutes to analyze the entire Python Standard Libraries. First impressions on the software erosion aspects show that architecture analysis, dead code, or cycle detections in Python programs were successful and also give insights to Python programmers.

We are looking forward in evaluating and extending the prototype and analysing Python code in the future.

And of course - looking forward to the future thesis' results.

To get more insights into my work at Axivion, register for our newsletter, visit our blog or follow us on LinkedIn and Twitter.

Cyril Benkimoun

Consultant - Helping engineers to efficiently monitor theirs projects

4 年

Really interesting ! I would be interested to try this on my own python code !

Sebastian Rummler

we are stopping software erosion

4 年

Beeindruckend, wie ihr das in so kurzer Zeit hinbekommen habt. Bin schon gespannt, was für tolle Projekte noch kommen werden, die auch immer unsere Produktentwicklung bereichern und inspirieren. Weiter so!

回复

要查看或添加评论,请登录

Daniel S.的更多文章

  • "More is better?" or Efficiency vs. Effectivity

    "More is better?" or Efficiency vs. Effectivity

    From time to time, I have conversations with colleagues or customers about the runtimes and precision of static code…

  • How much is the {...}?

    How much is the {...}?

    If you work on a software project with safety and/or security background, you will have to use some sort of programming…

    1 条评论
  • Coding Guidelines How-To (1st Thoughts)

    Coding Guidelines How-To (1st Thoughts)

    For use in Safety or Security, a range of Standard Programming Guides is available. In automotive industry, MISRA and…

  • Professional View on "Quality"?

    Professional View on "Quality"?

    There are many definitions of the term quality. On one hand, we have the common sense definitions of "high quality…

  • Test the test: testing programming guides

    Test the test: testing programming guides

    The implementation of an automatic coding guidelines check produces code; in the case of the Axivion Suite mostly…

  • Industrial Software Development: Engineering vs Artistry

    Industrial Software Development: Engineering vs Artistry

    Is software development a boring, purely facts and figures based, rigid and sometimes painful undertaking? Where is the…

社区洞察

其他会员也浏览了