代写代考 COMP3053.SQA

COMP3053.SQA

¡ Some of the materials we use may come directly from previous teachers of this module, and other sources …
¡ Thank you to (amongst others):

Copyright By PowCoder代写 加微信 powcoder

▪ , , , , , Julie Greensmith, , T.Y. Chen,
COMP3053.SQA.12: Software Metrics

¡ Measure – A quantitative indication of extent, amount, dimension, capacity, or size of some attribute of a product or process
§ for example: Lines of code (LOC), Number of errors
¡ Metric – quantitative measure of degree to which a system,
component or process possesses a given attribute
§ a “derived measure”
§ may involve “guesstimates” where human processes are
§ for example: Error density
COMP3053.SQA.12: Software Metrics

¡ To determine the quality of the current product or process and to make informed comparisons
¡ To predict qualities of a product/process § (might use Ishikawa’s tools)
¡ To improve quality of a product/process § (often continuously – Kaizen)
COMP3053.SQA.12: Software Metrics

¡ Error rates / Defect rates
¡ A defect is a failure to do something
¡ An error is a wrong result or illegal action
¡ Code generation rates
¡ Measured by: § per person
§ per team
§ per project
¡ Errors should be categorized by origin, type etc.
COMP3053.SQA.12: Software Metrics

¡ Products
§ Explicit results of software development activities
§ Deliverables, documentation, other artifacts produced
¡ Processes
§ Activities related to production of software
¡ Resources
§ Inputs into the software development activities § hardware, knowledge, people
COMP3053.SQA.12: Software Metrics

¡Good (modernish) list of measures § http://arisa.se/compendium/
COMP3053.SQA.12: Software Metrics

§ Rates of production / productivity § Quality of estimates
§ Burn down rate – project velocity § Refactoring rate
¡ These can lead to long term process improvement § Need “kaizen” days
COMP3053.SQA.12: Software Metrics

§ Error densities
§ Complexity measures
§ Code quality measures
§ Speed and memory measures § Code profiles etc.
§ Track potential risks
§ Uncover problem areas
§ Adjust workflow or tasks
¡ Evaluate team’s ability to control quality
COMP3053.SQA.12: Software Metrics

¡Direct Measures
§Cost, effort, LOC, speed, memory
¡Indirect Measures
§need human estimate §Functionality, quality, efficiency,
reliability, maintainability
COMP3053.SQA.12: Software Metrics

¡ Size of the software produced § LOC – Lines Of Code
▪ KLOC – 1000 Lines Of Code
§ SLOC – Statement Lines Of Code (ignore whitespace)
¡ Typical Measures:
§ Errors/KLOC, Defects/KLOC, Cost/LOC,
Documentation Pages/KLOC
COMP3053.SQA.12: Software Metrics

¡Easy to use
¡Easy to compute
¡Language & programmer dependent ¡Can be counter-productive if used
as a basis for reward! § Why?
COMP3053.SQA.12: Software Metrics

¡ LOC – a function of complexity
¡ Language and programmer dependent
¡ Halstead’s Software Science (around 1977)
§ (entropy measures)
▪ n1 – number of distinct operators ▪ n2 – number of distinct operands ▪ N1 – total number of operators
▪ N2 – total number of operands
COMP3053.SQA.12: Software Metrics

