150 likes | 287 Vues
Code metrics play a crucial role in software engineering by quantitatively assessing various attributes of software code to identify potential issues and ensure maintainability. By employing measurement processes, developers can detect design flaws, improve code quality, and mitigate risks. This article discusses the significance of mature technologies, larger scale operations, and the necessity for better control in software measurement. Additionally, it introduces an Eclipse-based plug-in tool that utilizes abstract syntax trees (AST) for parsing code to generate meaningful metrics that indicate problematic code segments, helping developers maintain high coding standards.
E N D
Software Measurement Why? • Mature technologies • Larger scale • Pursue better control and management • Needs for maintain and refractory
Software Measurement What? • Measurement is a process to assign numbers for each attribute or factor of an object or an event according to rules. • Key: rules, attributes • We use measurement to get quantified assessment for a software.
Software Metrics • A metric is a measurement function. Software Data Numerical data Metric
Metric for code • Code analysis can reflect potential problems in SW design. • Code quality is related to future maintenance and reuse. • Code metric can help developers to avoid fatal design problem and mitigate risks. E.g. Visual Studio 2008 - Code Metrics Sourceforge - Metrics 1.3.6
Metric for code • Metric Step: • Abstract common flaws in coding, like a data class, useless method or duplicated code fragment. • Define a metric rule, like fetch similarity of two code fragment. • Associate a metric rule with a abstract code characteristic. • Get metric value via computing
Metric for code • Framework Software Choose Model Metric result UI Collected data Factor computing Core computing Data storage Repository Model Template Result
Code Bad Smells • Object-Oriented design • To indicate problematic classes or method • Use metrics to provide evidence • E.g. Data Class God Class God Method Feature Envy
My metric tool • Eclipse based plug-in • Parse code and generate AST(Abstract syntax tree) • Using JDT to get elements in a compile unit • Computing values to indicate potential problematic code(bad smells)
My metric tool • Eclipse based plug-in • Parse code and generate AST(Abstract syntax tree) • Using JDT to get elements in a compile unit • Computing values to indicate potential problematic code(bad smells)
Thanks Questions?