Refactoring An Automated Tool for the Tiger Language Leslie A Hensley

Slides:



Advertisements
Similar presentations
Continuation of chapter 6…. Nested while loop A while loop used within another while loop is called nested while loop. Q. An illustration to generate.
Advertisements

Introduction to C# Erick Pranata © Sekolah Tinggi Teknik Surabaya 1.
A Brief Introduction to Test- Driven Development Shawn M. Jones.
Refactoring By: Brian Smith. What is Refactoring? Definition: a change to the internal structure of software to make it easier to understand and cheaper.
Introduction to Refactoring Excerpted from ‘What is Refactoring?’ by William C. Wake and Refactoring: Improving the Design of Existing Code by Martin Fowler.
XP and Refactoring David Talby. Development Methodologies The Software Crisis – 84% of software projects are not on time – 31% of software projects never.
REFACTORING Improving the Design of Existing Code Atakan Şimşek e
25-Jun-15 Managing Complexity Programming is more than just syntax.
13-Jul-15 Refactoring II. Books Design Patterns is the classic book by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides Basically a catalog.
Options for User Input Options for getting information from the user –Write event-driven code Con: requires a significant amount of new code to set-up.
Test-Driven Development With Visual Studio 2005 Erno de Weerd Info Support.
Maintenance Refactoring and Code Smells. Where are we? Over the semester we have talked about Software Engineering. The overall goal of software engineering.
Unit Testing & Defensive Programming. F-22 Raptor Fighter.
Refactoring Lecture 5 CIS 6101 Software Processes and Metrics.
Program Refactoring Mitch Soden Union College. Agenda Definition –Unit Testing –Examples Why Refactor? Limitations Just Another SW Eng Practice? Automation.
Advanced Programing practices
Refactoring Cristescu Marilena. Definitions Loose Usage: Reorganize a program(or something) As a noun: a change made to the internal structure of some.
Software Refactoring Part I: Introduction Bartosz Walter Advanced Object-Oriented Design Lecture 5.
Sadegh Aliakbary Sharif University of Technology Spring 2012.
T-unit: Tcl Unit Test Package Automated Unit Test Package For Tcl Procedures Final Presentation Joseph Boyle Loyola Marymount University.
Basic Java Programming CSCI 392 Week Two. Stuff that is the same as C++ for loops and while loops for (int i=0; i
© ALEXANDRE CUVA  VERSION 2.00 Test Driven Design.
ILM Proprietary and Confidential -
Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.
Advanced Programming in Java
Unit Testing with JUnit and Clover Based on material from: Daniel Amyot JUnit Web site.
1 CSC/ECE 517 Fall 2010 Lec. 3 Overview of Eclipse Lectures Lecture 2 “Lecture 0” Lecture 3 1.Overview 2.Installing and Running 3.Building and Running.
Software Engineering CS3003 Lecture 4 Code bad smells and refactoring.
Refactoring 101 William C. Wake
A tool for test-driven development
NJIT 1 Test Driven Development and Refactoring Larman, Chapter 21.
Sadegh Aliakbary Sharif University of Technology Spring 2011.
Sadegh Aliakbary. Copyright ©2014 JAVACUP.IRJAVACUP.IR All rights reserved. Redistribution of JAVACUP contents is not prohibited if JAVACUP.
1 Software Maintenance and Evolution CSSE 575: Session 2, Part 1 Refactoring Principles Steve Chenoweth Office Phone: (812) Cell: (937)
Refactoring - 1 CS494: Intro. to Refactoring Readings: –Refactoring for everyone: How and why to use Eclipse's automated refactoring features. By David.
FOR LOOP WALK THROUGH public class NestedFor { public static void main(String [] args) { for (int i = 1; i
Refactoring Mehdi Einali Advanced Programming in Java 1.
Chapter 6: Repetition Continued. 2 Validity Checks What’s weak about the following code ? do { s1 = JOptionPane.showInputDialog (“Enter a number: ”);
SEG 4110 – Advanced Software Design and Reengineering Topic T Introduction to Refactoring.
Extreme Programming. Extreme Programming (XP) Formulated in 1999 by Kent Beck, Ward Cunningham and Ron Jeffries Agile software development methodology.
An introduction to arrays, continued. Recall from last time… public static void main ( String args[] ) { //define number of rooms final int N = 100; //define.
Small changes to code to improve it. Refactoring Defined A change made to the internal structure of software to make it easier to understand and cheaper.
Pertemuan 12 Refactoring Mata kuliah: T0144 – Advanced Topics in Software Engineering Tahun: 2010.
Chapter 5 : Methods Part 2. Returning a Value from a Method  Data can be passed into a method by way of the parameter variables. Data may also be returned.
CSSE 375 Organizing Data – Part 1 Shawn and Steve Q1.
Refactoring. DCS – SWC 2 Refactoring ”A change made to the internal structure of software to make it easier to understand and cheaper to modify without.
Refactoring: Improving the Design of Existing Code.
1 JUnit. 2 Unit Testing with JUnit If code has no automated test case written for it to prove that it works, it must be assumed not to work. An API that.
Computer Science A 1. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated editor,
Methods What is a method? Main Method the main method is where a stand alone Java program normally begins execution common compile error, trying.
Testing It is much better to have a plan when testing your programs than it is to just randomly try values in a haphazard fashion. Testing Strategies:
Staples are our staple Building upon our solution.
Principles and examples
Module Road Map Refactoring Why Refactoring? Examples
Sum of natural numbers class SumOfNaturalNumbers {
Steve Chenoweth Office Phone: (812) Cell: (937)
Advanced Programming in Java
Refactoring II 21-Sep-18.
Test-first development
Functions Used to write code only once Can use parameters.
Overview of Eclipse Lectures
eXtreme Programming (XP) and eXtreme Modeling (XM)
Advanced Programming Behnam Hatami Fall 2017.
Refactoring II 5-Feb-19.
class PrintOnetoTen { public static void main(String args[]) {
Refactoring.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
Advanced Programing practices
Refactoring Low Level/High Level.
Refactoring.
Presentation transcript:

Refactoring An Automated Tool for the Tiger Language Leslie A Hensley

What I’m Going to Show You An example refactoring The what, why, when, and how of refactoring My project Refactoring resources

public class RefactoringExample { public static void main(String args[]) { if( args.length > 0 ) { String numberString = args[0]; int number = Integer.parseInt( numberString ); String rank; switch( number ) { case 1: rank = "first"; break; case 2: rank = "second"; break; case 3: rank = "third"; break; } System.out.println( "You placed " + rank ); } else { System.out.println( "One parameter is required: 1, 2, or 3" ); }

public class RefactoringExample { public static void main(String args[]) { if( args.length > 0 ) { String numberString = args[0]; int number = Integer.parseInt( numberString ); String rank; switch( number ) { case 1: rank = "first"; break; case 2: rank = "second"; break; case 3: rank = "third"; break; } System.out.println( "You placed " + rank ); } else { System.out.println( "One parameter is required: 1, 2, or 3" ); }

public class RefactoringExample { public static String calculateRank( String numberString ) { int number = Integer.parseInt( numberString ); String rank; switch( number ) { case 1: rank = "first"; break; case 2: rank = "second"; break; case 3: rank = "third"; break; } public static void main(String args[]) { if( args.length > 0 ) { String numberString = args[0]; String rank = calculateRank( numberString ); System.out.println( "You placed " + rank ); } else { System.out.println( "One parameter is required: 1, 2, or 3" ); }

What is Refactoring Refactoring(noun): a change made to the internal structure of software to make it easier to understand and cheaper to modify without changing its observable behavior. Refactor(verb): to restructure software by applying a series of refactorings without changing its observable behavior.

The result of this is that the system is always as simple as we can make it, which means we can understand it better, which means we can change it more rapidly while keeping it reliable. Try it, you'll like it... --Ron Jeffries

Why Should You Refactor Refactoring improves the design of software. Refactoring makes software easier to understand. Refactoring helps you find bugs. Refactoring helps you program faster.

When Should You Refactor Refactor when you add duplicate code. Refactor when you add functionality. Refactor when you need to fix a bug. Refactor as you do a code review.

How Should You Refactor Refactor mercilessly Refactor in small discrete steps Test after each step Refactor in pairs Don’t mix with adding functionality or fixing a defect

Automated Refactoring [The Smalltalk Refactoring Browser] completely changes the way you think about refactoring. All those niggling little “well, I should change this name but…” thoughts go away, because you just change the name because there is always a single menu item to just change the name.” --Kent Beck

A Refactoring Tool for Tiger The language is used in some compiler classes at UK Implements the Extract Method refactoring I practiced what I am preaching during its implementation.

Refactoring Resources Fowler, Martin. Refactoring: Improving the Design of Existing Code The Extreme Programming wiki – JUnit – This presentation –