An oracle for object-oriented programmers
October 7, 2011 by Larry Hardesty
In the last 40 years, the major innovation in software engineering has been the development of what are called object-oriented programming languages. Objects are, effectively, repositories for the computational details of a program, which let the programmer concentrate on the big picture. A complex computer program, with millions of lines of code, can be distilled into some fairly intuitive interactions between objects.
For programmers building a large application from scratch, object-oriented programming is a boon, allowing them to add new functions or make major revisions by changing just a few lines of code. But for a programmer dropped into the middle of a massive development project, trying to navigate the thicket of existing objects can be bewildering. Learning what the objects are and what they do might take days or even weeks.
At the Association for Computing Machinerys SPLASH conference at the end of the month, researchers from MITs Computer Science and Artificial Intelligence Laboratory (CSAIL) will present a new system that automatically determines how objects in a large software project interact, so it can inform latecomers which objects they will need to design certain types of functions. The system could be of particular use to programmers working with open-source software, whose licensing terms require that its underlying code be publicly disclosed. Someone wishing to simply add a function to a common open-source program, for instance, may not want to spend the week it takes to get up to speed on all the programs objects.
Part of the promise of open source is that if you dont like what it does, you can go in and change it, says Armando Solar-Lezama, the NBX Career Development Assistant Professor of Computer Science and Engineering, who led the work. But if you have this huge learning curve, then youre not going to be able to do that. Youre going to end up with a small group of experts who go and do all the stuff, and everyone else just uses it.
Objectivity
The idea of the object is easiest to understand when the programmers object a cluster of data and a set of associated functions corresponds to a virtual object on-screen. A programmer wishing to add a new window to an application, for instance, simply writes a line of code calling up a new window object; the window comes complete with things like scroll bars and size-adjustment tabs and a display line for text. If the programmer wants to add a button to the window, she calls up a new button object.
But after that, things can get more complicated. To describe the layout for the window, the programmer may have to invoke an object called Layout; to enable the button to register mouse clicks, she may have to invoke an object called EventListener. These dont appear on-screen as virtual objects, but in the programmers sense, theyre objects nonetheless.
In some respects, this is a great design, Solar-Lezama says. Its beautifully engineered to allow you to just take out little pieces of the functionality and replace them without having to go and write lots of code. But the price of that is that you have to know how it works before you can use it.
Solar-Lezama and his students Zhilei Xu and Kuat Yessenov have developed a new system they call Matchmaker, because it takes as input the names of two objects and describes how to get them to interact with each other. To demonstrate how it works, the researchers applied it to an open-source program called Eclipse, which computer scientists use to develop programming tools for new computer languages.
In the Eclipse framework, the window that displays code written in the new language is called an Editor; a function that searches the code for symbols or keywords is called a Scanner. That much a seasoned developer could probably glean by looking over the Eclipse source code. But say you want to add a new Scanner to Eclipse, one that allows you to highlight particular symbols. It turns out that, in addition to your Editor and Scanner objects, you would need to invoke a couple of objects with the unintuitive names of DamageRepairer and PresentationReconciler and then overwrite a function called getPresentationReconciler in yet a third object called a SourceViewerConfiguration.
With Matchmaker, the developer would simply type the words editor and scanner into the query fields, and the program would return the names of the objects that link them and a description of the modifications required to any existing functions.
Observe and detect
Matchmaker builds up its database of object linkages in a programs source code by monitoring the programs execution. In the case of Eclipse, it noticed that every time a Scanner was invoked, so were the other objects.
On occasion, Matchmakers inferences may turn out to be wrong. But even in those cases, Solar-Lezama argues, some guidance is better than none. To test that thesis, Solar-Lezama and his colleagues did a user study with eight programmers new to Eclipse. All of them were asked to perform the same task, which required linking up two different types of objects. Four of them were allowed to use Matchmaker, and four werent. Moreover, the example was specifically chosen so that the instructions provided by Matchmaker were incomplete: They left out one crucial step. Nonetheless, Solar-Lezama says, the programmer who completed the task most quickly without Matchmaker still took longer than the slowest of the programmers who used it.
I think the user study is the linchpin that makes this seem like its got real practical implications, says Jeff Foster, an associate professor at the University of Maryland whos part of the Department of Computer Sciences Programming Languages group. If you can hand the tool to somebody else and they can be better programmers when theyre using it, thats a great result.
Foster points out that Matchmaker cant answer all the questions that a programmer new to an application might have. Matchmaker is useful, he says, in cases where you can guess that you needed an X and Y, and you could find the names of those components, and you can ask how theyre connected. But theres a whole other set of questions where you dont even know what components to use.
Still, Foster says, in the instances where Matchmaker is applicable, youre going to get result thats vastly superior. Youre going to get a result in seconds or minutes instead of having to search on Google, filter out a lot of bad answers, figure out what people meant when they explained various things if the tool works for the problem, its very useful.
This story is republished courtesy of MIT News (http://web.mit.edu/newsoffice/), a popular site that covers news about MIT research, innovation and teaching.
Provided by
Massachusetts Institute of Technology
-
From lemons to lemonade: Reaction uses carbon dioxide to make carbon-based semiconductor,
32 comments
-
Thioridazine kills cancer stem cells in human while avoiding toxic side-effects of conventional cancer treatments,
3 comments
-
SpaceX private rocket blasts off for space station (Update),
42 comments
-
Climate scientists say they have solved riddle of rising sea,
31 comments
-
SpaceX capsule has 'new car' smell, astronauts say (Update),
4 comments
-
Ideas to mitigate risk of 911 calls being misdirected
May 24, 2012
-
Live scribe pen?
May 10, 2012
-
Shallow water flow simulation
May 07, 2012
-
Tablet for taking notes?
May 05, 2012
-
Best fit tablet for me?
May 05, 2012
-
Measure of Informaton
May 04, 2012
- More from Physics Forums - Computing & Technology
More news stories
Browser wars flare in mobile space
The browser wars are heating up again, but this time the fight is for dominance of the mobile Internet.
9 hours ago |
5 / 5 (1) |
3
Probability of contamination from severe nuclear reactor accidents is higher than expected: study
Catastrophic nuclear accidents such as the core meltdowns in Chernobyl and Fukushima are more likely to happen than previously assumed. Based on the operating hours of all civil nuclear reactors and the number ...
Technology / Energy & Green Tech
May 22, 2012 |
3.6 / 5 (22) |
56
|
SpotterRF debuts Radar Backpack Kit (w/ Video)
(Phys.org) -- SpotterRF has announced a special radar backpack kit designed to enhance situational awareness for soldiers on the ground. The company says its special radar is designed for warfighters as part ...
HyperSolar shows dirty water no barrier to power world
(Phys.org) -- The Santa Barbara, California, company, HyperSolar, is set to transparently share the ups and downs of its research experiences toward the companys ultimate vision, successfully producing ...
Tesla to launch electric sedan in US on June 22
Tesla Motors said Tuesday it would begin deliveries of "the world's first premium electric sedan" on June 22, slightly ahead of schedule.
Technology / Energy & Green Tech
May 22, 2012 |
4.5 / 5 (12) |
18
Land and sea species differ in climate change response: study
(Phys.org) -- Marine and terrestrial species will likely differ in their responses to climate warming, new research by Simon Fraser University and Australia’s University of Tasmania has found.
Almost half of new vets seek disability
(AP) -- America's newest veterans are filing for disability benefits at a historic rate, claiming to be the most medically and mentally troubled generation of former troops the nation has ever seen.
'Unzipped' carbon nanotubes could help energize fuel cells, batteries
Multi-walled carbon nanotubes riddled with defects and impurities on the outside could replace some of the expensive platinum catalysts used in fuel cells and metal-air batteries, according to scientists at ...
T cells 'hunt' parasites like animal predators seek prey, study shows
By pairing an intimate knowledge of immune-system function with a deep understanding of statistical physics, a cross-disciplinary team at the University of Pennsylvania has arrived at a surprising finding: T cells use a movement ...
Computer model used to pinpoint prime materials for efficient carbon capture
When power plants begin capturing their carbon emissions to reduce greenhouse gases and to most in the electric power industry, it's a question of when, not if it will be an expensive undertaking.
Change in developmental timing was crucial in the evolutionary shift from dinosaurs to birds: study
At first glance, it's hard to see how a common house sparrow and a Tyrannosaurus Rex might have anything in common. After all, one is a bird that weighs less than an ounce, and the other is a dinosaur that ...
Oct 07, 2011
Rank: 5 / 5 (2)
Try months.
And for really big projects using large frameworks you can only hope to ever graps a subset of object/object interactions and their capabilities.
That's not entirely true. You have to know what interface you have to provide fo your new object so that it can replace another object. This is (or should be) provided in the interface description - which is already common practice and without which no largish project can survive for long without becoming unmanageable.
But generally such representations of object interdependencies as described in the article are helpful. But they are not particularly new. There's a whole host of tools out there that already do this to some degree.
The main (and unsolved) problem is often to find out _what_ object you need to replace/derive from in the first place.
Oct 07, 2011
Rank: 5 / 5 (2)
Oct 07, 2011
Rank: 5 / 5 (5)
Oct 07, 2011
Rank: 5 / 5 (2)
Oct 07, 2011
Rank: 5 / 5 (1)
I'm not even a professional programmer, but any time I screw around and write a program, or even a script, trigger or level design for a game or some other goofy thing, I comment everything.
I comment the beginning and end of control structures, functions, objects, variables, etc. Explain what it does, what the input parameters are, what the output should be, and sometimes why I did it that way instead of some other way.
Oct 07, 2011
Rank: 4.6 / 5 (32)
Oct 07, 2011
Rank: 5 / 5 (2)
Erlang
I have to disagree. Systems that do graphical representations of large frameworks and their interdependencies (like you can do with doxygen) are extremely helpful. Just look at the documentation of Qt or VTK. As a novice you can actually dive right in with relatively modest effort.
That said: Such good documentation treatment is (unfortunately) far from the norm.
In my (programming) day spaghetti code was and is a disease. And that 'day' already lasts for 20 years. Anyone who uses a 'goto' (or similar control structure) should be shot. Or better:
diediedie:
shoot(programmer);
goto diediedie;
Oct 07, 2011
Rank: 5 / 5 (3)
Show me a example output.
Then,
Show me the doxy.
Show me the a Class level Diagram.
Show me the Use Case Diagram.
Let me decide.
Oct 07, 2011
Rank: 4.6 / 5 (30)
Now I did gt to use COBOL,... once finished documenting, sometimes I forgot the code.
Oct 07, 2011
Rank: 5 / 5 (1)
In the last 40 years, the major innovation has been software engineering PERIOD
Oct 07, 2011
Rank: 4 / 5 (1)
Oct 07, 2011
Rank: 4.6 / 5 (29)
Are you referig to my comment? If so, yes, I know what object oriented programming is as I have written extensively in C(plus plus)* ,.. not in the above case however.
* editor does not allow the plus symbol.
Oct 07, 2011
Rank: not rated yet
Oct 07, 2011
Rank: 3.3 / 5 (3)
It's just an application that attempts to help the programmer figure out how to use a library or update and edit the objects of an existing program if they are not familliar with it.
Like if a company hired you to add a new feature to an application, and you have no idea how any of the existing functions and objects work, and let's say the comments aren't very good, this is supposed to help you figure it out.
Predictive text is quite different, and has actually been in c family editors and compilers for at least 10 or 11 years now...
Oct 07, 2011
Rank: 5 / 5 (1)
Software tells hardware what to do. What a shame that nobody has invented a way to show humans what software is doing.
Oct 07, 2011
Rank: 5 / 5 (5)
You can certainly do just that with a variety of tools, the problem is that engineering a complex system is by definition complex, so any tool used to simplify will also simplify the result... it's the difference between building a machine from scratch starting with the basic elements on the periodic table and building one out of Legos. The lego version might APPROXIMATE the model you were looking for, but to make it exactly what you want you have to get your hands dirty with chemistry and physics.
Oct 07, 2011
Rank: 5 / 5 (2)
Just for fun I searched for "goto" in the project I have open right now (~10 million line optical time domain reflectometer firmware) and came up with 29 occurrences, 6 of them were mine, the rest were in libraries I'm using.
Oct 07, 2011
Rank: 5 / 5 (1)
Oct 07, 2011
Rank: 5 / 5 (3)
Oct 08, 2011
Rank: 2.3 / 5 (6)
Oct 08, 2011
Rank: 5 / 5 (1)
Oct 08, 2011
Rank: 4 / 5 (2)
Ultimate is already the highest version (and costs about 12000$ a pop).
I believe the Architect version already has these tools, though.
Certainly it depends on the application. Spaghetti code is probably fine if all of the below apply:
- the program is exteremly small
- developed by one person
- never needs to be serviced
- never needs to be upgraded
- requires no documentation (i.e. will never be passed on to another person to service/upgrade)
- deployed on hardware where memory is at a premium.
- written in a language that does not support OO
- does not have to pass am industrial testing process or conform to stringent laws (medical, aviation, ... )
But using any kind of higher language and not using OO is just plain foolish.
Oct 08, 2011
Rank: not rated yet
Oct 08, 2011
Rank: 5 / 5 (3)
Call me romantic, but I was enjoying myself 30-40 years ago while reading the code and comments written by DEC's systems software developers of the RSX-11M operating system. Those people were not only clever, they were also so witty I'd frequently laughed outloud over their code. My point is: on top of being useful, comments add a very important humane touch to the product.
Ever since then, I was commenting my code generously, as a token of my benevolence towards happless people to inherit my code - which doesn't necessarilly mean my code was bad.
Oct 08, 2011
Rank: 3 / 5 (2)
Regarding the code comments, the OOP design encapsulates the functionality into small blocks, which shouldn't require a supervision often - so that the commenting of code isn't so important here, with compare to the documentation of interfaces. I do prefer compact and brief code to, so I place my comments to the right side of screen, where they still remain available, but don't interfere the code flow.
Oct 09, 2011
Rank: 5 / 5 (1)
Oct 09, 2011
Rank: 2.5 / 5 (2)
Oct 09, 2011
Rank: 5 / 5 (1)
Oct 16, 2011
Rank: not rated yet