Graph transformation-based Refactorings using Fujaba

Size: px
Start display at page:

Download "Graph transformation-based Refactorings using Fujaba"

Transcription

1 Graph transformation-based Refactorings using Fujaba Leif Geiger 1 Software Engineering Group 1, Department of Computer Science and Electrical Engineering, Wilhelmshöher Allee 73, Kassel, Germany leif.geiger@uni-kassel.de Abstract. This paper describes how refactorings can be implemented using Fujaba. It shows how the given meta model can be imported into Fujaba, how the given GXL files can be loaded and stored, how the refactorings can be implemented and how user interaction is done using Fujaba. Additionally, some benchmarks are presented which shows the usability in real world applications. 1 Import of the meta model First thing needed to implement refactorings in Fujaba is to import the given meta model for the Java Program Graph. This meta model was given as ArgoUML file and as exported XMI. Since Fujaba is not able to import both of the formats we have to find a different way. We converted the ArgoUML file to an ECore model using the Argo2Ecore plugin 1 for eclipse. From such ECore model we generated Java code which could then be imported into Fujaba using the binary import command offered by Fujaba s Refactoring plugin. This way we got the given meta model as class diagram in Fujaba which could then be used to implement the refactorings. 2 Loading and saving of the GXL files Next step is the loading of the instance graph which is given in GXL format for this case study. For this two possibilities exist. First, one could import the GXL file into a Fujaba story pattern and create a method from this pattern which creates the given instance graph at runtime. The second possibility is to write a generic GXL loader which loads the GXL file at runtime and creates the instance graph described in the file then. We choose the second possibility because it is more flexible since one just need to open a new file if one wants 1

2 2 Geiger to load a different program graph instead of a whole import, generate, compile, run cycle. To be able to work on a GXL file we first have to convert it to a graph representation. We used the JAXB compiler 2 for this task. JAXB takes an XML schema as input and creates Java classes for the different types described in this schema. It also creates a Unmarshaller and a Marschaller that is able to load an instance of the XML schema into a instance graph using the created classes and to serialize an instance graph back to XML. The created classes can again be imported to Fujaba using the binary import. Then we need to convert the generic GXL instance graph into the Java Program Graph. The GXL graph e.g. contains nodes of type Node which type attribute points to another Node object which name attribute is Package. For such a structure an object of type Package has to be created in the Java Program Graph. Therefor a mechanism is needed that allows reflective creation of Java classes and reflective changing of attributes since in the example mentioned above the String Package has to be used as class name. We used the feature abstraction module for this purpose S07 since it offers reflective access to many meta models such as Fujaba generated models, EMF models or JMI models. Using this technologies we are able to load a Java Program Graph from GXL. If the Program Graph is changed, we use the same mechanism to convert it back to a GXL graph and then use the JAXB marshaling mechanism to serialize it back to GXL. 3 Refactoring rules As we now have the needed meta model and a mechanism to create an instance graph from a given GXL file, we can now implement refactoring rules that work on this instance graphs. Till now we implemented the Encapsulate field and the Pull up method refactoring. Every refactoring is implemented in a subclass of AbstractRefactoring and has at least the methods checkprecondition() and perform() whereas the parameters of this two methods are the parameters specified for the refactoring in the case study proposal. Figure 4 shows the checkprecondition() method for the EncapsulateField class. In Fujaba a UML activity diagram models the control flow of a given method. Each activity may contain graph transformation visualized as UML collaboration diagram. Left-hand side and right-hand side are combined in Fujaba using create and destroy stereotypes. The first activity in figure 4 now checks if the variable passed as parameter really is a field of the passed class. If this is not the case the method is left and is returned. Otherwise a method is searched which has the same name as the setter or getter method to create and has a different static property as the passed field. If such a method is found the refactoring can t be applied and so the method is again left with. Otherwise all preconditions are met and so 2

3 Refactorings using Fujaba 3 is returned. Nodes where the class name is not shown are so called bound objects as e.g. the two nodes in the first activity. Such nodes are not searched but instead are reused from previous matches or given by parameters. Note, that the precondition does not check for a valid signature of a probably existing access method since this keeps the method simpler and was not asked in the case study proposal. Figure 6 shows the method that really does the Encapsulate field refactoring. In the first activity the method described above that checks the precondition is called and if it passes the refactoring is actually applied. The second activity binds the local variables type and visibility and the third activity sets the visibility of the field to private. The fourth activity checks if a setter method with the correct signature exists. We use negative objects (objects that are crossed-out) to ensure the right number of parameters here. If no setter method is found in that activity, one is creates in the activity right to it. Note, that in that activity the node type is displayed with a dashed border. That means that that node is an optional node because a return type can exist but is null if the return type is void. So, the type edge from the param node is only creates if such a type object exists. To set the visibility of the setter object another method is called which handles the user interaction. This is discussed in the next chapter. The next two activities create a getter method if needed. The next activity is a so-called for-each activity. Such an activity performs the graph transformation for every possible match. This activity calls the encapsulate() method for every Update node that updates the given field and that is not inside the setter body. The check if this operation is inside the setter body is done using a so-called path expression (the double arrow). The used path expression revexpression* visits every node that is reachable by traversing the expression edge in opposite direction zero to many times starting at the update node. If none of the found nodes is the previously bound setterblock node the pattern was applied fully and so the method call is performed. The match is skipped otherwise. The next activity does the same for the Access nodes. Note, that we extracted the functionality that really encapsulates an Access or Update node to another method to avoid code duplication. Figure 5 shows this method. 4 User interaction To visualize the Java Program Graph we use the object browser edobs GZ06. edobs visualizes the Java heap structure as graph. Since it also uses the feature abstraction layer mentioned above, edobs is able to access various models. Figure 1 shows an excerpt of the Java Program Graph in edobs. This generic presentation of the Program Graph is usable but due to its huge size somehow hard to view. It would be possible to create a Swing or SWT interface which better displays the important parts of the graph. Such UI can easily be integrated

