PB173 - Tématický vývoj aplikací v C/C++ (jaro 2016)

Slides:



Advertisements
Similar presentations
A Taste of Visual Studio 2005 David Grey. Introduction In this session we will introduce Visual Studio 2005 and its features and examine those features.
Advertisements

P5, M1, D1.
Test-Driven Development and Refactoring CPSC 315 – Programming Studio.
Refactoring Overview  What is refactoring?  What are four good reasons to refactor?  When should you refactor?  What is a bad smell (relative to refactoring.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming The software development method algorithms.
Programming Creating programs that run on your PC
Introduction to Refactoring Excerpted from ‘What is Refactoring?’ by William C. Wake and Refactoring: Improving the Design of Existing Code by Martin Fowler.
BORIS MILAŠINOVIĆ FACULTY OF ELECTRICAL ENGINEERING AND COMPUTING UNIVERSITY OF ZAGREB, CROATIA Experiences after three years of teaching “Development.
System Implementation
CASE Tools And Their Effect On Software Quality Peter Geddis – pxg07u.
Maintenance Refactoring and Code Smells. Where are we? Over the semester we have talked about Software Engineering. The overall goal of software engineering.
A Survey of Software Refactoring Tom Mens, Tom Tourwé
Verification and Validation Yonsei University 2 nd Semester, 2014 Sanghyun Park.
สาขาวิชาเทคโนโลยี สารสนเทศ คณะเทคโนโลยีสารสนเทศ และการสื่อสาร.
Object Oriented Analysis and Design Introduction.
POSTSHARP TECHNOLOGIES Better software through simpler code.
Sadegh Aliakbary Sharif University of Technology Spring 2012.
Design and Programming Chapter 7 Applied Software Project Management, Stellman & Greene See also:
Refactoring Improving the structure of existing code Refactoring1.
Software Design Deriving a solution which satisfies software requirements.
Systems Analysis and Design in a Changing World, 3rd Edition
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Refactoring1 Improving the structure of existing code.
Advanced Programming in Java
Graphene So what’s the most efficient way to spam all your Facebook friends? Team Adith Tekur (System Architect/Tester) Neha Rastogi (System Integrator)
REFACTORINGREFACTORING. Realities Code evolves substantially during development Requirements changes 1%-4% per month on a project Current methodologies.
Developing an Algorithm. Simple Program Design, Fourth Edition Chapter 3 2 Objectives In this chapter you will be able to: Introduce methods of analyzing.
Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Sadegh Aliakbary Sharif University of Technology Spring 2011.
Introduction of Geoprocessing Lecture 9. Geoprocessing  Geoprocessing is any GIS operation used to manipulate data. A typical geoprocessing operation.
CSC 4700 Software Engineering
1 ECE 750 Topic 8 Meta-programming languages, systems, and applications Evolving Object-Oriented Designs with Refactorings – Lance Tokuda and Don Batory.
SSQSA present and future Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics Faculty of Sciences University of Novi Sad
Topic 4 - Database Design Unit 1 – Database Analysis and Design Advanced Higher Information Systems St Kentigern’s Academy.
1 Software Maintenance The process of changing the system after it has been delivered and in operation Software change is inevitable –New requirements.
SEG 4110 – Advanced Software Design and Reengineering Topic T Introduction to Refactoring.
Software Metric Tools Joel Keyser, Jacob Napp, Carey Norslien, Stephen Owings, Tristan Paynter.
The Hashemite University Computer Engineering Department
Refactoring1 Improving the structure of existing code.
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.
Unit Testing with FlexUnit
Continuous Improvement. Start Simple and Continually Improve E.g., Gmail Labels 1.
PROGRAMMING USING PYTHON LANGUAGE ASSIGNMENT 1. INSTALLATION OF RASPBERRY NOOB First prepare the SD card provided in the kit by loading an Operating System.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
 Problem Analysis  Coding  Debugging  Testing.
1 Team Skill 3 Defining the System Part 1: Use Case Modeling Noureddine Abbadeni Al-Ain University of Science and Technology College of Engineering and.
PB173 - Tématický vývoj aplikací v C/C++ (Jaro 2016) Skupina: Aplikovaná kryptografie a bezpečné programováníAplikovaná kryptografie a bezpečné programování.
PB173 - Tématický vývoj aplikací v C/C++ Domain specific development in C/C++ Skupina: Aplikovaná kryptografie a bezpečné programování Petr Švenda
Implementation Topics Describe –Characteristics of good implementations –Best practices to achieve them Understand role of comments Learn debugging techniques.
Principles and examples
PB173 - Tématický vývoj aplikací v C/C++ (jaro 2016)
CSE 219 Final exam review.
Reuse Separate classes could be developed for all the different objects that are needed in each program. However that would be wasteful. Often many functionalities.
Metrics of Software Quality
Software Metrics 1.
Unified Modeling Language
Functions CIS 40 – Introduction to Programming in Python
SOFTWARE DESIGN AND ARCHITECTURE
Un</br>able’s MySecretSecrets
Refactoring and Code Smells
Cryptography This week we are going to use OpenSSL
Software testing strategies 2
Design and Programming
Improving the structure of existing code
CS240: Advanced Programming Concepts
Advanced Programming Behnam Hatami Fall 2017.
Course: Module: Lesson # & Name Instructional Material 1 of 32 Lesson Delivery Mode: Lesson Duration: Document Name: 1. Professional Diploma in ERP Systems.
Algorithms and Problem Solving
QTP Test Process
Chapter 9: Implementation
Presentation transcript:

PB173 - Tématický vývoj aplikací v C/C++ (jaro 2016) Skupina: Aplikovaná kryptografie a bezpečné programování Petr Švenda svenda@fi.muni.cz Konzultace: A.406, Pondělí 15-15:50

Refactoring Refactoring is process of restructuralization of source code to make it easier to understand and modify in future without changing its observable behaviour. No new functionality is added Existing code is rewritten, split, erased and otherwise modified to improve code quality PB173 | Refactoring

Refactoring (2) Coding can be divided into two parts adding code for new functionality refactoring existing code Refactoring is necessary to keep code maintainable spaghetti code will sooner or later consume more time to maintain than to rewrite it Be aware – code rewrite might introduce new bugs Proper (automated) testing is required that’s why we have unit tests! run these tests during refactoring PB173 | Refactoring

Refactoring – refactoring techniques (De-)Composing methods properly Moving code between modules/classes Change data organization Making conditional expressions simpler Making API clearer … See http://sourcemaking.com/refactoring detailed explanation of many techniques with examples principles and practical tips how to solve problems PB173 | Refactoring

Code extraction into separate function http://sourcemaking.com/refactoring/extract-method Locate function doing multiple functionalities Identify logical blocks of functionality Create new function with name describing What not How move code there, replace by function call think about others who also use old/new function Take care of local variables pass them as function arguments PB173 | Refactoring

Additional explanation variable http://sourcemaking.com/refactoring/introduce-explaining-variable Add additional well-named variable to hold intermediate value even when such variable is not necessary in principle Improve readability of code Increase possibility for debugging you can watch and conditionally break on variable PB173 | Refactoring

Separate work done by single module/class http://sourcemaking.com/refactoring/extract-class Over the time, your module/class will grow one module/class is doing multiple functionalities Violation of several design principles Identify distinct functionalities usually set of methods and attributes responsible for single functionality Create new class(es) and move functions there separate interfaces for separate functionalities use multiple inheritance or aggregation to glue together PB173 | Refactoring

Refactoring - tools Most of the work with refactoring is “manual” find out how to refactor and write simpler code Tools can still help identify problematic areas (Code metrics, SourceMonitor) provide call graph and data flow (Doxygen, VS Profiler) apply transformation consistently in all project files PB173 | Refactoring

Refactoring – tools (2) Refactoring support for C/C++ in VS 2015 https://visualstudiogallery.msdn.microsoft.com/164904b2-3b47-417f-9b6b-fdd35757d194 3rd party add-ons like Visual Assist X / VSCommands not only refactoring support, but also code completition… http://www.agile-code.com/blog/list-of-visual-studio-code-refactoring-tools/ NetBeans (and others) have refactoring support http://wiki.netbeans.org/Refactoring variable renaming, code extraction… PB173 | Refactoring

Source monitor Create new project After code update File  New project language, directory with sources *.c / *.cpp initial ‘Baseline’ After code update Checkpoint  New checkpoint Details on particular checkpoint and file RClick  Display Function Metrics Details... PB173 | Refactoring

Source monitor – example outputs Complexity: 1-10 (OK), 11-20 (sometimes), > 20 (BAD) PB173 | Refactoring

Antipatterns Common defective process and implementation within organization Opposite to design patterns see http://sourcemaking.com/design_patterns Read http://sourcemaking.com/antipatterns good description, examples and how to solve Not limited to object oriented programming! Software development antipatterns http://sourcemaking.com/antipatterns/software-development-antipatterns PB173 | Refactoring

Practical assignment - refactoring Use code metric tool to analyze your sources http://www.campwoodsw.com/sourcemonitor.html Do it NOW! Discuss Find and refactor all functions with complexity more then 15 with Maximum Depth more then 4 Read and use refactoring techniques http://sourcemaking.com/refactoring Make your code nice, readable and tidy! PB173 | Refactoring

Assignment – prepare for presentation Prepare refactored code and presentation 15 minutes presentation Design, actual implementation Live demo of implementation Single zip for download (for other teams for code review) Deadline 9.5.2016 12:00 HW Vault: Crypto - 9. homework (Presentation) PB173 | Refactoring