36
Teaching Software Teaching Software Maintenance using Maintenance using .NET and Rotor .NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Embed Size (px)

Citation preview

Page 1: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Teaching Software Teaching Software Maintenance using Maintenance using

.NET and Rotor.NET and Rotor

Leonardo BottaciUniversity of Hull, Hull, UK

Page 2: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

.NET MSc in Distributed .NET MSc in Distributed Systems DevelopmentSystems Development

.NET MSc in Distributed .NET MSc in Distributed Systems DevelopmentSystems Development

• Aims – Teach the knowledge and skills to develop and maintain

large scale systems software.

• Modules– C#– .NET Framework– Software maintenance– Distributed systems programming– Virtual machine architectures– Trustworthy computing

Page 3: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Software Maintenance Software Maintenance ModuleModuleSoftware Maintenance Software Maintenance ModuleModule• Aims

– The management and practice of software systems maintenance

• Difficulties – No general systematic organised body of

knowledge, there is no theory. – Little enthusiasm or glamour, programmers

feel constrained by legacy and commercial constraints.

Page 4: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Student backgroundStudent backgroundStudent backgroundStudent background

• Degree in computer science or equivalent experience.

• No student very experienced in– object oriented languages– language implementation– runtime systemsRelevant for the practical work

Page 5: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Software Maintenance Software Maintenance ModuleModuleSoftware Maintenance Software Maintenance ModuleModule• Teaching strategy

– Student centred learning through practical experience.

– Laboratory practical work 2 supervised hours per week, 1 lecture per week.

– Students may also ask me questions outside those times.

Page 6: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Software maintenance Software maintenance management: 1management: 1

Software maintenance Software maintenance management: 1management: 1

• Why manage– Commercial constraints

• Process models– IEEE standard

• Matching process models to different types of organisation and situations– Legacy systems– Safety critical– Rapid applications development

Page 7: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Software maintenance Software maintenance management: 2management: 2

Software maintenance Software maintenance management: 2management: 2

• Configuration management– Requirements driven– Tools

• Code modified in practical work managed using VSS

• Cost estimation– Formal, organisational level

• Metrics, statistical regression

– Less formal, individual level

Page 8: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Software maintenance Software maintenance management: 3management: 3

Software maintenance Software maintenance management: 3management: 3

• Maintenance through reuse– All levels, from ideas to code

• Program design– Program objects should model stable

application objects– Functionality is usually not stable– Seminar discussion of examples from JSD.NET contribution to reuse covered in another module

Page 9: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Maintenance practiceMaintenance practiceMaintenance practiceMaintenance practice

• Course practical work, 100% of credit– Objective: Learn how to maintain

software– Context: Modification of the jscript

compiler in Rotor to produce a program dependency graph

• Emphasis on the learning objective– Student background varies.

Page 10: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Learning StrategyLearning StrategyLearning StrategyLearning Strategy– Student centred learning through

practical experience. – Practice alone reinforces current

behaviour.

Acquire experience Learn from experience

Page 11: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Assessing learningAssessing learningAssessing learningAssessing learning

In order of importance:• Evidence of learning in the logbook• Student contribution to seminars and

lab discussions• Assessment of modified software

Safe environment for sensible risk taking

Page 12: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Why use Rotor?Why use Rotor?Why use Rotor?Why use Rotor?

• Code contains very few comments• Code sufficiently readable for

students to make progress in the relatively short time allocated for a module

• Students motivated by “real” code

Page 13: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Initial lab exercisesInitial lab exercisesInitial lab exercisesInitial lab exercises

• Read the Rotor documentation and build the system

• Try the jscript compiler.– Find, compile and execute a sample

jscript program

• Modify the jscript compiler by adding a print message, rebuild and recompile jscript sample.

Page 14: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Maintenance task stage Maintenance task stage 11

Maintenance task stage Maintenance task stage 11

• Modify the jscript compiler to output the abstract syntax tree (useful in stage 2 of the practical work.)

• Students given a short review of compiler operation, scanner, parser, code generator

• No other information

Page 15: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Student reaction to taskStudent reaction to taskStudent reaction to taskStudent reaction to task• Many questions, I answer very few• The learning more important than the

task– Mantra, logbook

• Some students frustrated, fear of losing marks, try to renegotiate task

• Leads to discussion on the role of risk– need to manage it– university environment relatively safe.

Page 16: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Progress on stage 1Progress on stage 1Progress on stage 1Progress on stage 1• A few students modify scanner to print

characters and tokens, boosts confidence• Students working individually but ideas

spread fast in the lab• Students still cannot find the point at which

the parser returns an abstract syntax tree– Do not know C#– Insufficient analysis of code, tools– cordbg used but not effectively

Page 17: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Code reading skillsCode reading skillsCode reading skillsCode reading skills

• Code reading should be goal-directed– Reading to see what is there– Trying to understand each line

• What are you expecting to find?– Formulate an hypothesis– Read the code to confirm or disprove it.

Page 18: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Code reading Code reading illustration: 1illustration: 1Code reading Code reading illustration: 1illustration: 1

What is the following code doing?

while (...) { ...}