4 4 Geiger with the Fujaba generated code since Fujaba generates standard Java code. Due lack of time, we have not yet written such a UI. Fig. 1. edobs visualzing the Java Program Graph To now perform a refactoring one has to create an object of the class implementing that refactoring in edobs. Then one may call the perform() method on that object. edobs asks for the parameter of that method. Given a set of parameters the method is then executed. Figure 3 shows a screenshot of edobs parameter dialog. The case study not only asks for a way to interactively invoke refactorings but also to ask for user feedback during the refactoring process. We solved this task by implementing a small Swing UI and integrated it into the Fujaba graph transformation rules. This UI can either be generated using UI editors as the eclipse Visual Editor or coded by hand. Figure 7 shows the askforvisibility() method that decides which visibilities for the access methods are possible and then if there is more than one possibility asks the user which one to choose. The last activity in Figure 7 contains the Java code pasted from a UI editor. This code opens a dialog as the one shown in Figure 3 during a refactoring.

5 Refactorings using Fujaba 5 Fig. 2. Method call in edobs Fig. 3. Visibility dialog shown during a refactoring 5 Performance The presented refactoring solution is fast enough to be usable in real world applications. We benchmarked it using the GXL file for the simplified example in version 1.0. The benchmarks were performed on a Pentium M with 1.8GHz, 2GB Ram under Java 1.6 on a Windows XP system. Loading of the GXL file takes approximately 2000ms. Applying the Encapsulate field refactoring on all possible fields (12) takes 110ms. Applying the Pull up method refactoring

6 6 Geiger on all possible methods (4 out of 5) 3 takes 120ms. Writing the result back to file takes 320ms. edobs is fast enough to display all nodes of the example file in less than seconds. But to work fluently with edobs, e.g. move around nodes etc., one has to disable the shortest path edge layouter and use a trivial node to node layouter. Otherwise edobs reacts rather slowly. 6 Conclussions This paper presented a solution to the refactoring case study using Fujaba. It shows that the more sophisticated features of Fujaba such as negative and optional nodes and edges, path expressions, for-each activities are really useful to create understandable rules. The possibility to model complex control flow and to extract subfunctionality to methods is a must-have when implementing such rather complex refactorings. The possibility to easily integrate external Java libraries such as JAXB, the feature abstraction layer or Swing is a real advantage for this case study. The code generated by Fujaba is definitely fast enough to be used also on big program graphs. Additionally edobs offers a graph editor and browser which is fast enough to handle such big graphs. References FNT98 T. Fischer, J. Niere, L. Torunski: Konzeption und Realisierung einer integrierten Entwicklungsumgebung für UML, Java und Stroy-Driven-Modeling (german), Diploma thesis, Universität-Gesamthochschule Paderborn, Fu07 Fujaba Homepage, Universität Paderborn S07 C. Schneider: CoObRA: Eine Plattform zur Verteilung und Replikation komplexer Objektstrukturen mit optimistischen Sperrkonzepten (german), PhD Thesis, GZ06 L. Geiger, A. Zündorf: edobs - Graphical Debugging for eclipse, 3rd International Workshop on Graph-Based Tools (GraBaTs), The example GXL file contains only one generalisation in contrast to the Java source code.

7 Refactorings using Fujaba 7 7 Appendix 7.1 Rules of EncapsulateField EncapsulateField::checkPrecondition (container: Class, var: Variable, gettername: String, settername: String, useaccessors: Boolean): Boolean // does the variable belongs to the given container? var container // if a setter or getter is found that has a different static property then the refactoring can't be applied container body:methodbody method :Operation isstatic!= var.isisstatic() gettername.equals (method.getname()) settername.equals (method.getname()) Fig. 4. checkprecondition() method for the Encapsulate field refactoring EncapsulateField::encapsulate (container: Class, accessmethod: Operation, accessor: Expression, useaccessorsalways: Boolean): Void else containingclass:class containingbody:methodbody container useaccessorsalways accessor revexpression* containingblock:block accessor call :Call actualparameter parent :Expression expression expression child:expression actualparameter expression actualparameter settercall :Call link accessmethod Fig. 5. Helper method to encapsulate a update or access

8 8 Geiger Fig. 6. perform() method for the Encapsulate field refactoring

9 Refactorings using Fujaba 9 EncapsulateField::askForVisibility (visibility: String, name: String): String "public".equals (visibility) else visibility 1: StringArray choice := nul "private".equals (visibility) 1: choice := new String "public", "default", "protected", "private" else 1: choice := new String "public", visibility visibility final JDialog dialog = new JDialog(); dialog.settitle("visibility for " + name); JRootPane rootpane = dialog.getrootpane(); JPanel panel = new JPanel(); panel.setlayout(new FlowLayout()); rootpane.setlayout(new BorderLayout()); rootpane.add (BorderLayout.CENTER, panel); ButtonGroup group = new ButtonGroup(); for (String text : choice) JRadioButton button = new JRadioButton(text); button.setselected(text.equals(visibility)); group.add(button); panel.add(button); JButton button = new JButton("OK"); button.addactionlistener(new ActionListener() public void actionperformed(actionevent e) dialog.setvisible(); ); rootpane.add(borderlayout.south, button); dialog.setmodal(); dialog.pack(); Dimension screensize = dialog.gettoolkit().getscreensize(); Dimension size = dialog.getsize(); int y = (screensize.height - size.height) / 2; int x = (screensize.width - size.width) / 2; dialog.setlocation (x, y); dialog.setvisible(); Enumeration<AbstractButton> elements = group.getelements(); while (elements.hasmoreelements()) AbstractButton abstractbutton = (AbstractButton) elements.nextelement(); if (abstractbutton.isselected()) visibility = abstractbutton.gettext(); break; Fig. 7. Method with user interaction

10 10 Geiger 7.2 Rules of PullUpMethod PullUpMethod::checkPrecondition (source: Class, : Class, method: MethodBody, makeabstract: Boolean, keepmethods: HashSet): Boolean source _extends* method op:operation type type:classifier name!= source.getname() samebody: MethodBody sameop :Operation signature(sameop).equals(signature(op)) revextends* subclass : Class subop type type method each time signature(sameop).equals(signature(op)) name subop:operation == op.getname() subbody:methodbody end method block : Block expression* expression :Expression each time test (expression, ) end Fig. 8. checkprecondition() method for the Pull up method refactoring

