Steve Chenoweth Office Phone: (812) Cell: (937)

Slides:



Advertisements
Similar presentations
Clean code. Motivation Total cost = the cost of developing + maintenance cost Maintenance cost = cost of understanding + cost of changes + cost of testing.
Advertisements

© 2010 Shawn A. Bohner Software Construction and Evolution - CSSE 375 Even more Bad Smells in Code Shawn & Steve Q1 Shawn & Steve Hint 
Gregor Gisler-Merz BrownBag Session Refactoring.
Refactoring Overview  What is refactoring?  What are four good reasons to refactor?  When should you refactor?  What is a bad smell (relative to refactoring.
REFACTORING. What is refactoring ? In refactoring, you start with the basic code and make it better. Change the internal structure of the existing code.
Software Construction and Evolution - CSSE 375 Bad Smells in Code Shawn Bohner & Steve Chenoweth.
1 Software Maintenance and Evolution CSSE 575: Session 3, Part 4 Big Refactorings Steve Chenoweth Office Phone: (812) Cell: (937)
1 Software Maintenance and Evolution CSSE 575: Session 9, Part 2 A Model for Evolutionary Growth Steve Chenoweth Office Phone: (812) Cell: (937)
1 Software Maintenance and Evolution CSSE 575: Session 2, Part 3 Moving Features Between Objects Steve Chenoweth Office Phone: (812) Cell: (937)
1 Software Maintenance and Evolution CSSE 575: Session 1, Part 4 Even more Bad Smells in Code Steve Chenoweth Office Phone: (812) Cell: (937)
1 Software Maintenance and Evolution CSSE 575: Session 6, Part 4 Breaking Dependencies Steve Chenoweth Office Phone: (812) Cell: (937)
1 Software Maintenance and Evolution CSSE 575: Session 1, Part 1 Course Introduction Steve Chenoweth Office Phone: (812) Cell: (937)
1 Software Maintenance and Evolution CSSE 575: Session 8, Part 3 Predicting Bugs Steve Chenoweth Office Phone: (812) Cell: (937)
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
Chapter 7 Designing Classes. Class Design When we are developing a piece of software, we want to design the software We don’t want to just sit down and.
1 Software Construction and Evolution - CSSE 375 Exception Handling – Logging & Special Situations Steve Chenoweth Office: Moench Room F220 Phone: (812)
Software Engineering Modern Approaches Eric Braude and Michael Bernstein 1.
Refactoring. Mathematics: Factor ● fac·tor – One of two or more quantities that divides a given quantity without a remainder, e.g., 2 and 3 are factors.
Refactoring Improving the structure of existing code Refactoring1.
1 Software Construction and Evolution - CSSE 375 Exception Handling - Principles Steve Chenoweth, RHIT Above – Exception handling on the ENIAC. From
CSSE 374: More GRASP’ing for Object Responsibilities
1 Software Maintenance and Evolution CSSE 575: Session 3, Part 1 Simplifying Conditionals Steve Chenoweth Office Phone: (812) Cell: (937)
Refactoring1 Improving the structure of existing code.
Introduction to Refactoring Jim Cooper Falafel Software.
Incremental Design Why incremental design? Goal of incremental design Tools for incremental design  UML diagrams  Design principles  Design patterns.
Software Engineering CS3003 Lecture 4 Code bad smells and refactoring.
Refactoring and such ● (Side note) Specialization ● Key terms ● Abstraction, state, persistence and association and their relationship to software development.
Refactoring. Refactoring Overview  What is refactoring?  What are four good reasons to refactor?  When should you refactor?  What is a bad smell (relative.
Refactoring 2. Admin Blackboard Quiz Acknowledgements Material in this presentation was drawn from Martin Fowler, Refactoring: Improving the Design of.
REFACTORINGREFACTORING. Realities Code evolves substantially during development Requirements changes 1%-4% per month on a project Current methodologies.
Module 3. Smells Between Classes Course: Refactoring.
1 Software Construction and Evolution - CSSE 375 Exception Handling – Chaining & Threading Steve Chenoweth Office: Moench Room F220 Phone: (812)
1 Software Maintenance and Evolution CSSE 575: Session 2, Part 1 Refactoring Principles Steve Chenoweth Office Phone: (812) Cell: (937)
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Software Construction and Evolution - CSSE 375 Making Method Calls Simpler Shawn and Steve Below – “Be the character!” The late acting teacher Lee Strasberg.
1 ECE 750 Topic 8 Meta-programming languages, systems, and applications Evolving Object-Oriented Designs with Refactorings – Lance Tokuda and Don Batory.
1 Software Maintenance and Evolution CSSE 575: Session 3, Part 3 Dealing with Generalization Steve Chenoweth Office Phone: (812) Cell: (937)
SEG 4110 – Advanced Software Design and Reengineering Topic T Introduction to Refactoring.
Software Construction and Evolution CSSE 375: Course Introduction Steve Chenoweth Office: Meonch Room F220 Phone: (812)
Refactoring. Mathematics: Factor ● fac·tor – One of two or more quantities that divides a given quantity without a remainder, e.g., 2 and 3 are factors.
Refactoring1 Improving the structure of existing code.
Pertemuan 12 Refactoring Mata kuliah: T0144 – Advanced Topics in Software Engineering Tahun: 2010.
Refactoring. 2 Process of changing a software system in such a way that it does not alter the external behavior of the code, yet improves its internal.
CSSE 375 Organizing Data – Part 1 Shawn and Steve Q1.
Software Construction and Evolution - CSSE 375 Dealing with Generalization Steve and Shawn Left – In the 1990 movie “The Freshman,” Matthew Broderick,
ICONFINDER ICONFINDER Founded Django based web application -PostgreSQL -Elasticsearch -Amazon Elastic Compute.
Principles and examples
Steve Chenoweth Office Phone: (812) Cell: (937)
Unit - 3 OBJECT ORIENTED DESIGN PROCESS AND AXIOMS
Software Engineering Modern Approaches Chapter 24. Refactoring.
Steve Chenoweth Office Phone: (812) Cell: (937)
MPCS – Advanced java Programming
Software Maintenance and Evolution CSSE 575: Session 1, Part 1 Course Introduction Steve Chenoweth Office Phone: (812) Cell: (937)
By SmartBoard team Adapter pattern.
C++ coding standard suggestion… Separate reasoning from action, in every block. Hi, this talk is to suggest a rule (or guideline) to simplify C++ code.
Copyright © by Curt Hill
Steve Chenoweth Office Phone: (812) Cell: (937)
CS 5010 Program Design Paradigms "Bootcamp" Lesson 12.1
Steve Chenoweth, RHIT Ch 12 in Fowler
Lesson 16: Functions with Return Values
Code Smells 1.
Improving the structure of existing code
PROGRAMMING Sub Procedures I.
Refactoring Types Blake Duncan.
Refactoring.
ANALYSIS REFACTORING WITH TOOLS
Refactoring.
S. Single Responsibility Principle O. L. I. D.
Presentation transcript:

Software Maintenance and Evolution CSSE 575: Session 3, Part 4 Big Refactorings Steve Chenoweth Office Phone: (812) 877-8974 Cell: (937) 657-3885 Email: chenowet@rose-hulman.edu Our last topic on refactoring… Above – a poster for refactoring, from http://www.zazzle.com/refactoring_poster-228118789330102998.

These are higher level… These likely take a team, in order to do them systematically. Include: Tease apart inheritance Convert procedural design to objects Separate domain from presentation Extract hierarchy Right – Hierarchy in action – the hat you wear in England depends on your position. From http://pirate.shu.edu/~wisterro/cdi/coronets_and_hierarchy.htm.

Tease apart inheritance If you have two parallel sub- hierarchies, they probably contain duplicated code Need to extract what really doesn’t belong, leaving the common parts in a single hierarchy.

Convert procedural design to objects Turn the data records into objects Break up the behavior Move the behavior into the objects

Separate domain from presentation This is like Model-View- Controller. Not so easy to do, in a system where that strategy was not taken from the start.

Extract hierarchy Have a class doing too much work Partly through many conditional statements Create a hierarchy of classes in which each subclass represents a special case

Consideration of levels The Infosys pdf I hoped you could read (!) suggested that refactoring applies to many different levels. Used to be at http://www.infosys.com/engineering-services/white-papers/Documents/refactoring.pdf Included: Structural Code clean-up Code standards User interface

The new, alternative article Since the Infosys one didn’t work, I suggested “How to do large scale refactoring,” a task you may be faced with! It suggests 3 approaches: Big bang, for the truly desperate Divide and conquer, for the more reasonable Strangling, for those with time on their hands And the link from this one to Martin Fowler’s explanation is pretty cool. It’s at https://www.infoq.com/news/2010/08/large-scale-refactoring. And Fowler’s article is at http://martinfowler.com/bliki/StranglerApplication.html.

Consideration of purpose In your own journals, some of you suggested refactoring may be for reasons other than code simplification: Achieving some Quality Attribute goal, like – Performance Security Getting rid of some other kind of smell, like – The new people never understand this part. This part is always being changed.

What’s built-in? Check out the list of “Refactoring commands” for C# /Visual Studio 2013 ! From http://msdn.microsoft.com/en-us/library/719exd8s.aspx. Included: Extract Method Refactoring (C#) Rename Refactoring (C#) Encapsulate Field Refactoring (C#) Extract Interface Refactoring (C#) Remove Parameters Refactoring (C#) Reorder Parameters Refactoring (C#)

Where we have Been so far… Refactoring Bad Code Smells Composing Methods Moving Features between Objects Organizing Data Simplifying Conditional Expressions Making Method Calls Simpler Dealing with Generalization Big Refactorings These principles will serve you in constructing and evolving software systems

Perfect Midterm Questions Here’s a sample of some code. What refactoring would you use on it, and why. What are the conditions in the lifecycle that favor spending more time refactoring? Find two pairs of refactoring rules which appear to be opposite advice. Explain what nuances of a situation would favor each.

Moving up from “Shu” to “Ha” In the refactoring article you read for today, at http://rethinktheworld.blogspot.com/2011/09/rotten-code.html, were you convinced that the problem of refactoring was not easily decomposable into just doing obvious steps?

And from Ha to Aha Last week we talked about Lambdas (maybe) How about as a way to refactor? See http://devleader.ca/2013/11/14/lambdas-example-refactoring-code/ Concept – Private handling methods can get “handed out” as well as “handed in” A perfect way of feeding specifics to frameworks?