Vinay Augustine, Ph.D.


Automated Program Transformation
with srcML and LINQ
Overview


         ABB Corporate Research
         The Problem
         The Solution
               What is srcML?
               What is LINQ?
         Demonstration
         Questions
ABB Corporate Research
Industrial Software Systems (ISS)



                                                •   USA
                                                •   Germany
                                                •   Switzerland
                                                •   Poland
                                                •   Sweden
                                                •   India
                                                •   China


   Raleigh, NC
                 7 research centers worldwide
Software at ABB
What motivates us?


   Embedded Software   Software / Hardware   100% Software
                       Hybrids
Adaptive Maintenance Changes
The Problem

The Scenario
   Long-lived legacy software
   Adapt source code for new
                Compilers
                Libraries
                Environments




© ABB Group
Month DD, Year   | Slide 5
Adaptive Maintenance Changes
The Problem

The Scenario                     Resulting Issues
   Long-lived legacy software   •   Time-consuming
   Adapt source code for new    •   Error-prone
                Compilers       •   Repetitive
                Libraries
                Environments




© ABB Group
Month DD, Year   | Slide 6
Adaptive Maintenance Changes
An Example




Source: http://msdn.microsoft.com/en-US/library/vstudio/h4bcz65t(v=vs.80).aspx
© ABB Group
Month DD, Year   | Slide 7
Our Solution


                                Lightweight               srcML (fast!)
                                Multi-language
                                                                 +
                                Easy to test
                                Fast
                                                          LINQ (familiar!)
                                Familiar to developers




© ABB Group
Month DD, Year   | Slide 8
What is srcML?
(and why do we like it?)

   What is it?
                XML annotation for source code
   Why do we like it?
                Adds structure to source code
                Multilanguage
                Fast!
                Remove it to get original source!




Source: http://www.sdml.info/projects/srcml/
© ABB Group
Month DD, Year   | Slide 9
LINQ
Language INtegrated Query

   Provides SQL-like queries for C#
   Extensive IDE support in Visual Studio
   Natural for developers
   Can query XML
Demonstration


Automate an adaptive maintenance change on real software


                              Wrap all uses of “new” with a try/catch
                                             block in




Source: http://notepad-plus-plus.org/news/notepad-6.2-release-udl2.html
© ABB Group
Month DD, Year   | Slide 11
Demonstration
Steps

                              1.   Learn about “new” in srcML
                              2.   Where is “new” used?
                              3.   Find all expressions that use “new”
                              4.   Transform all “new” expressions
                              5.   Execute the transform
                              6.   Run the new notepad++.exe




© ABB Group
Month DD, Year   | Slide 12
Questions?


                              Automated Program Transformation with srcML + LINQ
                                 Fast
                                 Multi-language
                                 Easy to test
                              Go to our github page for
                              •   more information
                              •   the code
                              •   and this demonstration
                                         http://github.com/abb-iss/SrcML.NET



© ABB Group
Month DD, Year   | Slide 13
Automating Adaptive Maintenance Changes with srcML and LINQ

Automating Adaptive Maintenance Changes with srcML and LINQ

  • 1.
    Vinay Augustine, Ph.D. AutomatedProgram Transformation with srcML and LINQ
  • 2.
    Overview  ABB Corporate Research  The Problem  The Solution  What is srcML?  What is LINQ?  Demonstration  Questions
  • 3.
    ABB Corporate Research IndustrialSoftware Systems (ISS) • USA • Germany • Switzerland • Poland • Sweden • India • China Raleigh, NC 7 research centers worldwide
  • 4.
    Software at ABB Whatmotivates us? Embedded Software Software / Hardware 100% Software Hybrids
  • 5.
    Adaptive Maintenance Changes TheProblem The Scenario  Long-lived legacy software  Adapt source code for new  Compilers  Libraries  Environments © ABB Group Month DD, Year | Slide 5
  • 6.
    Adaptive Maintenance Changes TheProblem The Scenario Resulting Issues  Long-lived legacy software • Time-consuming  Adapt source code for new • Error-prone  Compilers • Repetitive  Libraries  Environments © ABB Group Month DD, Year | Slide 6
  • 7.
    Adaptive Maintenance Changes AnExample Source: http://msdn.microsoft.com/en-US/library/vstudio/h4bcz65t(v=vs.80).aspx © ABB Group Month DD, Year | Slide 7
  • 8.
    Our Solution  Lightweight srcML (fast!)  Multi-language +  Easy to test  Fast LINQ (familiar!)  Familiar to developers © ABB Group Month DD, Year | Slide 8
  • 9.
    What is srcML? (andwhy do we like it?)  What is it?  XML annotation for source code  Why do we like it?  Adds structure to source code  Multilanguage  Fast!  Remove it to get original source! Source: http://www.sdml.info/projects/srcml/ © ABB Group Month DD, Year | Slide 9
  • 10.
    LINQ Language INtegrated Query  Provides SQL-like queries for C#  Extensive IDE support in Visual Studio  Natural for developers  Can query XML
  • 11.
    Demonstration Automate an adaptivemaintenance change on real software Wrap all uses of “new” with a try/catch block in Source: http://notepad-plus-plus.org/news/notepad-6.2-release-udl2.html © ABB Group Month DD, Year | Slide 11
  • 12.
    Demonstration Steps 1. Learn about “new” in srcML 2. Where is “new” used? 3. Find all expressions that use “new” 4. Transform all “new” expressions 5. Execute the transform 6. Run the new notepad++.exe © ABB Group Month DD, Year | Slide 12
  • 13.
    Questions? Automated Program Transformation with srcML + LINQ  Fast  Multi-language  Easy to test Go to our github page for • more information • the code • and this demonstration http://github.com/abb-iss/SrcML.NET © ABB Group Month DD, Year | Slide 13

Editor's Notes

  • #4 ABB -> ABB Corporate Research, 7 centers -> Industrial Software Systems (ISS) research group. Raleigh NC. Located on North Carolina State University‘s campusAt ISS, all topics related to software lifecycle: RE to SMABB is one of the proud sponsors of FSE, booth. <-> Where do we have software in ABB?
  • #5 1) Robotics 2) Control and automation systems 3) Recent acquisitions- Large software development teams within ABB ranging from embedded systems, to control systems, to substation automation, to smart grids- Good part of the software written in C/C++Mostly C/C++Also Java, C#, and other languages. <-> Today, I am going to talk about a change impact analysis framework we developed for C/C++ programs. Make pictures suck less
  • #10 Originalsource code: same whitespace, directories, filenames, etc.Developed at KSU/uakron
  • #11 Why are we doing this?Here’s srcML? What do you do with it?
  • #12 Will do this on notepad++ vs. 6.2Can’t show you ABB product, but here it is running on an open source text editor.