A Software Engineering Lecture by Steven Choy
Lecture Overview:
This is our last lecture before the course revision classes. In this lecture, we will discuss a number of topics that do not cover in the textbook. They include:
- Software Development Professional - Certification
- Software Development Professional - Ethics and Practices
- Code Complexity Measurement
Software Development Professional
- Certification
- Ethics and Practice
Software Development Professional – Certification
- Different from other mature fields of engineering, such as civil engineering and electrical engineering, the field of software engineering lacks established ways to help developing professional's credentials.
- What does it means to be a professionally qualified software engineer?
- How do you get there?
- In recent years, a number of software engineering certification programs come to address these issues.
CSDP
- IEEE Computer Society's Certified Software Development Professional (CSDP) Program comes provides a solid path to software engineering certification.
- One requirement for CSDP certification is that applicants have to demonstrate mastery of a body of knowledge by passing the CSDP examination.
- The 3.5-hours examination consists of 180 multiple-choice questions drawn from a number of knowledge areas in software engineering.
- Topics
I. Business Practices and Engineering Economics
II. Software Requirements
III. Software Design
IV. Software Construction
V. Software Testing
VI. Software Maintenance
VII. Software Configuration Management
VIII. Software Engineering Management
IX. Software Engineering Process
X. Software Engineering Tools and Methods
XI. Software Quality
- CSDP Sample Questions
- 2. Which of the following is not required of a software component?
[a] A unit of independent deployment
[b] Exploits commonalities in large software systems
[c] A unit of third-party composition
[d] Exposes source code for modification
- 7. During a software development project two similar requirements defects were detected. One was detected in the requirements phase, and the other during the implementation phase. Which of the following statements is mostly likely to be true?
[a] The most expensive defect to correct is the one detected during the requirements phase.
[b] The most expensive defect to correct is the one detected during the implementation phase.
[c] The cost of fixing either defect will usually be similar.
[d] There is no relationship between the phase in which a defect is discovered and its repair cost. .
- 15. Paul has drafted a software project management plan. Which of the following items should be discussed in this plan?
I. Schedule
II. Budget
III. Requirements
IV. Staffing
[a] I, III, IV only
[b] I, II, III only
[c] I, II, IV only
[d] I, II, III, IV
Software Development Professional – Ethics
Software Engineering Ethics and Professional Practices
- PUBLIC - Software engineers shall act consistently with the public interest.
- CLIENT AND EMPLOYER - Software engineers shall act in a manner that is in the best interests of their client and employer consistent with the public interest.
- PRODUCT - Software engineers shall ensure that their products and related modifications meet the highest professional standards possible.
- JUDGMENT - Software engineers shall maintain integrity and independence in their professional judgment.
- MANAGEMENT - Software engineering managers and leaders shall subscribe to and promote an ethical approach to the management of software development and maintenance.
- PROFESSION - Software engineers shall advance the integrity and reputation of the profession consistent with the public interest.
- COLLEAGUES - Software engineers shall be fair to and supportive of their colleagues.
- SELF - Software engineers shall participate in lifelong learning regarding the practice of their profession and shall promote an ethical approach to the practice of the profession.
Code Complexity Measurement
Code Complexity Measurement (Overview)
- How do you measure the code complexity of a software?
- LOC (line of code)
- Halstead's software science
- Cyclomatic number
- Function points
Function Points
- Developed in 1979
- Function Points measure a system from its functional perspective independent of technology (tool/programming language)
- A better alternative to measure code size or complexity than LOC
Function Points Analysis
- For measurement, function points analysis identifies five user function types:
- External input (EI) – data enter the system to access/update an internal logical file (e.g. data from input screen or other applications)
- External output (EO) – data leave the system for the outside world
- External inquiry (EQ) – data enter and leave the system without modifying an internal logical file
- Internal logical file (ILF) – a group of record element types (RET) that are often accessed at the same time
- External logical file (EIF) – a group of record element types (RET) that are often accessed together by this application
Complexity Multiplier
- Each component is assigned with a ranking (low, average or high)
|
| Complexity Multiplier
|
|
| Low
| Average
| High
|
| EI
| 3
| 4
| 6
|
| EO
| 4
| 5
| 7
|
| EQ
| 3
| 4
| 6
|
| ILF
| 7
| 10
| 15
|
| ELF
| 5
| 7
| 10
|
Calculating Function Points
- Suppose the system has 21 EIs in total:
- 7 at low complexity
- 9 at average complexity
- 5 at high complexity
- What's the function points contributed by the above EI?
- By looking up the complexity multiplier table, the multiplier of EIs are:
- low complexity ⇒ 3
- average complexity ⇒ 4
- High complexity ⇒ 6
- So, function points for EI is:
- (7x3) + (9x4) + (5x6) = 87
- Function points for other user function types can be calculated using the above method
User Function Complexity
- How do you determine the complexity of a user function types?
- An International Function Point Users' Group (IFPUG) proposed some rules to determine the complexity
- The following table shows how EI's complexity is determined:
| Number of file element types
| Number of data element types
|
| 1-4
| 5-15
| 16 or more
|
| 1
| Low
| Low
| Average
|
| 2
| Low
| Average
| High
|
| 3 or more
| Average
| High
| High
|
- Definition:
- A "Data element type" is a field
- A "record element type" is a group of related fields
- A "file element type" is a group of record element types that is often accessed together
Adjusting Function Points
- What we have calculated before is just known as an "unadjusted function point"
- The unadjusted function points do not capture all aspects of complexity such as performance, data communication, reusability, etc.
- To calculate the "adjusted" FP, 14 additional factors are taken into account
- Each factor is assigned with a value of 0 to 5 based on their influence
Calculating the "Adjusted FP"
- To calculate the "Adjusted FP", we first sum up all the influenced factors to get the degree of influence (DI) (i.e. 31)
- We then determine the technical complexity adjustment (TCA):
- TCA = 0.65 + (0.01 x DI)
- i.e. TCA = 0.65 + (0.01 x 31) = 0.96
- Finally, the adjusted FP:
- Adjusted FP = unadjusted FP x TCA
| Factor
| Rating
|
| Data Communication
| 0
|
| Distributed Functions
| 0
|
| Performance
| 2
|
| Heavy Hardware Usage
| 2
|
| Transaction Rate
| 1
|
| Online data entry
| 3
|
| End-user Efficiency
| 4
|
| Online Update
| 4
|
| Complex Processing
| 2
|
| Reusability
| 3
|
| Ease of installation
| 3
|
| Ease of operation
| 1
|
| Multiple Sites
| 3
|
| Ease of modification
| 3
|
- Eg. Adding up the values,we have a DI value of 31.
- TCA = 0.65 + (0.01 x 31) = 0.96
- If the unadjusted FP is 700, the adjusted FP will be
Object-Oriented Measurement
- Rule of thumb: Low coupling, High cohesion
- How do you measure the cohesion of methods?
- Lack of cohesion of methods (LCOM)
How LCOM measures cohesion?
- The LCOM of a class is defined as:
- LCOM = no. of dissimilar pairs – no. of similar pairs
- A low value of LCOM ⇒ a highly cohesive class
Similar & Dissimilar Pairs
- If two methods access the same data member, they are said to be similar
- If two methods do not access the same data member, they are said to be dissimilar
Example: Calculating LCOM
- Given the following access information of a class, where m1,m2,m3 are methods and d1,d2,d3,d4,d5 are data members, calculate the LCOM value.
|
| d1
| d2
| d3
| d4
| d5
|
| m1
| x
|
| x
|
|
|
| m2
|
|
|
| x
|
|
| m3
|
| x
|
| x
| x
|
- Similar pairs: (m2,m3)
- Dissimilar pairs: (m1,m3), (m1,m2)
- Applying the LCOM formula:
- LCOM = no. of dissimilar pairs – no. of similar pairs = 2 – 1 = 1
- NOTE: If you have a negative LCOM value, assign it to zero
|
| v1
| v2
| v3
| v4
| v5
| v6
|
| m1
| X
|
| X
|
|
|
|
| m2
| X
|
|
| X
|
|
|
| m3
|
| X
|
| X
| X
|
|
| m4
|
|
| X
|
| X
| X
|
- 4 similar pairs: (m1,m2), (m2,m3), (m3, m4), (m1,m4)
- 2 dissimilar pairs: (m1,m3), (m2,m4)
- LCOM = 2 -4 = -2, which is 0
Cyclomatic number
- Measure the complexity of a program module by the number of branches
- Simplest program: no branch at all. Lowest possible cyclomatic number of 1.
- Cyclomatic number of a program is defined as the number of branches plus one.
- Consider the following:
- A program with no conditional statement
- A program with "if-then-else"
- A program with nested conditional statements
Halstead's software science
- Based on 4 fundamental variables:
- n1: no. of distinct operators used in a program. It includes all the arithmetic and logical operators and method names
- n2: no. of distinct operands in a program. It includes variables and constants
- N1: no. of times operators are used
- N2: no. of times operands are used
- A program's vocabulary (n) is defined as n = n1+ n2
- A program's length (N) is defined as N = N1 + N2
- A program's volume (V) is defined as V= N log2 n
Many readers were not convinced of the accuracy and validity of software science
Extra materials for your to probe further
The followings links let you probe further for the various topics in this lecture.
Something more that I want to let you konw (maybe good to you):
Rule of Modularity: Write simple parts connected by clean interfaces.
Rule of Clarity: Clarity is better than cleverness.
Rule of Composition: Design programs to be connected with other programs.
Rule of Separation: Separate policy from mechanism; separate interfaces from engines.
Rule of Simplicity: Design for simplicity; add complexity only where you must.
Rule of Parsimony: Write a big program only when it is clear by demonstration that nothing else will do.
Rule of Transparency: Design for visibility to make inspection and debugging easier.
Rule of Robustness: Robustness is the child of transparency and simplicity.
Rule of Representation: Fold knowledge into data, so program logic can be stupid and robust.
Rule of Least Surprise: In interface design, always do the least surprising thing.
Rule of Silence: When a program has nothing surprising to say, it should say nothing.
Rule of Repair: Repair what you can — but when you must fail, fail noisily and as soon as possible.
Rule of Economy: Programmer time is expensive; conserve it in preference to machine time.
Rule of Generation: Avoid hand-hacking; write programs to write programs when you can.
Rule of Optimization: Prototype before polishing. Get it working before you optimize it.
Rule of Diversity: Distrust all claims for one true way.
Rule of Extensibility: Design for the future, because it will be here sooner than you think.
Thanks for Reading
If you would rather like to have this lecture note in printed format, please click the print action link in the top right corner.
If you find any problem in this lecture note, please feel free to tell Steven by steven@findaway.hk