New research at MIT suggests that a new category of tool could help programmers get to grips with existing projects by analysing the way objects connect.
Given that Object Oriented Programming has been around for 40 years or more, we should by now have worked out the basics of how to use objects efficiently, but no.
If you have ever joined a mature object-oriented project then you will know that the time it takes to learn how it all fits together and become a productive member of the team is usually quite long. This is a worse problem when it comes to open source software which usually has almost no documentation on the assumption that the code speaks for itself - it doesn't until you know it like the back of your hand. One of the advantages claimed for open source is that you can "tweak" it by adding a few lines of code to make it do whatever you want, so this steep learning curve is an embarrassment.
So what is it that makes finding out how an object-oriented project works so difficult?
The answer might be that you have to know what objects exist, and how they were designed to interact, before the whole thing make sense. It is very difficult to home in on one or two objects to get a particular task done.
MatchMaker is a new tool invented by MIT’s Computer Science and Artificial Intelligence Laboratory and described in a paper to be presented at this year's SPLASH conference, an annual event from that embraces all aspects of software construction and delivery, and that joins all factions of programming technologies.
MatchMaker uses the DeLight dynamic trace program to work out the connections between objects. From this data it will automatically generate the glue code needed to make the objects function. This usually involves instantiating new objects, making API calls and overriding methods.
This sounds easy but read the paper to discover how much work has to be done to reverse engineer the relationships.Heuristics are used to guess the relationships between objects based on the calling patterns that occur while the program is being used.
You can't help but think that it might be easier if the creators of the code had taken the time to do some documentation. However, the paper argues that the typical "easy" documentation methods such as class-based documentation, e.g. JavaDoc, is particularly useless because it focuses on single classes and not interactions between classes. The obvious solution - the tutorial or How-to - is equally not a good solution because, as well as being time consuming, it is error prone. Then there is the problem of discovering whether the tutorial or how-to relates to the precise problem you are trying to solve. The argument is that being able to input a query into MatchMaker, and having it generate the code needed to connect the objects together, at the very least gives you a starting point which can be elaborated in a full solution.
MatchMaker was tested on the codebase of the Eclipse IDE and it proved to save roughly 50% of the time needed for a beginner to solve a specific problem. These are impressive results and they seem to be reasonably general. However, Eclipse is a very special project. It is almost obsessively object-oriented and it makes use of the OSGi core framework specification to create runtime objects as services that can interact in very specific ways. This makes it untypical of large object-oriented applications. It is arguably harder for the beginner to work out how its objects interact and it is also easier for an automatic tool to do the job. In short, if MatchMaker is a solution to a problem it has to be demonstrated that it works on a wider range of project types than just the OSGi-based Eclipse.
It is clear however, that if open source is to deliver on its promise of being modifiable in a casual sort of way, we do need tools like MatchMaker. An alternative solution would be tools that make really useful documentation easier to construct.
Data-Driven Synthesis for Object-Oriented Frameworks
If you would like to be informed about new articles on I Programmer you can either follow us on Twitter or Facebook or you can subscribe to our weekly newsletter.