if (k < 2) { if (k > 3)
¡ Distinctoperators:if(){}><=*; ¡ Distinct operands: k 2 3 x COMP3053.SQA.12: Software Metrics ¡ Amenable to experimental verification [1970s] ¡ Program length: N = N1 + N2 ¡ Program vocabulary: n = n1 + n2 ¡ Estimated length: Nˆ = n1 log2 n1 + n2 log2 n2 § Close estimate of length for well structured programs ¡ Purity ratio: PR = Nˆ /N COMP3053.SQA.12: Software Metrics ¡Volume: V = N log2 n § Number of bits to provide a unique designator for each of the n items in the program vocabulary ¡ Difficulty: ¡ Program effort: E=D*V § This is a good measure of program understandability COMP3053.SQA.12: Software Metrics ¡ McCabe’s metrics are based on a control flow representation of the program ¡ A program graph is used to depict control flow ¡ Nodes represent processing tasks § (one or more code statements) ¡ Edges represent control flow between nodes COMP3053.SQA.12: Software Metrics If-then-else COMP3053.SQA.12: Software Metrics ¡ Set of independent paths through the graph ▪ (basis set) § V(G) = E – N + 2 ▪ E is the number of flow graph edges ▪ N is the number of nodes § V(G) = P + 1 ▪ P is the number of predicate nodes (branching) § See http://en.wikipedia.org/wiki/Cyclomatic_complexity COMP3053.SQA.12: Software Metrics while (i |Q|
¡ LCOM = 0 otherwise
COMP3053.SQA.12: Software Metrics

¡ Take class C with M1, M2, M3 §I1 ={a,b,c,d,e}
§I2 = {a, b, e}
§I3 = {x, y, z}
§ P = {(I1, I3), (I2, I3)} §Q = {(I1, I2)}
¡ Thus LCOM = 1
COMP3053.SQA.12: Software Metrics

¡ LCOM is the number of empty intersections minus the number of non-empty intersections
¡ This is a notion of degree of similarity of methods
¡ If two methods use common instance variables
then they are similar
¡ LCOM of zero is not maximally cohesive
§ |P| = |Q| or |P| < |Q| COMP3053.SQA.12: Software Metrics §Total number of operations §Number of attributes ¡ May be an indication of too much responsibility for a class ¡ Very simple measure! COMP3053.SQA.12: Software Metrics § A large number for NOO indicates possible problems with the design § Poor abstraction in inheritance hierarchy COMP3053.SQA.12: Software Metrics §The number of operations added by a §As operations are added it is farther away from super class § As depth increases NOA should COMP3053.SQA.12: Software Metrics åMi (Ci ) . i =1 åMa (Ci ) ¡ Mi(Ci) is the number of methods inherited and not overridden in Ci ¡ Ma(Ci) is the number of methods that can be invoked with Ci ¡ Md(Ci) is the number of methods declared in Ci COMP3053.SQA.12: Software Metrics ¡Ma(Ci) = Md(Ci) + Mi(Ci) ¡ All that can be invoked = new or overloaded + things inherited ¡MIF is [0,1] §MIF near 1 means little specialization §MIF near 0 means large change COMP3053.SQA.12: Software Metrics åiåj is_client(Ci ,Cj ) (TC2 -TC) ¡ is_client(x,y) = 1 iff a relationship exists between the client class and the server class. 0 otherwise ¡ (TC2-TC) is the total number of relationships possible ¡ CF is in the [0,1] range § 1 means high coupling COMP3053.SQA.12: Software Metrics ¡Lack of cohesion ¡Percent public and protected ¡Public access to data members COMP3053.SQA.12: Software Metrics ¡Number of root classes ¡Inheritance Fan in – multiple inheritance ¡NOC, DIT, etc. COMP3053.SQA.12: Software Metrics ¡ Per class metrics tend to be better if a lot of small classes are used ¡ If you sum them over all classes the value rises with the size of the system ¡ Average value is useful § Or normalise over KLOC ¡ System coupling measures also increase with the total system size. § Again may be best to normalise over KLOC COMP3053.SQA.12: Software Metrics ¡ The Process § Select appropriate metrics for problem § Utilize metrics on problem § Assessment and feedback § Don’t forget some variations will be a result of the task at hand – a compiler is more complex than a test suite. ¡ Formulate ¡ Analysis ¡ Interpretation ¡ Feedback COMP3053.SQA.12: Software Metrics ¡ http://clarkware.com/software/JDepend.html ¡ CC - Concrete Class Count ¡ AC - Abstract Class (and Interface) Count ¡ Ca - Afferent Couplings (Ca) (fan-out) ¡ Ce - Efferent Couplings (Ce) (fan-in) ¡ A - Abstractness (0-1) ¡ I - Instability (0-1) ¡ D - Distance from the Main Sequence (0-1) ¡ V - Volatility (0-1) ¡ Cyclic - If the package contains a dependency cycle COMP3053.SQA.12: Software Metrics COMP3053.SQA.12: Software Metrics ¡ Perpendicular distance of a package from the idealized line A + I = 1 § This metric is an indicator of the package's balance between abstractness and ¡ A package squarely on the main sequence is optimally balanced with respect to its abstractness and stability § Ideal packages are either completely abstract and stable (x=0, y=1) or completely concrete and unstable (x=1, y=0) ¡ The range for this metric is 0 to 1 § D=0 indicates a package that is coincident with the main sequence § D=1 indicating a package that is as far from the main sequence as possible COMP3053.SQA.12: Software Metrics ¡ OO metric calculation tool for Java code § Created at Swinburne University of Technology ▪ ... what other cool things are linked to Swinburne? ¡ Metrics § Lines Of Code per class (LOC) § Cyclomatic complexity § LCOM (by Henderson-Seller) COMP3053.SQA.12: Software Metrics ¡ So far looked at individual measures § Manager wants to know: ▪ Isthecodegoodoverall ▪ Whoisatfault ¡ We need to know if we can aggregate § What aggregate can be useful ▪ Average ▪ Weightedmean ¡ Mordel et al. “Software quality metrics aggregation in industry”, Journal of Software: Evolution and Process, 2013, Vol. 25, no. 10, pp. 1117-1135 COMP3053.SQA.12: Software Metrics ¡ Software metrics can give much useful information about the quality of code ¡ They allow comparisons between projects, developers and teams and over time ¡ They suggest areas for improvement and give early warnings of problems (as in manufacturing process metrics) ¡ They need to be interpreted with some care as not all projects/tasks are equal ¡ Management need to know what quality problems exist but § Developer should know what needs to be corrected COMP3053.SQA.12: Software Metrics 程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com