SlideShare a Scribd company logo
Code Review Checklist
How far is a code review going?
“Metrics measure the design of code after it
has been written, a Review proofs it and
Refactoring improves code.”
2
The Problem is
• That the problem of source code smells is
additive (new bugs arise but the old ones stay)
• Das kann bei uns nicht passieren! – wieso ist
das denn passiert?
• Management is arrogance and developers are
too proud to admit mistakes
• Programmers don't die, they just GOSUB
without RETURN.
3
Improve the Situation Agenda
• Check your Documents with UML API?
• A Docu Structure to the 5 Top Level Metrics
• Back to Source Code Bugs & Smells
• Improve your Code (Metric Based Refactoring)
• Optimisation and Tools
4
API Layers to Structure
Metrics are for detecting bad code entities
• Function calls for type
• Class blocks for object
• Module components for file
• Library package for directory
• Framework deployment for device
UEB: 640_API_LayerDetection_EKON23.TXT
5
API Layers to UML!
Metrics are for detecting bad code entities
• Function calls for Sequence Diagram
• Class blocks for Class Diagram
• Module components for Com.Diagram
• Library package for Package Diagram
• Framework deployment for Dep.D
http://www.kleiner.ch/kleiner/UML_bigpicture.pdf
6
What‘s API Layering?
Bad Coordination possible
• Function with Threads
• Class Access on objects with Null Pointer
• Module Bad Open/Close of Input/Output
Streams or I/O Connections component
• Package return values or package namespace
• Framework in deployment code
• Docker Composer Access of Container image
constructor on non initialized vars
7
Metrics deal with
Bad Structure (how cohesion & coupling)
• General Code Size (in module)
• Cohesion (in classes and inheritance)
• Complexity
• Coupling (between classes or units)
• Cyclic Dependency, Declare+Definition, ACD-Metric
• Interfaces or Packages (design & runtime)
• Static, Public, Private (inheritance or delegate)
UEB: 10_pas_oodesign_solution.txt
8
Finally you can measure:
Bad Habit (no naming convention, no coverage)
Duplicated, dead code (side effects), bugs & smells
Long Methods (to much code), missing layering
Temporary Fields (confusion), comments or docs
Long Parameter List (Object is missing)
Data Classes (no methods)
• Large Class with too many delegating methods
In a Kiviat Chart you get a Best Practices Circle!
UEB: 33_pas_cipher_file_1.txt
9
Review Doc Structure
10
Review Doc Map
TIOBE Metrics SONAR Rule Set
1. Code coverage [4] Coverage
2. Abstract documentation [6,8] Size, Issues
3. Cyclomatic complexity [7,3] Complexity, Maintainability
4. Compiler warnings [1] Reliability
5. Coding standards [1,3] Reliability, Maintainability
6. Code duplication [5] Duplication
7. Fan out [3,5] Maintainability, Duplication
8. Security flaws [2] Security
https://www.tiobe.com/tqi/definition/
https://www.sonarqube.org/
11
Review Doc Structure II
• Reliability means less Bugs
The degree to which a system or component performs specified functions under specified conditions
for a specified period of time.
• Security means less Vulnerability
The degree of protection of information and data so that unauthorized persons or systems cannot
read or modify them and authorized persons or systems are not denied access to them.
• Maintainability means less Code Smells
The degree of effectiveness and efficiency with which the product can be modified in the sense of
measured code smells which a non compliant to coding conventions or standards.
• Operability means less Complexity
The degree to which the product has attributes that enable it to be understood, learned, used and
attractive to the user, when used under specified conditions.
• Functionality means more Coverage and Size
It measures the minimum number of test cases required for full test coverage.
12
Review Metric Context
SourceSource
improveimprove
MetricsMetrics
DUnitDUnit
test
test
RefactoringRefactoring
changechange
UnitsUnits
Review
Review
Audits
Audits
http://www.softwareschule.ch/download/codesign_2015.pdf
13
When and why Metrics ?
Before a Code Review
By changes of a release
Redesign with UML (Patterns or Profiles)
Law of Demeter not passed
Bad Testability (FAT or SAT)
• Work on little steps at a time
• Modify not only structure but also code format
14
Some Kind of wonderful ?
• statusbar1.simpletext
• simplepanel:= true!
• TLinarBitmap = TLinearBitmap; //Spelling bug
• aus Win32.VCL.Dialogs.pas
• WndProcPtrAtom: TAtom = 0;
• aus indy: self.sender!
• procedure TIdMessageSender_W(Self: TIdMessage;
const T: TIdEmailAddressItem);
• begin Self.Sender := T; end;
UEB: 8_pas_verwechselt.txt
15
Metric/Review Checklist
1. Standards - are the Pascal software standards for
name conventions being followed?
2. Are all program headers completed?
3. Are changes commented appropriately?
4. Are release notes Clear? Complete?
5. Installation Issues, Licenses, Certs. Are there any?
6. Version Control, Are output products clear?
7. Test Instructions - Are they any? Complete?
8. "Die andere Seite, sehr dunkel sie ist" - "Yoda, halt's Maul und iß
Deinen Toast!"
16
Top Ten Metrics
1. VOD Violation of Law of Demeter
2. Halstead NOpmd (Operands/Operators)
3. DAC (Data Abstraction Coupling)(Too many
responsibilities or references in the field)
4. CC (Complexity Report), McCabe cyclomatic
complexity, Decision Points)
5. CBO (Coupling between Objects) Modularity
17
Top Ten II
6. PUR (Package Usage Ratio) access information
in a package from outside
7. DD Dependency Dispersion (SS, Shotgun Surgery
(Little changes distributed over too many
objects or procedures  patterns missed))
8. CR Comment Relation
9. MDC (Module Design Complexity (Class with too
many delegating methods)
10. NORM (remote methods called (Missing
polymorphism))
18
Law of Demeter
1. [M1] an Objekt O selbst
Bsp.: self.initChart(vdata);
2. [M2] an Objekte, die als Parameter in der Nachricht
m vorkommen
Bsp.: O.acceptmemberVisitor(visitor)
visitor.visitElementChartData;
3. [M3] an Objekte, die O als Reaktion auf m erstellt
Bsp.: visitor:= TChartVisitor.create(cData, madata);
4. [M4] an Objekte, auf die O direkt mit einem Member
zugreifen kann
Bsp.: O.Ctnr:= visitor.TotalStatistic
19
Demeter Test as SEQ
UEB: 56_pas_demeter.txt
20
DAC or Modules of Classes
Large classes with to many references
• More than seven or eight variables
• More than fifty methods
• You probably need to break up the class in
Components (Strategy, Composite, Decorator)
TWebModule1 = class(TWebModule)
HTTPSoapDispatcher1: THTTPSoapDispatcher;
HTTPSoapPascalInvoker1: THTTPSoapPascalInvoker;
WSDLHTMLPublish1: TWSDLHTMLPublish;
DataSetTableProducer1: TDataSetTableProducer;
21
CC
• Check Complexity
function IsInteger(TestThis: string): Boolean;
begin
try
StrToInt(TestThis);
except
on EConvertError do
result:= False;
else
result:= True;
end;
end; Ueb: 164_code_reviews.txt
22
PUR Package Usage Ratio
23
DD – Test keywords knowledge
Procedure CopyRecord(const SourceTable, DestTable:
TTable);
var i: Word;
begin
DestTable.Append;
For i:= 0 to SourceTable.FieldCount - 1 do
DestTable.Fields[i].Assign(SourceTable.Fields[i]);
DestTable.Post;
end;
24
DD – use small procedures
Procedure CopyRecord(const SourceTable, DestTable:
TTable);
var i: Word;
begin
DestTable.Append;
For i:= 0 to SourceTable.FieldCount - 1 do
DestTable.Fields[i].Assign(SourceTable.Fields[i]);
DestTable.Post;
end;
25
Why is Refactoring important?
• Only defense against software decay.
• Often needed to fix reusability bugs.
• Lets you add patterns or templates after you
have written a program;
• Lets you transform program into framework.
• Estimation of the value (capital) of code!
• Necessary for beautiful software.
26
Refactoring Process
The act of serialize the process:
 Build unit test
 Refactor and test the code (iterative!)
 Check with Analyzer or another tool
 Build the code
 Running all unit tests
 Generating the documentation
 Deploying to a target machine
 Performing a “smoke test” (just compile)
27
Let‘s practice
• 1
• 11
• 21
• 1211
• 111221
• 312211
• ??? Try to find the next pattern, look for
a rule or logic behind !
28
Before R.
function runString(Vshow: string): string;
var i: byte;
Rword, tmpStr: string;
cntr, nCount: integer;
begin
cntr:=1; nCount:=0;
Rword:=''; //initialize
tmpStr:=Vshow; // input last result
for i:= 1 to length(tmpStr) do begin
if i= length(tmpstr) then begin
if (tmpStr[i-1]=tmpStr[i]) then cntr:= cntr +1;
if cntr = 1 then nCount:= cntr
Rword:= Rword + intToStr(ncount) + tmpStr[i]
end else
if (tmpStr[i]=tmpStr[i+1]) then begin
cntr:= cntr +1;
nCount:= cntr;
end else begin
if cntr = 1 then cntr:=1 else cntr:=1; //reinit counter!
Rword:= Rword + intToStr(ncount) + tmpStr[i] //+ last char(tmpStr)
end;
end; // end for loop
result:=Rword;
end; UEB: 9_pas_umlrunner.txt
29
After R.
function charCounter(instr: string): string;
var i, cntr: integer; Rword: string;
begin
cntr:= 1;
Rword:=' ';
for i:= 1 to length(instr) do begin
//last number in line
if i= length(instr) then
concatChars()
else
if (instr[i]=instr[i+1]) then cntr:= cntr +1
else begin
concatChars()
//reinit counter!
cntr:= 1;
end;
end; //for
result:= Rword;
end;
UEB: 12_pas_umlrunner_solution.txt
30
Refactoring Methods
Einheit Refactoring Funktion Beschreibung
Package Rename Package Rename of Packages
Class Move Method Remove of Methods
Class Extract Superclass Aus Methoden, Eigenschaften eine
Oberklasse erzeugen und verwenden
Class Introduce Parameter Replace of Expression w. Methodparameter
Class Extract Method Heraustrennen einer Codepassage
Interface Extract Interface Aus Methoden ein Interface erzeugen
Interface Use Interface Erzeuge Referenzen auf Klasse
Component Replace Inheritance
with Delegation
Ersetze vererbte Methoden durch Delegation
in innere Klasse
Class Encapsulate Fields Getter- and Setter capsulate
Model Safe Delete Delete a Class with References
31
Metric based Refactoring
:ExtractMethod(EM)-MoveMethod(MM)-DataObject(DO)-ExtractClass(EC)
EM MM DO EC
• Normalized Cohesion W B B B
• Non-normalized Cohesion W B B B
• General Coupling E B N S
• Export Coupling E B E E
• Aggregated import coupling B W W W
• Best, Worst, Expected, Suboptimal
32
Audits & Metric Links:
• https://www.sonarqube.org/
• http://www.softwareschule.ch/
• Report Pascal Analyzer:
http://www.softwareschule.ch/download/pascal_analyzer.pdf
• Refactoring Martin Fowler (1999, Addison-Wesley)
• http://c2.com/cgi/wiki?CodeSmell
• https://www.slideshare.net/maxkleiner1/code-review-with-sonar
• Model View in Together:
• www.softwareschule.ch/download/delphi2007_modelview.pdf
33
Q&A
max@kleiner.com
www.softwareschule.ch

More Related Content

What's hot

advanced java ppt
advanced java pptadvanced java ppt
advanced java ppt
PreetiDixit22
 
03 Java Language And OOP Part III
03 Java Language And OOP Part III03 Java Language And OOP Part III
03 Java Language And OOP Part III
Hari Christian
 
04 Java Language And OOP Part IV
04 Java Language And OOP Part IV04 Java Language And OOP Part IV
04 Java Language And OOP Part IV
Hari Christian
 
Mathemetics module
Mathemetics moduleMathemetics module
Mathemetics module
manikanta361
 
Java 101
Java 101Java 101
Java 101
Manuela Grindei
 
Java concurrency
Java concurrencyJava concurrency
Java concurrency
Hithem Ahmed
 
Java 102
Java 102Java 102
Java 102
Manuela Grindei
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningJava 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Carol McDonald
 
01 Java Language And OOP Part I LAB
01 Java Language And OOP Part I LAB01 Java Language And OOP Part I LAB
01 Java Language And OOP Part I LAB
Hari Christian
 
Java Concurrency
Java ConcurrencyJava Concurrency
Java Concurrency
Carol McDonald
 
Core Java Concepts
Core Java ConceptsCore Java Concepts
Core Java Concepts
mdfkhan625
 
Synchronization.37
Synchronization.37Synchronization.37
Synchronization.37
myrajendra
 
Inheritance
InheritanceInheritance
Inheritance
Mavoori Soshmitha
 
Java 103
Java 103Java 103
Java 103
Manuela Grindei
 
The Ring programming language version 1.5.4 book - Part 180 of 185
The Ring programming language version 1.5.4 book - Part 180 of 185The Ring programming language version 1.5.4 book - Part 180 of 185
The Ring programming language version 1.5.4 book - Part 180 of 185
Mahmoud Samir Fayed
 
Threads in Java
Threads in JavaThreads in Java
Threads in Java
Gaurav Aggarwal
 
Presentation 4th
Presentation 4thPresentation 4th
Presentation 4th
Connex
 
Java session13
Java session13Java session13
Java session13
Niit Care
 
Java Tutorials
Java Tutorials Java Tutorials
Java Tutorials
Woxa Technologies
 
Java tutorial for Beginners and Entry Level
Java tutorial for Beginners and Entry LevelJava tutorial for Beginners and Entry Level
Java tutorial for Beginners and Entry Level
Ramrao Desai
 

What's hot (20)

advanced java ppt
advanced java pptadvanced java ppt
advanced java ppt
 
03 Java Language And OOP Part III
03 Java Language And OOP Part III03 Java Language And OOP Part III
03 Java Language And OOP Part III
 
04 Java Language And OOP Part IV
04 Java Language And OOP Part IV04 Java Language And OOP Part IV
04 Java Language And OOP Part IV
 
Mathemetics module
Mathemetics moduleMathemetics module
Mathemetics module
 
Java 101
Java 101Java 101
Java 101
 
Java concurrency
Java concurrencyJava concurrency
Java concurrency
 
Java 102
Java 102Java 102
Java 102
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningJava 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
 
01 Java Language And OOP Part I LAB
01 Java Language And OOP Part I LAB01 Java Language And OOP Part I LAB
01 Java Language And OOP Part I LAB
 
Java Concurrency
Java ConcurrencyJava Concurrency
Java Concurrency
 
Core Java Concepts
Core Java ConceptsCore Java Concepts
Core Java Concepts
 
Synchronization.37
Synchronization.37Synchronization.37
Synchronization.37
 
Inheritance
InheritanceInheritance
Inheritance
 
Java 103
Java 103Java 103
Java 103
 
The Ring programming language version 1.5.4 book - Part 180 of 185
The Ring programming language version 1.5.4 book - Part 180 of 185The Ring programming language version 1.5.4 book - Part 180 of 185
The Ring programming language version 1.5.4 book - Part 180 of 185
 
Threads in Java
Threads in JavaThreads in Java
Threads in Java
 
Presentation 4th
Presentation 4thPresentation 4th
Presentation 4th
 
Java session13
Java session13Java session13
Java session13
 
Java Tutorials
Java Tutorials Java Tutorials
Java Tutorials
 
Java tutorial for Beginners and Entry Level
Java tutorial for Beginners and Entry LevelJava tutorial for Beginners and Entry Level
Java tutorial for Beginners and Entry Level
 

Similar to EKON 23 Code_review_checklist

Metrics ekon 14_2_kleiner
Metrics ekon 14_2_kleinerMetrics ekon 14_2_kleiner
Metrics ekon 14_2_kleiner
Max Kleiner
 
What’s eating python performance
What’s eating python performanceWhat’s eating python performance
What’s eating python performance
Piotr Przymus
 
Dev buchan 30 proven tips
Dev buchan 30 proven tipsDev buchan 30 proven tips
Dev buchan 30 proven tips
Bill Buchan
 
CodeChecker Overview Nov 2019
CodeChecker Overview Nov 2019CodeChecker Overview Nov 2019
CodeChecker Overview Nov 2019
Olivera Milenkovic
 
maXbox Starter 43 Work with Code Metrics ISO Standard
maXbox Starter 43 Work with Code Metrics ISO StandardmaXbox Starter 43 Work with Code Metrics ISO Standard
maXbox Starter 43 Work with Code Metrics ISO Standard
Max Kleiner
 
Tango with django
Tango with djangoTango with django
Tango with django
Rajan Kumar Upadhyay
 
Automated product categorization
Automated product categorizationAutomated product categorization
Automated product categorization
Andreas Loupasakis
 
Automated product categorization
Automated product categorization   Automated product categorization
Automated product categorization
Warply
 
Pragmatic Code Coverage
Pragmatic Code CoveragePragmatic Code Coverage
Pragmatic Code Coverage
Alexandre (Shura) Iline
 
Lecture 1 (bce-7)
Lecture   1 (bce-7)Lecture   1 (bce-7)
Lecture 1 (bce-7)
farazahmad005
 
How and what to unit test
How and what to unit testHow and what to unit test
How and what to unit test
Eugenio Lentini
 
Thesis Defense (Gwendal DANIEL) - Nov 2017
Thesis Defense (Gwendal DANIEL) - Nov 2017Thesis Defense (Gwendal DANIEL) - Nov 2017
Thesis Defense (Gwendal DANIEL) - Nov 2017
Gwendal Daniel
 
Code Metrics
Code MetricsCode Metrics
Code Metrics
Attila Bertók
 
Rails Tips and Best Practices
Rails Tips and Best PracticesRails Tips and Best Practices
Rails Tips and Best Practices
David Keener
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
Inductive Automation
 
Introduction to OpenSees by Frank McKenna
Introduction to OpenSees by Frank McKennaIntroduction to OpenSees by Frank McKenna
Introduction to OpenSees by Frank McKenna
openseesdays
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
Inductive Automation
 
Intro_2.ppt
Intro_2.pptIntro_2.ppt
Intro_2.ppt
MumitAhmed1
 
Intro.ppt
Intro.pptIntro.ppt
Intro.ppt
SharabiNaif
 
Intro.ppt
Intro.pptIntro.ppt
Intro.ppt
Anonymous9etQKwW
 

Similar to EKON 23 Code_review_checklist (20)

Metrics ekon 14_2_kleiner
Metrics ekon 14_2_kleinerMetrics ekon 14_2_kleiner
Metrics ekon 14_2_kleiner
 
What’s eating python performance
What’s eating python performanceWhat’s eating python performance
What’s eating python performance
 
Dev buchan 30 proven tips
Dev buchan 30 proven tipsDev buchan 30 proven tips
Dev buchan 30 proven tips
 
CodeChecker Overview Nov 2019
CodeChecker Overview Nov 2019CodeChecker Overview Nov 2019
CodeChecker Overview Nov 2019
 
maXbox Starter 43 Work with Code Metrics ISO Standard
maXbox Starter 43 Work with Code Metrics ISO StandardmaXbox Starter 43 Work with Code Metrics ISO Standard
maXbox Starter 43 Work with Code Metrics ISO Standard
 
Tango with django
Tango with djangoTango with django
Tango with django
 
Automated product categorization
Automated product categorizationAutomated product categorization
Automated product categorization
 
Automated product categorization
Automated product categorization   Automated product categorization
Automated product categorization
 
Pragmatic Code Coverage
Pragmatic Code CoveragePragmatic Code Coverage
Pragmatic Code Coverage
 
Lecture 1 (bce-7)
Lecture   1 (bce-7)Lecture   1 (bce-7)
Lecture 1 (bce-7)
 
How and what to unit test
How and what to unit testHow and what to unit test
How and what to unit test
 
Thesis Defense (Gwendal DANIEL) - Nov 2017
Thesis Defense (Gwendal DANIEL) - Nov 2017Thesis Defense (Gwendal DANIEL) - Nov 2017
Thesis Defense (Gwendal DANIEL) - Nov 2017
 
Code Metrics
Code MetricsCode Metrics
Code Metrics
 
Rails Tips and Best Practices
Rails Tips and Best PracticesRails Tips and Best Practices
Rails Tips and Best Practices
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 
Introduction to OpenSees by Frank McKenna
Introduction to OpenSees by Frank McKennaIntroduction to OpenSees by Frank McKenna
Introduction to OpenSees by Frank McKenna
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 
Intro_2.ppt
Intro_2.pptIntro_2.ppt
Intro_2.ppt
 
Intro.ppt
Intro.pptIntro.ppt
Intro.ppt
 
Intro.ppt
Intro.pptIntro.ppt
Intro.ppt
 

More from Max Kleiner

EKON26_VCL4Python.pdf
EKON26_VCL4Python.pdfEKON26_VCL4Python.pdf
EKON26_VCL4Python.pdf
Max Kleiner
 
EKON26_Open_API_Develop2Cloud.pdf
EKON26_Open_API_Develop2Cloud.pdfEKON26_Open_API_Develop2Cloud.pdf
EKON26_Open_API_Develop2Cloud.pdf
Max Kleiner
 
maXbox_Starter91_SyntheticData_Implement
maXbox_Starter91_SyntheticData_ImplementmaXbox_Starter91_SyntheticData_Implement
maXbox_Starter91_SyntheticData_Implement
Max Kleiner
 
Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475
Max Kleiner
 
EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4
Max Kleiner
 
maXbox Starter87
maXbox Starter87maXbox Starter87
maXbox Starter87
Max Kleiner
 
maXbox Starter78 PortablePixmap
maXbox Starter78 PortablePixmapmaXbox Starter78 PortablePixmap
maXbox Starter78 PortablePixmap
Max Kleiner
 
maXbox starter75 object detection
maXbox starter75 object detectionmaXbox starter75 object detection
maXbox starter75 object detection
Max Kleiner
 
BASTA 2020 VS Code Data Visualisation
BASTA 2020 VS Code Data VisualisationBASTA 2020 VS Code Data Visualisation
BASTA 2020 VS Code Data Visualisation
Max Kleiner
 
EKON 24 ML_community_edition
EKON 24 ML_community_editionEKON 24 ML_community_edition
EKON 24 ML_community_edition
Max Kleiner
 
maxbox starter72 multilanguage coding
maxbox starter72 multilanguage codingmaxbox starter72 multilanguage coding
maxbox starter72 multilanguage coding
Max Kleiner
 
EKON 12 Running OpenLDAP
EKON 12 Running OpenLDAP EKON 12 Running OpenLDAP
EKON 12 Running OpenLDAP
Max Kleiner
 
EKON 12 Closures Coding
EKON 12 Closures CodingEKON 12 Closures Coding
EKON 12 Closures Coding
Max Kleiner
 
NoGUI maXbox Starter70
NoGUI maXbox Starter70NoGUI maXbox Starter70
NoGUI maXbox Starter70
Max Kleiner
 
maXbox starter69 Machine Learning VII
maXbox starter69 Machine Learning VIImaXbox starter69 Machine Learning VII
maXbox starter69 Machine Learning VII
Max Kleiner
 
maXbox starter68 machine learning VI
maXbox starter68 machine learning VImaXbox starter68 machine learning VI
maXbox starter68 machine learning VI
Max Kleiner
 
maXbox starter67 machine learning V
maXbox starter67 machine learning VmaXbox starter67 machine learning V
maXbox starter67 machine learning V
Max Kleiner
 
maXbox starter65 machinelearning3
maXbox starter65 machinelearning3maXbox starter65 machinelearning3
maXbox starter65 machinelearning3
Max Kleiner
 
EKON22_Overview_Machinelearning_Diagrams
EKON22_Overview_Machinelearning_DiagramsEKON22_Overview_Machinelearning_Diagrams
EKON22_Overview_Machinelearning_Diagrams
Max Kleiner
 
Ekon22 tensorflow machinelearning2
Ekon22 tensorflow machinelearning2Ekon22 tensorflow machinelearning2
Ekon22 tensorflow machinelearning2
Max Kleiner
 

More from Max Kleiner (20)

EKON26_VCL4Python.pdf
EKON26_VCL4Python.pdfEKON26_VCL4Python.pdf
EKON26_VCL4Python.pdf
 
EKON26_Open_API_Develop2Cloud.pdf
EKON26_Open_API_Develop2Cloud.pdfEKON26_Open_API_Develop2Cloud.pdf
EKON26_Open_API_Develop2Cloud.pdf
 
maXbox_Starter91_SyntheticData_Implement
maXbox_Starter91_SyntheticData_ImplementmaXbox_Starter91_SyntheticData_Implement
maXbox_Starter91_SyntheticData_Implement
 
Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475
 
EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4
 
maXbox Starter87
maXbox Starter87maXbox Starter87
maXbox Starter87
 
maXbox Starter78 PortablePixmap
maXbox Starter78 PortablePixmapmaXbox Starter78 PortablePixmap
maXbox Starter78 PortablePixmap
 
maXbox starter75 object detection
maXbox starter75 object detectionmaXbox starter75 object detection
maXbox starter75 object detection
 
BASTA 2020 VS Code Data Visualisation
BASTA 2020 VS Code Data VisualisationBASTA 2020 VS Code Data Visualisation
BASTA 2020 VS Code Data Visualisation
 
EKON 24 ML_community_edition
EKON 24 ML_community_editionEKON 24 ML_community_edition
EKON 24 ML_community_edition
 
maxbox starter72 multilanguage coding
maxbox starter72 multilanguage codingmaxbox starter72 multilanguage coding
maxbox starter72 multilanguage coding
 
EKON 12 Running OpenLDAP
EKON 12 Running OpenLDAP EKON 12 Running OpenLDAP
EKON 12 Running OpenLDAP
 
EKON 12 Closures Coding
EKON 12 Closures CodingEKON 12 Closures Coding
EKON 12 Closures Coding
 
NoGUI maXbox Starter70
NoGUI maXbox Starter70NoGUI maXbox Starter70
NoGUI maXbox Starter70
 
maXbox starter69 Machine Learning VII
maXbox starter69 Machine Learning VIImaXbox starter69 Machine Learning VII
maXbox starter69 Machine Learning VII
 
maXbox starter68 machine learning VI
maXbox starter68 machine learning VImaXbox starter68 machine learning VI
maXbox starter68 machine learning VI
 
maXbox starter67 machine learning V
maXbox starter67 machine learning VmaXbox starter67 machine learning V
maXbox starter67 machine learning V
 
maXbox starter65 machinelearning3
maXbox starter65 machinelearning3maXbox starter65 machinelearning3
maXbox starter65 machinelearning3
 
EKON22_Overview_Machinelearning_Diagrams
EKON22_Overview_Machinelearning_DiagramsEKON22_Overview_Machinelearning_Diagrams
EKON22_Overview_Machinelearning_Diagrams
 
Ekon22 tensorflow machinelearning2
Ekon22 tensorflow machinelearning2Ekon22 tensorflow machinelearning2
Ekon22 tensorflow machinelearning2
 

Recently uploaded

一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
ecqow
 
SCALING OF MOS CIRCUITS m .pptx
SCALING OF MOS CIRCUITS m                 .pptxSCALING OF MOS CIRCUITS m                 .pptx
SCALING OF MOS CIRCUITS m .pptx
harshapolam10
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Sinan KOZAK
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
171ticu
 
Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...
Prakhyath Rai
 
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
shadow0702a
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
VANDANAMOHANGOUDA
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
Gino153088
 
Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...
bijceesjournal
 
Mechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdfMechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdf
21UME003TUSHARDEB
 
CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1
PKavitha10
 
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
MadhavJungKarki
 
Software Engineering and Project Management - Software Testing + Agile Method...
Software Engineering and Project Management - Software Testing + Agile Method...Software Engineering and Project Management - Software Testing + Agile Method...
Software Engineering and Project Management - Software Testing + Agile Method...
Prakhyath Rai
 
Design and optimization of ion propulsion drone
Design and optimization of ion propulsion droneDesign and optimization of ion propulsion drone
Design and optimization of ion propulsion drone
bjmsejournal
 
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
PriyankaKilaniya
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 
AI for Legal Research with applications, tools
AI for Legal Research with applications, toolsAI for Legal Research with applications, tools
AI for Legal Research with applications, tools
mahaffeycheryld
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
Divyanshu
 

Recently uploaded (20)

一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
 
SCALING OF MOS CIRCUITS m .pptx
SCALING OF MOS CIRCUITS m                 .pptxSCALING OF MOS CIRCUITS m                 .pptx
SCALING OF MOS CIRCUITS m .pptx
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
 
Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...
 
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
 
Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...Rainfall intensity duration frequency curve statistical analysis and modeling...
Rainfall intensity duration frequency curve statistical analysis and modeling...
 
Mechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdfMechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdf
 
CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1
 
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
 
Software Engineering and Project Management - Software Testing + Agile Method...
Software Engineering and Project Management - Software Testing + Agile Method...Software Engineering and Project Management - Software Testing + Agile Method...
Software Engineering and Project Management - Software Testing + Agile Method...
 
Design and optimization of ion propulsion drone
Design and optimization of ion propulsion droneDesign and optimization of ion propulsion drone
Design and optimization of ion propulsion drone
 
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 
AI for Legal Research with applications, tools
AI for Legal Research with applications, toolsAI for Legal Research with applications, tools
AI for Legal Research with applications, tools
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
 

EKON 23 Code_review_checklist

  • 1. Code Review Checklist How far is a code review going? “Metrics measure the design of code after it has been written, a Review proofs it and Refactoring improves code.”
  • 2. 2 The Problem is • That the problem of source code smells is additive (new bugs arise but the old ones stay) • Das kann bei uns nicht passieren! – wieso ist das denn passiert? • Management is arrogance and developers are too proud to admit mistakes • Programmers don't die, they just GOSUB without RETURN.
  • 3. 3 Improve the Situation Agenda • Check your Documents with UML API? • A Docu Structure to the 5 Top Level Metrics • Back to Source Code Bugs & Smells • Improve your Code (Metric Based Refactoring) • Optimisation and Tools
  • 4. 4 API Layers to Structure Metrics are for detecting bad code entities • Function calls for type • Class blocks for object • Module components for file • Library package for directory • Framework deployment for device UEB: 640_API_LayerDetection_EKON23.TXT
  • 5. 5 API Layers to UML! Metrics are for detecting bad code entities • Function calls for Sequence Diagram • Class blocks for Class Diagram • Module components for Com.Diagram • Library package for Package Diagram • Framework deployment for Dep.D http://www.kleiner.ch/kleiner/UML_bigpicture.pdf
  • 6. 6 What‘s API Layering? Bad Coordination possible • Function with Threads • Class Access on objects with Null Pointer • Module Bad Open/Close of Input/Output Streams or I/O Connections component • Package return values or package namespace • Framework in deployment code • Docker Composer Access of Container image constructor on non initialized vars
  • 7. 7 Metrics deal with Bad Structure (how cohesion & coupling) • General Code Size (in module) • Cohesion (in classes and inheritance) • Complexity • Coupling (between classes or units) • Cyclic Dependency, Declare+Definition, ACD-Metric • Interfaces or Packages (design & runtime) • Static, Public, Private (inheritance or delegate) UEB: 10_pas_oodesign_solution.txt
  • 8. 8 Finally you can measure: Bad Habit (no naming convention, no coverage) Duplicated, dead code (side effects), bugs & smells Long Methods (to much code), missing layering Temporary Fields (confusion), comments or docs Long Parameter List (Object is missing) Data Classes (no methods) • Large Class with too many delegating methods In a Kiviat Chart you get a Best Practices Circle! UEB: 33_pas_cipher_file_1.txt
  • 10. 10 Review Doc Map TIOBE Metrics SONAR Rule Set 1. Code coverage [4] Coverage 2. Abstract documentation [6,8] Size, Issues 3. Cyclomatic complexity [7,3] Complexity, Maintainability 4. Compiler warnings [1] Reliability 5. Coding standards [1,3] Reliability, Maintainability 6. Code duplication [5] Duplication 7. Fan out [3,5] Maintainability, Duplication 8. Security flaws [2] Security https://www.tiobe.com/tqi/definition/ https://www.sonarqube.org/
  • 11. 11 Review Doc Structure II • Reliability means less Bugs The degree to which a system or component performs specified functions under specified conditions for a specified period of time. • Security means less Vulnerability The degree of protection of information and data so that unauthorized persons or systems cannot read or modify them and authorized persons or systems are not denied access to them. • Maintainability means less Code Smells The degree of effectiveness and efficiency with which the product can be modified in the sense of measured code smells which a non compliant to coding conventions or standards. • Operability means less Complexity The degree to which the product has attributes that enable it to be understood, learned, used and attractive to the user, when used under specified conditions. • Functionality means more Coverage and Size It measures the minimum number of test cases required for full test coverage.
  • 13. 13 When and why Metrics ? Before a Code Review By changes of a release Redesign with UML (Patterns or Profiles) Law of Demeter not passed Bad Testability (FAT or SAT) • Work on little steps at a time • Modify not only structure but also code format
  • 14. 14 Some Kind of wonderful ? • statusbar1.simpletext • simplepanel:= true! • TLinarBitmap = TLinearBitmap; //Spelling bug • aus Win32.VCL.Dialogs.pas • WndProcPtrAtom: TAtom = 0; • aus indy: self.sender! • procedure TIdMessageSender_W(Self: TIdMessage; const T: TIdEmailAddressItem); • begin Self.Sender := T; end; UEB: 8_pas_verwechselt.txt
  • 15. 15 Metric/Review Checklist 1. Standards - are the Pascal software standards for name conventions being followed? 2. Are all program headers completed? 3. Are changes commented appropriately? 4. Are release notes Clear? Complete? 5. Installation Issues, Licenses, Certs. Are there any? 6. Version Control, Are output products clear? 7. Test Instructions - Are they any? Complete? 8. "Die andere Seite, sehr dunkel sie ist" - "Yoda, halt's Maul und iß Deinen Toast!"
  • 16. 16 Top Ten Metrics 1. VOD Violation of Law of Demeter 2. Halstead NOpmd (Operands/Operators) 3. DAC (Data Abstraction Coupling)(Too many responsibilities or references in the field) 4. CC (Complexity Report), McCabe cyclomatic complexity, Decision Points) 5. CBO (Coupling between Objects) Modularity
  • 17. 17 Top Ten II 6. PUR (Package Usage Ratio) access information in a package from outside 7. DD Dependency Dispersion (SS, Shotgun Surgery (Little changes distributed over too many objects or procedures  patterns missed)) 8. CR Comment Relation 9. MDC (Module Design Complexity (Class with too many delegating methods) 10. NORM (remote methods called (Missing polymorphism))
  • 18. 18 Law of Demeter 1. [M1] an Objekt O selbst Bsp.: self.initChart(vdata); 2. [M2] an Objekte, die als Parameter in der Nachricht m vorkommen Bsp.: O.acceptmemberVisitor(visitor) visitor.visitElementChartData; 3. [M3] an Objekte, die O als Reaktion auf m erstellt Bsp.: visitor:= TChartVisitor.create(cData, madata); 4. [M4] an Objekte, auf die O direkt mit einem Member zugreifen kann Bsp.: O.Ctnr:= visitor.TotalStatistic
  • 19. 19 Demeter Test as SEQ UEB: 56_pas_demeter.txt
  • 20. 20 DAC or Modules of Classes Large classes with to many references • More than seven or eight variables • More than fifty methods • You probably need to break up the class in Components (Strategy, Composite, Decorator) TWebModule1 = class(TWebModule) HTTPSoapDispatcher1: THTTPSoapDispatcher; HTTPSoapPascalInvoker1: THTTPSoapPascalInvoker; WSDLHTMLPublish1: TWSDLHTMLPublish; DataSetTableProducer1: TDataSetTableProducer;
  • 21. 21 CC • Check Complexity function IsInteger(TestThis: string): Boolean; begin try StrToInt(TestThis); except on EConvertError do result:= False; else result:= True; end; end; Ueb: 164_code_reviews.txt
  • 23. 23 DD – Test keywords knowledge Procedure CopyRecord(const SourceTable, DestTable: TTable); var i: Word; begin DestTable.Append; For i:= 0 to SourceTable.FieldCount - 1 do DestTable.Fields[i].Assign(SourceTable.Fields[i]); DestTable.Post; end;
  • 24. 24 DD – use small procedures Procedure CopyRecord(const SourceTable, DestTable: TTable); var i: Word; begin DestTable.Append; For i:= 0 to SourceTable.FieldCount - 1 do DestTable.Fields[i].Assign(SourceTable.Fields[i]); DestTable.Post; end;
  • 25. 25 Why is Refactoring important? • Only defense against software decay. • Often needed to fix reusability bugs. • Lets you add patterns or templates after you have written a program; • Lets you transform program into framework. • Estimation of the value (capital) of code! • Necessary for beautiful software.
  • 26. 26 Refactoring Process The act of serialize the process:  Build unit test  Refactor and test the code (iterative!)  Check with Analyzer or another tool  Build the code  Running all unit tests  Generating the documentation  Deploying to a target machine  Performing a “smoke test” (just compile)
  • 27. 27 Let‘s practice • 1 • 11 • 21 • 1211 • 111221 • 312211 • ??? Try to find the next pattern, look for a rule or logic behind !
  • 28. 28 Before R. function runString(Vshow: string): string; var i: byte; Rword, tmpStr: string; cntr, nCount: integer; begin cntr:=1; nCount:=0; Rword:=''; //initialize tmpStr:=Vshow; // input last result for i:= 1 to length(tmpStr) do begin if i= length(tmpstr) then begin if (tmpStr[i-1]=tmpStr[i]) then cntr:= cntr +1; if cntr = 1 then nCount:= cntr Rword:= Rword + intToStr(ncount) + tmpStr[i] end else if (tmpStr[i]=tmpStr[i+1]) then begin cntr:= cntr +1; nCount:= cntr; end else begin if cntr = 1 then cntr:=1 else cntr:=1; //reinit counter! Rword:= Rword + intToStr(ncount) + tmpStr[i] //+ last char(tmpStr) end; end; // end for loop result:=Rword; end; UEB: 9_pas_umlrunner.txt
  • 29. 29 After R. function charCounter(instr: string): string; var i, cntr: integer; Rword: string; begin cntr:= 1; Rword:=' '; for i:= 1 to length(instr) do begin //last number in line if i= length(instr) then concatChars() else if (instr[i]=instr[i+1]) then cntr:= cntr +1 else begin concatChars() //reinit counter! cntr:= 1; end; end; //for result:= Rword; end; UEB: 12_pas_umlrunner_solution.txt
  • 30. 30 Refactoring Methods Einheit Refactoring Funktion Beschreibung Package Rename Package Rename of Packages Class Move Method Remove of Methods Class Extract Superclass Aus Methoden, Eigenschaften eine Oberklasse erzeugen und verwenden Class Introduce Parameter Replace of Expression w. Methodparameter Class Extract Method Heraustrennen einer Codepassage Interface Extract Interface Aus Methoden ein Interface erzeugen Interface Use Interface Erzeuge Referenzen auf Klasse Component Replace Inheritance with Delegation Ersetze vererbte Methoden durch Delegation in innere Klasse Class Encapsulate Fields Getter- and Setter capsulate Model Safe Delete Delete a Class with References
  • 31. 31 Metric based Refactoring :ExtractMethod(EM)-MoveMethod(MM)-DataObject(DO)-ExtractClass(EC) EM MM DO EC • Normalized Cohesion W B B B • Non-normalized Cohesion W B B B • General Coupling E B N S • Export Coupling E B E E • Aggregated import coupling B W W W • Best, Worst, Expected, Suboptimal
  • 32. 32 Audits & Metric Links: • https://www.sonarqube.org/ • http://www.softwareschule.ch/ • Report Pascal Analyzer: http://www.softwareschule.ch/download/pascal_analyzer.pdf • Refactoring Martin Fowler (1999, Addison-Wesley) • http://c2.com/cgi/wiki?CodeSmell • https://www.slideshare.net/maxkleiner1/code-review-with-sonar • Model View in Together: • www.softwareschule.ch/download/delphi2007_modelview.pdf