Codereview Topics
-
Upload
max-kleiner -
Category
Engineering
-
view
58 -
download
4
Transcript of Codereview Topics
1
Code Review CODEsignHard coding (also, hard-coding or hardcoding) refers to the software development practice of embedding what may, perhaps only in retrospect, be regarded as input or configuration data directly into the source code of a program or other executable object.
http://en.wikipedia.org/wiki/Anti-pattern
2
Design & Runtime
TechnischeAnforderungen
Fachliche AnforderungenQ-Anforderungen
Fachmodell Architekturkonzept Funktionsmuster
reference, links
Packages, IAD
configuration Process, Rules, GUI Settings,
Objects, Options, Profiles
Use Case, Activity
Code Review Topics
Analyse
data/function/object layer
source code
DB, XML, properties
literals, res, values
Developer,Admin, User
3
Code Layers Model
4
Report Result Content
Inhaltsverzeichnis1 Zweck des Dokuments 42 Management-Übersicht 43 Ausgangslage 44 Befunde 54.1 Erläuterung Klassifikationsschema 54.2 Clean Code 74.3 Code Conventions 104.3.1 Übergreifend 104.3.2 Delphi 114.3.3 C# /Java 124.3.4 PL/SQL 164.4 Programmierstil 194.5 Einsatz von 3rd Party Libraries 214.6 Verwendung einer Standard Library 234.7 Exception Handling 254.8 Rechtschreibung 264.9 Dokumentation im Source Code 274.10 Testabdeckung 284.11 OOP-Prinzipien 294.12 Verwendung Frameworks 314.13 Verwendung Components 324.14 Dokumentation ausserhalb Source Code 345 Empfohlene Massnahmen 375.1 Etablieren von Continuous Inspection 375.2 Bearbeitung von Befunden 386 Anhang 396.1 Systemtopologie 396.2 Pattern und Metrics of Methods 396.3 VCL or Composite Application Library (CAL) 40
5
Rules• CA1303: Do not pass literals as localized
parameters• public void TimeMethod(int hour, int minute)
{ if (hour < 0 || hour > 23) { MessageBox.Show( "The valid range is 0 - 23."); //CA1303 fires because the parameter for method Show is Text }
• CA1302: Do not hardcode locale specific strings
• static void Main() { string string0 = "C:";
• PMD: Avoid duplicate literals (string or numeric)
6
Found • new Regex(@"\(COM\,\s*IMAX\)\s*\:\s*\((?<pub>[\w\s\-/]
+|\?),\s*(?<istar>[\w\s\-/]+|\?)\)");
• command.CommandText = "select [Name], [EntityNote], [Package], [Stereotype] from [Tabelle1$]";
• var colmXIstar = dataTable.Columns.Add("IMAXSTAR");
• [DataContract(Namespace="http://CH.MX.maXbox.Demo")]• public class ServiceFault }• throws-Declaration: 'DataAccessException‘, catch
(Exception e) {• 1214: LOGGER.error("Setup Fehler", e);
7
ChecksQS Review Checklist**********************************************************1. Standards - are name conventions being followed?2. Bugs Reports- Are the changes generally correct?3. Are the Requirements Well Understood (Multilang)?4. Are all program headers completed?5. Are code changes commented appropriately?6. Does documentation use Correct Diagrams or Grammar?7. Are release notes Clear? Complete?8. Installation Issues, Licenses, Certs. Are there any?9. Version and Build Control, Are output products clear?10.Test Coverage Instructions - Are they any? Complete?http://www.softwareschule.ch/download/codesign_2015.pdf
8
MetricsQS Metric Checklist**********************************************************Metrics Code Reviews deal with Bad Structure• 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)• Quantify your code• Highlight Redesign Needs• Change Impact Analysis
9
Solution• Continuous Inspection We had a dream :
mvn sonar:sonar & together