1 / 1

The Problem

package framework; abstract class Figure { /** @vsf drawing */ protected Graphics g; /** @vsf drawing */ public abstract void draw(); }. package figures; class Circle extends Figure{ public int radius; /** @vsf drawing */ public void draw() { … } }.

Télécharger la présentation

The Problem

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. package framework; abstract class Figure { /** @vsf drawing */ protected Graphics g; /** @vsf drawing */ public abstract void draw(); } package figures; class Circle extends Figure{ public int radius; /** @vsf drawing */ public void draw() { … } } package figures; class Square extends Figure { private int size; /** @vsf drawing */ public void draw() { … } } framework/Figure>draw(Graphics) framework/Figure>g figures/Circle>draw(Graphics) framework/Figure>draw() figures/Square>draw(Graphics) figures/Circle>draw() figures/Square>draw() class framework/Figure { /** @vsf drawing */ protected Graphics g; /** @vsf drawing */ public void draw(Graphics g) { … } } class figures/Circle { /** @vsf drawing */ public void draw(Graphics g) { … } } class figures/Square { /** @vsf drawing */ public void draw(Graphics g) { … } } Programming With Crosscutting Effective Views Define a Set of Program Elements Update Source Files 1 5 • The Problem • Decomposition of programs in terms of classes and in terms of crosscutting concerns are both useful, but languages based on source files allow only a single decomposition. • A Solution • Use a tool that lets developers create virtual source files (VSFs) by gathering together declarations from multiple classes. • Virtual source files are effective views in that editing them results in corresponding changes being made to the original source code. • VSFs let developers edit cross-sections of their code while maintaining its full object-oriented structure and without the need for additional language features. The tool analyzes the differences between the Input Set I and the Output Set O to determine how the source files should be modified: Added elements: A = O – I Removed elements: R = I – O Same elements: S = I ∩ O • The user creates a set of element identifiers called the Input Set by: • Using comment tags, or • Selecting elements from • a browser, or • Writing a query 4 2 class framework/Figure { /** @vsf drawing */ protected Graphics g; /** @vsf drawing */ public void draw() { … } } class figures/Circle { /** @vsf drawing */ public void draw() { … } } class figures/Square { /** @vsf drawing */ public void draw() { … } } Parse VSF Render VSF • The tool parses the • virtual source file to • produce the • Output Set. • Unlike normal • source files, VSFs • must be parseable • in order to be saved. • The tool creates a • virtual source file • by retrieving the • source code for • every element • in the Input Set. • Special syntax is • used to identify • which source file • each block of • text belongs • to. Edit VSF 3 Doug Janzen dsjanzen@cs.ubc.ca Kris De Volder kdvolder@cs.ubc.ca Software Practices Lab Department of Computer Science University of British Columbia Vancouver, BC Canada • The user can add, change, and delete elements in the virtual • source file.

More Related