Hypothesise the most popular uses of a loop in general and look at code for evidence.

Page 19: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Code reading Code reading illustration: 2illustration: 2Code reading Code reading illustration: 2illustration: 2

while (...) { sum := sum + a[i]; ...}

Array accumulation a likely hypothesis

Page 20: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Code reading Code reading illustration: 3illustration: 3Code reading Code reading illustration: 3illustration: 3

while (...) { sum := sum + a[i]; if (...) ... else ... ...}Hypotheses to explain the conditional inside

a loop

Page 21: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Code reading Code reading illustration: 4illustration: 4Code reading Code reading illustration: 4illustration: 4

while (...) { sum := sum + a[i]; if (...) done := 1; else ... ...}Flag, is it for early termination?

Page 22: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Code reading Code reading illustration: 5illustration: 5Code reading Code reading illustration: 5illustration: 5

while (i < 9 and done = 0) { sum := sum + a[i]; if (...) done := 1; else ... ...}

Page 23: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Maintenance as goal-Maintenance as goal-directed activity directed activity

Maintenance as goal-Maintenance as goal-directed activity directed activity

• Debugging should be goal-directed– Ineffective experience with cordbg

• Students claim they lack knowledge to formulate goals– Then acquisition of knowledge is goal

• Muted student response– Implications too disturbing

Page 24: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

AST located, how to AST located, how to print?print?

AST located, how to AST located, how to print?print?

• Lack of experience in object-oriented programming

• Mention ToString() after students admit they have found no elegant solution

• Still reluctant– Too ad hoc– Too many classes to modify

• Place students into teams, do not mix ability.

Page 25: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Students recognise lack of Students recognise lack of knowledge in object knowledge in object

orientationorientation

Students recognise lack of Students recognise lack of knowledge in object knowledge in object

orientationorientation• Students uncomfortable with lack of design knowledge

• Students now told to find out about object oriented compilers and object oriented design in general– Use literature, user groups, individuals,

code itself– Some students want to learn too much,

others too little.

Page 26: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Design patternsDesign patternsDesign patternsDesign patterns

• Students prompted to research design patterns– Have just met these in the C# module – Quickly find relevant material on the

template pattern and visitor pattern

Page 27: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Maintenance task stage Maintenance task stage 22

Maintenance task stage Maintenance task stage 22

• Identify through a systematic enumeration the occurrences of arithmetic and logical operators in a jscript program

if (i + j > 0) j = j + 1;else i = i - 1;print(“i = “ + i + “, j = “ + j);

Page 28: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Maintenance task stage Maintenance task stage 22

Maintenance task stage Maintenance task stage 22

• Given a program and an operator occurrence id, generate a mutant program that differs from the given program only at the occurrence of the operator

if (i - j > 0) //ORIGINALLY i + j j = j + 1;else i = i - 1;print(“i = “ + i + “, j = “ + j);

Page 29: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Maintenance planningMaintenance planningMaintenance planningMaintenance planning

• Some students suggest modifying the IL– Seen as a quick fix

• Two implementation plans– Modify ast– Modify IL

• How to evaluate?

Page 30: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Detailed planDetailed planDetailed planDetailed plan

• For each proposal– Plan the implementation steps– Assumptions that need to be tested

• Decision tree discussion

– Cost estimates in hours

Page 31: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Cost estimation: Cost estimation: individualindividualCost estimation: Cost estimation: individualindividual• Necessary and frequent activity,

usually implicit• In practical work, students encouraged

to make cost estimation explicit so that it can be scrutinised and improved.– Calculate estimate, record in logbook– When task complete, review estimate– Note how it can be improved

Page 32: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Misguided judgementMisguided judgementMisguided judgementMisguided judgement

• Enthusiasm for the IL modification option based on difficulty with ast.

• Understanding of requirements conveniently vague.

• Drip feed reminders about the requirements to the extent that both options remain in contention.

Page 33: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Implementation options Implementation options evaluatedevaluated

Implementation options Implementation options evaluatedevaluated

• IL modification is seen correctly as an easy way to solve 95% of the problem– Remaining 5% hard– Discussion about the language

independent generation of mutant programs

• Students return to modification of the ast

Page 34: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Practical exercise: Practical exercise: outcomesoutcomesPractical exercise: Practical exercise: outcomesoutcomes• Learn what is required to maintain software.• Learn how to improve one’s knowledge and

skill. – Lazy practice makes permanent– Goal directed practice makes better

• Motivation and self confidence.– Requires a rational assessment of one’s abilities

Acquire experience Learn from experience

Page 35: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Teaching methodTeaching methodTeaching methodTeaching method

• Opportunistic and improvisational – Respond to issues raised by students– Easier with small group of students– Course notes are structured– Use white board, few slides

• Interact with students to provoke a response

Page 36: Teaching Software Maintenance using.NET and Rotor Leonardo Bottaci University of Hull, Hull, UK

Course materialsCourse materialsCourse materialsCourse materials

• Lecture notes• Practical exercise• Tutor’s notes

• Hints, Modifications to jscript compiler

• Debugging tutorial• C# compiler, MSIL, fjit

Contact email L.Bottaci at hull.ac.uk