11 Refactorings using Fujaba 11 PullUpMethod::test (expression: Expression, container: Class): Boolean access := (Access) expression link var : Variable access _this == update := (Update) expression link var : Variable update _this == parent :Access _this == call := (Call) expression link op:operation var clazz :Class xpression expression call _this == parent :Access _this == expression call revextends* container maybe container == clazz op _interface :Interface container revextends* superclass :Class implements _interface maybe container == superclass op body:methodbody clazz :Class maybe container == clazz revextends* container Fig. 9. Helper method to for checkprecondition()

12 12 Geiger PullUpMethod::perform (source: Class, : Class, method: MethodBody, makeabstract: Boolean, keepmethods: HashSet): Boolean method op: Operation checkprecondition (source,, method, makeabstract, keepmethods) else makeabstract method isabstract := newop := copyoperation( op, ) isabstract := source revextends* subclass :Class each time subclass keepmethods name subop:operation == op.getname() subbody:methodbody subop link subbody link op call :Call end subop visibility == "private" visibility := "protected" makeabstract revextends* superclass :Class isabstract == extends each time newop := copyoperation( op, subclass newbody:methodbody subclass :Class isabstract == newblock :Block else subop:operation name == op.getname() subbody:methodbody maybe == superclass end // TODO "use destination type where possible" Fig. 10. perform() method for the Pull up method refactoring

13 Refactorings using Fujaba 13 PullUpMethod::copyOperation (op: Operation, : Class): Operation newop :Operation newbody:methodbody isabstract := op.isisabstract() isstatic := op.isisstatic() name := op.getname() isfinal := op.isisfinal() visibility := op.getvisibility() op type type type:classifier op parameter param : Parameter type newop parameter type newparam :Parameter type:classifier end newop Fig. 11. Helper method that copies a operation PullUpMethod::signature (op: Operation): String 1: String signature := op.getname() + "(" op parameter param :Parameter type classifier :Classifier 1: signature := signature + classifier.getname() + "," end signature + ")" Fig. 12. Helper method that calculates a operation s signature

Statechart Modeling with Fujaba

Statechart Modeling with Fujaba GraBaTs 04 Preliminary Version Statechart Modeling with Fujaba Leif Geiger Albert Zündorf University of Kassel, Software Engineering Research Group, Wilhelmshöher Allee 73, 34121 Kassel, Germany {leif.geiger

More information

EMF Code Generation with Fujaba

EMF Code Generation with Fujaba EMF Code Generation with Fujaba Leif Geiger Universität Kassel Wilhelmshöher Allee 73 34121 Kassel leif.geiger@uni-kassel.de Thomas Buchmann Universität Bayreuth Universitätsstr. 30 95447 Bayreuth thomas.buchmann@unibayreuth.de

More information

Building Distributed Web Applications based on Model Versioning with CoObRA: an Experience Report

Building Distributed Web Applications based on Model Versioning with CoObRA: an Experience Report Building Distributed Web Applications based on Model Versioning with CoObRA: an Experience Report Nina Aschenbrenner, Jörn Dreyer, Marcel Hahn, Ruben Jubeh, Christian Schneider, Albert Zündorf Kassel University,

More information

BPMN2BPEL transformation with Fujaba - a Case Study

BPMN2BPEL transformation with Fujaba - a Case Study BPMN2BPEL transformation with Fujaba - a Case Study Ruben Jubeh SE, Kassel University Wilhelmshöher Allee 73 34121 Kassel ruben.jubeh@uni-kassel.de ABSTRACT We have modeled a BPMN to BPEL synthesis transformation

More information

Using Actions Charts for Reactive Web Application Modelling

Using Actions Charts for Reactive Web Application Modelling Using Actions Charts for Reactive Web Application Modelling Nina Geiger, Tobias George, Marcel Hahn, Ruben Jubeh, Albert Zündorf University of Kassel, Software Engineering, Department of Computer Science

More information

Story Driven Testing - SDT

Story Driven Testing - SDT Story Driven Testing - SDT Leif Geiger Software Engineering, University of Kassel Wilhelmshöher Allee 73 34121 Kassel, Germany leif.geiger@uni-kassel.de Albert Zündorf Software Engineering, University

More information

Using Actions Charts for Reactive Web Application Modeling

Using Actions Charts for Reactive Web Application Modeling Using Actions Charts for Reactive Web Application Modeling Nina Geiger, Tobias George, Marcel Hahn, Ruben Jubeh, and Albert Zündorf University of Kassel, Software Engineering, Department of Computer Science

More information

Using PROGRES for graph-based program refactoring

Using PROGRES for graph-based program refactoring Using PROGRES for graph-based program refactoring Erhard Weinell RWTH Aachen University of Technology Department of Computer Science 3 (Software Engineering) Ahornstraße 55, D-52074 Aachen, Germany Weinell@cs.rwth-aachen.de

More information

Refactoring with Eclipse

Refactoring with Eclipse Refactoring with Eclipse Seng 371 Lab 8 By Bassam Sayed Based on IBM article Explore refactoring functions in Eclipse JDT by Prashant Deva Code Refactoring Code refactoring is a disciplined way to restructure

More information

Design Patterns with Fujaba Intense Course, 5th-9th October Ruben Jubeh

Design Patterns with Fujaba Intense Course, 5th-9th October Ruben Jubeh Design Patterns with Fujaba Intense Course, 5th-9th October 2009 Ruben Jubeh ruben.jubeh@uni-kassel.de Kassel University Department of Software Engineering Wilhelmshöher Allee 73 34121 Kassel Germany Timetable

More information

Supporting Modeling in the Large in Fujaba

Supporting Modeling in the Large in Fujaba Supporting Modeling in the Large in Thomas Buchmann Angewandte Informatik 1 Universität Bayreuth D-95440 Bayreuth thomas.buchmann@unibayreuth.de Alexander Dotor Angewandte Informatik 1 Universität Bayreuth

More information

Introduction to the JAVA UI classes Advanced HCI IAT351

Introduction to the JAVA UI classes Advanced HCI IAT351 Introduction to the JAVA UI classes Advanced HCI IAT351 Week 3 Lecture 1 17.09.2012 Lyn Bartram lyn@sfu.ca About JFC and Swing JFC Java TM Foundation Classes Encompass a group of features for constructing

More information

Generating JMI model transformation code from UML profile models for SDM Aligning Graph Rewriting with MDA-light

Generating JMI model transformation code from UML profile models for SDM Aligning Graph Rewriting with MDA-light Segravis School on Foundations of Visual Modelling Techniques, May 2004, Schloss Dagstuhl Generating JMI model transformation code from UML profile models for SDM Aligning Graph Rewriting with MDA-light

More information

Programming Languages and Techniques (CIS120)

Programming Languages and Techniques (CIS120) Programming Languages and Techniques (CIS120) Lecture 35 November 29, 2017 Swing II: Building GUIs Inner Classes Chapter 29 Announcements Game Project Complete Code Due: December 11 th NO LATE SUBMISSIONS

More information

The Edapt Solution for the Reengineering Case

The Edapt Solution for the Reengineering Case The Edapt Solution for the Reengineering Case Markus Herrmannsdoerfer Institut für Informatik, Technische Universität München Boltzmannstr. 3, 85748 Garching b. München, Germany herrmama@in.tum.de Abstract.

More information

Chapter 6 Introduction to Defining Classes

Chapter 6 Introduction to Defining Classes Introduction to Defining Classes Fundamentals of Java: AP Computer Science Essentials, 4th Edition 1 Objectives Design and implement a simple class from user requirements. Organize a program in terms of

More information

The SDMLib solution to the MovieDB case for TTC2014

The SDMLib solution to the MovieDB case for TTC2014 The SDMLib solution to the MovieDB case for TTC2014 Christoph Eickhoff, Tobias George, Stefan Lindel, Albert Zündorf Kassel University, Software Engineering Research Group, Wilhelmshöher Allee 73, 34121

More information

Graphical User Interfaces. Comp 152

Graphical User Interfaces. Comp 152 Graphical User Interfaces Comp 152 Procedural programming Execute line of code at a time Allowing for selection and repetition Call one function and then another. Can trace program execution on paper from

More information

Programming Languages and Techniques (CIS120)

Programming Languages and Techniques (CIS120) Programming Languages and Techniques (CIS120) Lecture 35 November 28, 2018 Swing II: Inner Classes and Layout Chapter 30 Announcements Game Project Complete Code Due: December 10 th NO LATE SUBMISSIONS

More information

Programming Languages and Techniques (CIS120)

Programming Languages and Techniques (CIS120) Programming Languages and Techniques (CIS120) Lecture 34 April 11, 2016 Swing II: Inner Classes and Layout Announcements (Review) Final exam: May 2, 3-5PM If you have two finals at the same time, you can

More information

Tiger EMF Model Transformation Framework (EMT)

Tiger EMF Model Transformation Framework (EMT) Tiger EMF Model Transformation Framework (EMT) Version 1.2.0 User Manual TU Berlin EMT Project Team: Enrico Biermann, Karsten Ehrig, Claudia Ermel, Christian Köhler, Günter Kuhns, Gabi Taentzer Email:

More information

Guessing Game with Objects

Guessing Game with Objects Objectives Lab1: Guessing Game with Objects Guessing Game with Objects 1. Practice designing and implementing an object-oriented program. 2. Use Console I/O in Java. Tasks 1. Design the program (problem

More information

Jonathan Aldrich Charlie Garrod

Jonathan Aldrich Charlie Garrod Principles of Software Construction: Objects, Design, and Concurrency (Part 3: Design Case Studies) Introduction to GUIs Jonathan Aldrich Charlie Garrod School of Computer Science 1 Administrivia Homework

More information

We are on the GUI fast track path

We are on the GUI fast track path We are on the GUI fast track path Chapter 13: Exception Handling Skip for now Chapter 14: Abstract Classes and Interfaces Sections 1 9: ActionListener interface Chapter 15: Graphics Skip for now Chapter

More information

CSE 70 Final Exam Fall 2009

CSE 70 Final Exam Fall 2009 Signature cs70f Name Student ID CSE 70 Final Exam Fall 2009 Page 1 (10 points) Page 2 (16 points) Page 3 (22 points) Page 4 (13 points) Page 5 (15 points) Page 6 (20 points) Page 7 (9 points) Page 8 (15

More information

Overview of Eclipse Lectures. Module Road Map

Overview of Eclipse Lectures. Module Road Map Overview of Eclipse Lectures 1. Overview 2. Installing and Running 3. Building and Running Java Classes 4. Refactoring Lecture 2 5. Debugging 6. Testing with JUnit 7. Version Control with CVS 1 Module

More information

Casting -Allows a narrowing assignment by asking the Java compiler to "trust us"

Casting -Allows a narrowing assignment by asking the Java compiler to trust us Primitives Integral types: int, short, long, char, byte Floating point types: double, float Boolean types: boolean -passed by value (copied when returned or passed as actual parameters) Arithmetic Operators:

More information

HOW AND WHEN TO FLATTEN JAVA CLASSES?

HOW AND WHEN TO FLATTEN JAVA CLASSES? HOW AND WHEN TO FLATTEN JAVA CLASSES? Jehad Al Dallal Department of Information Science, P.O. Box 5969, Safat 13060, Kuwait ABSTRACT Improving modularity and reusability are two key objectives in object-oriented

More information

Handout 14 Graphical User Interface (GUI) with Swing, Event Handling

Handout 14 Graphical User Interface (GUI) with Swing, Event Handling Handout 12 CS603 Object-Oriented Programming Fall 15 Page 1 of 12 Handout 14 Graphical User Interface (GUI) with Swing, Event Handling The Swing library (javax.swing.*) Contains classes that implement

More information

The TTC 2011 Reengineering Challenge Using MOLA and Higher-Order Transformations

The TTC 2011 Reengineering Challenge Using MOLA and Higher-Order Transformations The TTC 2011 Reengineering Challenge Using MOLA and Higher-Order Transformations Agris Sostaks, Elina Kalnina, Audris Kalnins, Edgars Celms, and Janis Iraids Institute of Computer Science and Mathematics,

More information

Review sheet for Final Exam (List of objectives for this course)

Review sheet for Final Exam (List of objectives for this course) Review sheet for Final Exam (List of objectives for this course) Please be sure to see other review sheets for this semester Please be sure to review tests from this semester Week 1 Introduction Chapter

More information

Leveraging UML Profiles to Generate Plugins From Visual Model Transformations

Leveraging UML Profiles to Generate Plugins From Visual Model Transformations Electronic Notes in Theoretical Computer Science 127 (2005) 5 16 www.elsevier.com/locate/entcs Leveraging UML Profiles to Generate Plugins From Visual Model Transformations Hans Schippers, Pieter Van Gorp,

More information

COP 3330 Final Exam Review

COP 3330 Final Exam Review COP 3330 Final Exam Review I. The Basics (Chapters 2, 5, 6) a. comments b. identifiers, reserved words c. white space d. compilers vs. interpreters e. syntax, semantics f. errors i. syntax ii. run-time

More information

DM503 Programming B. Peter Schneider-Kamp.

DM503 Programming B. Peter Schneider-Kamp. DM503 Programming B Peter Schneider-Kamp petersk@imada.sdu.dk! http://imada.sdu.dk/~petersk/dm503/! ADVANCED OBJECT-ORIENTATION 2 Object-Oriented Design classes often do not exist in isolation from each

More information

Java Classes, Inheritance, and Interfaces

Java Classes, Inheritance, and Interfaces Java Classes, Inheritance, and Interfaces Introduction Classes are a foundational element in Java. Everything in Java is contained in a class. Classes are used to create Objects which contain the functionality

More information

Implementing Graphical User Interfaces

Implementing Graphical User Interfaces Chapter 6 Implementing Graphical User Interfaces 6.1 Introduction To see aggregation and inheritance in action, we implement a graphical user interface (GUI for short). This chapter is not about GUIs,

More information

State Application Using MVC

State Application Using MVC State Application Using MVC 1. Getting ed: Stories and GUI Sketch This example illustrates how applications can be thought of as passing through different states. The code given shows a very useful way

More information

The JFrame Class Frame Windows GRAPHICAL USER INTERFACES. Five steps to displaying a frame: 1) Construct an object of the JFrame class

The JFrame Class Frame Windows GRAPHICAL USER INTERFACES. Five steps to displaying a frame: 1) Construct an object of the JFrame class CHAPTER GRAPHICAL USER INTERFACES 10 Slides by Donald W. Smith TechNeTrain.com Final Draft 10/30/11 10.1 Frame Windows Java provides classes to create graphical applications that can run on any major graphical

More information

Tutorial 02: Writing Source Code

Tutorial 02: Writing Source Code Tutorial 02: Writing Source Code Contents: 1. Generating a constructor. 2. Generating getters and setters. 3. Renaming a method. 4. Extracting a superclass. 5. Using other refactor menu items. 6. Using

More information

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17 List of Programs xxv List of Figures xxix List of Tables xxxiii Preface to second version xxxv PART 1 Structured Programming 1 1 Getting started 3 1.1 Programming 3 1.2 Editing source code 5 Source code

More information

Welcome to CIS 068! 1. GUIs: JAVA Swing 2. (Streams and Files we ll not cover this in this semester, just a review) CIS 068

Welcome to CIS 068! 1. GUIs: JAVA Swing 2. (Streams and Files we ll not cover this in this semester, just a review) CIS 068 Welcome to! 1. GUIs: JAVA Swing 2. (Streams and Files we ll not cover this in this semester, just a review) Overview JAVA and GUIs: SWING Container, Components, Layouts Using SWING Streams and Files Text

More information

Detecting Structural Refactoring Conflicts Using Critical Pair Analysis

Detecting Structural Refactoring Conflicts Using Critical Pair Analysis SETra 2004 Preliminary Version Detecting Structural Refactoring Conflicts Using Critical Pair Analysis Tom Mens 1 Software Engineering Lab Université de Mons-Hainaut B-7000 Mons, Belgium Gabriele Taentzer

More information

Adding Support For a New Resource Manager

Adding Support For a New Resource Manager Greg Watson PTP User/Developer Meeting, Chicago, September 2012 Adding Support For a New Resource Manager Introduction Based on The (JAXB) Configurable Resource Manager for PTP by Albert L. Rossi http://wiki.eclipse.org/images/2/28/jaxbdemo.pdf

More information

Adapting FUJABA for Building a Meta Modelling Framework

Adapting FUJABA for Building a Meta Modelling Framework Adapting FUJABA for Building a Meta Modelling Framework Carsten Amelunxen, Alexander Königs, Tobias Rötschke, Andy Schürr Technische Univeristät Darmstadt Institut für Datentechnik, FG Echtzeitsysteme

More information

The Eclipse Modeling Framework and MDA Status and Opportunities

The Eclipse Modeling Framework and MDA Status and Opportunities The Eclipse Modeling Framework and MDA Status and Opportunities David Frankel Consulting df@davidfrankelconsulting.com www.davidfrankelconsulting.com Portions adapted from the book Model Driven Architecture:

More information

CS 180 Final Exam Review 12/(11, 12)/08

CS 180 Final Exam Review 12/(11, 12)/08 CS 180 Final Exam Review 12/(11, 12)/08 Announcements Final Exam Thursday, 18 th December, 10:20 am 12:20 pm in PHYS 112 Format 30 multiple choice questions 5 programming questions More stress on topics

More information

Graphical User Interface (GUI)

Graphical User Interface (GUI) Graphical User Interface (GUI) An example of Inheritance and Sub-Typing 1 Java GUI Portability Problem Java loves the idea that your code produces the same results on any machine The underlying hardware

More information

News and info. Array. Feedback. Lab 4 is due this week. It should be easy to change the size of the game grid.

News and info. Array. Feedback. Lab 4 is due this week. It should be easy to change the size of the game grid. Calculation Applet! Arrays! Sorting! Java Examples! D0010E! Lecture 11! The GUI Containment Hierarchy! Mergesort! News and info Lab 4 is due this week. It should be easy to change the size of the game

More information

KF5008 Program Design & Development. Lecture 1 Usability GUI Design and Implementation

KF5008 Program Design & Development. Lecture 1 Usability GUI Design and Implementation KF5008 Program Design & Development Lecture 1 Usability GUI Design and Implementation Types of Requirements Functional Requirements What the system does or is expected to do Non-functional Requirements

More information

PROGRAMMING DESIGN USING JAVA (ITT 303) Unit 7

PROGRAMMING DESIGN USING JAVA (ITT 303) Unit 7 PROGRAMMING DESIGN USING JAVA (ITT 303) Graphical User Interface Unit 7 Learning Objectives At the end of this unit students should be able to: Build graphical user interfaces Create and manipulate buttons,

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

Planned Review Date: June 10, 2009 Communication Channel: eclipse.tools.emf Dave Steinberg and Ed Merks

Planned Review Date: June 10, 2009 Communication Channel: eclipse.tools.emf Dave Steinberg and Ed Merks EMF Core 2.5 Release Review Galileo Simultaneous Release Planned Review Date: June 10, 2009 Communication Channel: eclipse.tools.emf Dave Steinberg and Ed Merks Eclipse Modeling Framework Framework and

More information

Control Flow: Overview CSE3461. An Example of Sequential Control. Control Flow: Revisited. Control Flow Paradigms: Reacting to the User

Control Flow: Overview CSE3461. An Example of Sequential Control. Control Flow: Revisited. Control Flow Paradigms: Reacting to the User CSE3461 Control Flow Paradigms: Reacting to the User Control Flow: Overview Definition of control flow: The sequence of execution of instructions in a program. Control flow is determined at run time by

More information

Command-Line Applications. GUI Libraries GUI-related classes are defined primarily in the java.awt and the javax.swing packages.

Command-Line Applications. GUI Libraries GUI-related classes are defined primarily in the java.awt and the javax.swing packages. 1 CS257 Computer Science I Kevin Sahr, PhD Lecture 14: Graphical User Interfaces Command-Line Applications 2 The programs we've explored thus far have been text-based applications A Java application is

More information

Chapter 4 Defining Classes I

Chapter 4 Defining Classes I Chapter 4 Defining Classes I This chapter introduces the idea that students can create their own classes and therefore their own objects. Introduced is the idea of methods and instance variables as the

More information

Story Diagrams: A new Graph Grammar Language based on the Unified Modelling Language and Java

Story Diagrams: A new Graph Grammar Language based on the Unified Modelling Language and Java Story Diagrams: A new Graph Grammar Language based on the Unified Modelling Language and Java Thorsten Fischer, Jörg Niere, Lars Torunski, Albert Zündorf AG-Softwaretechnik, Fachbereich 17, Universität

More information

PART 1. Eclipse IDE Tutorial. 1. What is Eclipse? Eclipse Java IDE

PART 1. Eclipse IDE Tutorial. 1. What is Eclipse? Eclipse Java IDE PART 1 Eclipse IDE Tutorial Eclipse Java IDE This tutorial describes the usage of Eclipse as a Java IDE. It describes the installation of Eclipse, the creation of Java programs and tips for using Eclipse.

More information

MARS AREA SCHOOL DISTRICT Curriculum TECHNOLOGY EDUCATION

MARS AREA SCHOOL DISTRICT Curriculum TECHNOLOGY EDUCATION Course Title: Java Technologies Grades: 10-12 Prepared by: Rob Case Course Unit: What is Java? Learn about the history of Java. Learn about compilation & Syntax. Discuss the principles of Java. Discuss

More information

Java Programming Lecture 6

Java Programming Lecture 6 Java Programming Lecture 6 Alice E. Fischer Feb 15, 2013 Java Programming - L6... 1/32 Dialog Boxes Class Derivation The First Swing Programs: Snow and Moving The Second Swing Program: Smile Swing Components

More information

CSIS 10A Assignment 7 SOLUTIONS

CSIS 10A Assignment 7 SOLUTIONS CSIS 10A Assignment 7 SOLUTIONS Read: Chapter 7 Choose and complete any 10 points from the problems below, which are all included in the download file on the website. Use BlueJ to complete the assignment,

More information

Building Graphical User Interfaces. Overview

Building Graphical User Interfaces. Overview Building Graphical User Interfaces 4.1 Overview Constructing GUIs Interface components GUI layout Event handling 2 1 GUI Principles Components: GUI building blocks. Buttons, menus, sliders, etc. Layout:

More information

Formal tool support for software evolution

Formal tool support for software evolution Service de Génie Logiciel Formal tool support for software evolution Tom Mens staff.umh.ac.be/mens.tom/ www.umh.ac.be/~genlog Université de Mons-Hainaut Problem statement More and better tool support needed

More information

Compositional Model Based Software Development

Compositional Model Based Software Development Compositional Model Based Software Development Prof. Dr. Bernhard Rumpe http://www.se-rwth.de/ Seite 2 Our Working Groups and Topics Automotive / Robotics Autonomous driving Functional architecture Variability

More information

CPS 506 Comparative Programming Languages. Programming Language

CPS 506 Comparative Programming Languages. Programming Language CPS 506 Comparative Programming Languages Object-Oriented Oriented Programming Language Paradigm Introduction Topics Object-Oriented Programming Design Issues for Object-Oriented Oriented Languages Support

More information

Advanced User Interface Programming Using the Eclipse Rich Client Platform

Advanced User Interface Programming Using the Eclipse Rich Client Platform Advanced User Interface Programming Using the Eclipse Rich Client Platform Tod Creasey IBM Canada Tod Creasey Advanced User Interface Programming Using the Eclipse Rich Client Platform Page 1 About the

More information

INTERNAL ASSESSMENT TEST III Answer Schema

INTERNAL ASSESSMENT TEST III Answer Schema INTERNAL ASSESSMENT TEST III Answer Schema Subject& Code: Object-Oriented Modeling and Design (15CS551) Sem: V ISE (A & B) Q. No. Questions Marks 1. a. Ans Explain the steps or iterations involved in object

More information

ADT: Eclipse development tools for ATL

ADT: Eclipse development tools for ATL ADT: Eclipse development tools for ATL Freddy Allilaire (freddy.allilaire@laposte.net) Tarik Idrissi (tarik.idrissi@laposte.net) Université de Nantes Faculté de Sciences et Techniques LINA (Laboratoire

More information

An Introduction to C++

An Introduction to C++ An Introduction to C++ Introduction to C++ C++ classes C++ class details To create a complex type in C In the.h file Define structs to store data Declare function prototypes The.h file serves as the interface

More information

Developing Enterprise Web Applications Using the Story Driven Modeling Approach

Developing Enterprise Web Applications Using the Story Driven Modeling Approach Developing Enterprise Web Applications Using the Story Driven Modeling Approach Christoph Eickhoff, Nina Geiger, Marcel Hahn, and Albert Zündorf University of Kassel, Software Engineering, Department of

More information

Java Swing Introduction

Java Swing Introduction Course Name: Advanced Java Lecture 18 Topics to be covered Java Swing Introduction What is Java Swing? Part of the Java Foundation Classes (JFC) Provides a rich set of GUI components Used to create a Java

More information

Overview. Building Graphical User Interfaces. GUI Principles. AWT and Swing. Constructing GUIs Interface components GUI layout Event handling

Overview. Building Graphical User Interfaces. GUI Principles. AWT and Swing. Constructing GUIs Interface components GUI layout Event handling Overview Building Graphical User Interfaces Constructing GUIs Interface components GUI layout Event handling 4.1 GUI Principles AWT and Swing Components: GUI building blocks. Buttons, menus, sliders, etc.

More information

Dresden OCL2 in MOFLON

Dresden OCL2 in MOFLON Dresden OCL2 in MOFLON 10 Jahre Dresden-OCL Workshop Felix Klar Felix.Klar@es.tu-darmstadt.de ES Real-Time Systems Lab Prof. Dr. rer. nat. Andy Schürr Dept. of Electrical Engineering and Information Technology

More information

Chapter 5 Object-Oriented Programming

Chapter 5 Object-Oriented Programming Chapter 5 Object-Oriented Programming Develop code that implements tight encapsulation, loose coupling, and high cohesion Develop code that demonstrates the use of polymorphism Develop code that declares

More information

SwingML Renderer. Developer s tutorial. Ezequiel Cuellar

SwingML Renderer. Developer s tutorial. Ezequiel Cuellar SwingML Renderer Developer s tutorial Ezequiel Cuellar September 2004 SwingML Renderer. This document explains how the SwingML Renderer works and how it can be extended to add support for new components.

More information

UML PROFILING AND DSL

UML PROFILING AND DSL UML PROFILING AND DSL version 17.0.1 user guide No Magic, Inc. 2011 All material contained herein is considered proprietary information owned by No Magic, Inc. and is not to be shared, copied, or reproduced

More information

Unit3: Java in the large. Prepared by: Dr. Abdallah Mohamed, AOU-KW

Unit3: Java in the large. Prepared by: Dr. Abdallah Mohamed, AOU-KW Prepared by: Dr. Abdallah Mohamed, AOU-KW 1 1. Introduction 2. Objects and classes 3. Information hiding 4. Constructors 5. Some examples of Java classes 6. Inheritance revisited 7. The class hierarchy

More information

TOOLS AND TECHNIQUES FOR TEST-DRIVEN LEARNING IN CS1

TOOLS AND TECHNIQUES FOR TEST-DRIVEN LEARNING IN CS1 TOOLS AND TECHNIQUES FOR TEST-DRIVEN LEARNING IN CS1 ABSTRACT Test-Driven Development is a design strategy where a set of tests over a class is defined prior to the implementation of that class. The goal

More information

Object Oriented Features. Inheritance. Inheritance. CS257 Computer Science I Kevin Sahr, PhD. Lecture 10: Inheritance

Object Oriented Features. Inheritance. Inheritance. CS257 Computer Science I Kevin Sahr, PhD. Lecture 10: Inheritance CS257 Computer Science I Kevin Sahr, PhD Lecture 10: Inheritance 1 Object Oriented Features For a programming language to be called object oriented it should support the following features: 1. objects:

More information

Example: Building a Java GUI

Example: Building a Java GUI Steven Zeil October 25, 2013 Contents 1 Develop the Model 2 2 Develop the layout of those elements 3 3 Add listeners to the elements 9 4 Implement custom drawing 12 1 The StringArt Program To illustrate

More information

No SVN checkout today. Object-Oriented Design

No SVN checkout today. Object-Oriented Design No SVN checkout today Object-Oriented Design Software development methods Object-oriented design with CRC cards LayoutManagers for Java GUIs BallWorlds work time Analysis Design Implementation Software

More information

Overview. Lecture 7: Inheritance and GUIs. Inheritance. Example 9/30/2008

Overview. Lecture 7: Inheritance and GUIs. Inheritance. Example 9/30/2008 Overview Lecture 7: Inheritance and GUIs Written by: Daniel Dalevi Inheritance Subclasses and superclasses Java keywords Interfaces and inheritance The JComponent class Casting The cosmic superclass Object

More information

CS Exam 1 Review Suggestions

CS Exam 1 Review Suggestions CS 235 - Fall 2015 - Exam 1 Review Suggestions p. 1 last modified: 2015-09-30 CS 235 - Exam 1 Review Suggestions You are responsible for material covered in class sessions, lab exercises, and homeworks;

More information

RAIK 183H Examination 2 Solution. November 10, 2014

RAIK 183H Examination 2 Solution. November 10, 2014 RAIK 183H Examination 2 Solution November 10, 2014 Name: NUID: This examination consists of 5 questions and you have 110 minutes to complete the test. Show all steps (including any computations/explanations)

More information

Example: Building a Java GUI

Example: Building a Java GUI Steven Zeil October 25, 2013 Contents 1 Develop the Model 3 2 Develop the layout of those elements 4 3 Add listeners to the elements 12 4 Implement custom drawing 15 1 The StringArt Program To illustrate

More information

INTERACTIVE LEARNING OBJECTS: A FRAMEWORK BASED APPROACH

INTERACTIVE LEARNING OBJECTS: A FRAMEWORK BASED APPROACH INTERACTIVE LEARNING OBJECTS: A FRAMEWORK BASED APPROACH Friedbert Kaspar University of Applied Science Faculty of Computer Science D-78120 Furtwangen ABSTRACT A rapid content development approach to develop

More information

What are the characteristics of Object Oriented programming language?

What are the characteristics of Object Oriented programming language? What are the various elements of OOP? Following are the various elements of OOP:- Class:- A class is a collection of data and the various operations that can be performed on that data. Object- This is

More information

Software Analysis and Transformation

Software Analysis and Transformation Logic-based Software Analysis and Transformation Dr. Günter Kniesel gk@cs.uni-bonn.de ROOTS Group Computer Science Department III University of Bonn Software Transformation Software Transformation Modification

More information

Proceedings of the Third International Workshop on Graph Based Tools (GraBaTs 2006)

Proceedings of the Third International Workshop on Graph Based Tools (GraBaTs 2006) Electronic Communications of the EASST Volume 1 (2006) Proceedings of the Third International Workshop on Graph Based Tools (GraBaTs 2006) Specifying Distributed Graph Transformation Systems Ulrike Ranger,

More information

Java Object Oriented Design. CSC207 Fall 2014

Java Object Oriented Design. CSC207 Fall 2014 Java Object Oriented Design CSC207 Fall 2014 Design Problem Design an application where the user can draw different shapes Lines Circles Rectangles Just high level design, don t write any detailed code

More information

Handout 7. Defining Classes part 1. Instance variables and instance methods.

Handout 7. Defining Classes part 1. Instance variables and instance methods. Handout 7 CS180 Programming Fundamentals Spring 15 Page 1 of 8 Handout 7 Defining Classes part 1. Instance variables and instance methods. In Object Oriented programming, applications are comprised from

More information

Carrera: Analista de Sistemas/Licenciatura en Sistemas. Asignatura: Programación Orientada a Objetos

Carrera: Analista de Sistemas/Licenciatura en Sistemas. Asignatura: Programación Orientada a Objetos Carrera: / Asignatura: Programación Orientada a Objetos REFACTORING EXERCISE WITH ECLIPSE - 2008- Observation: This refactoring exercise was extracted of the web site indicated in the section Reference

More information

EMF Europa Simultaneous Release

EMF Europa Simultaneous Release EMF 2.3.0 Europa Simultaneous Release 6 June, 2007 Release Review revision 2.3.1 17 January, 2007 1 Europa Simultaneous Release 2007 by IBM Corporation, made available under the EPL v1.0 EMF - Europa Release

More information

The Fujaba Statechart Synthesis Approach

The Fujaba Statechart Synthesis Approach The Fujaba Statechart Synthesis Approach Thomas Maier, Albert Zündorf University of Kassel, Germany thomas.maier@uni-kassel.de, albert.zuendorf@uni-kassel.de Abstract The Fujaba project tries to provide

More information

Parts of a Contract. Contract Example. Interface as a Contract. Wednesday, January 30, 13. Postcondition. Preconditions.

Parts of a Contract. Contract Example. Interface as a Contract. Wednesday, January 30, 13. Postcondition. Preconditions. Parts of a Contract Syntax - Method signature Method name Parameter list Return type Semantics - Comments Preconditions: requirements placed on the caller Postconditions: what the method modifies and/or

More information

CS11 Java. Fall Lecture 3

CS11 Java. Fall Lecture 3 CS11 Java Fall 2014-2015 Lecture 3 Today s Topics! Class inheritance! Abstract classes! Polymorphism! Introduction to Swing API and event-handling! Nested and inner classes Class Inheritance! A third of

More information

Chapter 18. Advanced graphics programming

Chapter 18. Advanced graphics programming Chapter 18 Advanced graphics programming Making choices With graphical applications, there are a number of ways of providing choices to the user: pull-down menus; pop-up menus dialogue windows; radio buttons;

More information

Building a GUI in Java with Swing. CITS1001 extension notes Rachel Cardell-Oliver

Building a GUI in Java with Swing. CITS1001 extension notes Rachel Cardell-Oliver Building a GUI in Java with Swing CITS1001 extension notes Rachel Cardell-Oliver Lecture Outline 1. Swing components 2. Building a GUI 3. Animating the GUI 2 Swing A collection of classes of GUI components

More information

Inheritance. Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L

Inheritance. Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L Inheritance Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L 9.1 9.4 1 Inheritance Inheritance allows a software developer to derive

More information

TeenCoder : Java Programming (ISBN )

TeenCoder : Java Programming (ISBN ) TeenCoder : Java Programming (ISBN 978-0-9887070-2-3) and the AP * Computer Science A Exam Requirements (Alignment to Tennessee AP CS A course code 3635) Updated March, 2015 Contains the new 2014-2015+

More information

Copying Subgraphs within Model Repositories

Copying Subgraphs within Model Repositories Copying Subgraphs within Model Repositories Pieter van Gorp, Hans Schippers, Dirk Janssens April 2, 2006 1 / 37 Contents Languages 2 / 37 Outline Languages 3 / 37 : Model Driven Software Engineering Model

More information