Teaching Computer Science with the SSCLI - PowerPoint PPT Presentation

1 / 37
About This Presentation
Title:

Teaching Computer Science with the SSCLI

Description:

Collections. Resources. Reflection. Net. IO. Threading. Text. ServiceProcess. Security. Runtime ... Designers. SDK Tools. CorDBG. ILAsm. ILDbDump. SN. ILDAsm ... – PowerPoint PPT presentation

Number of Views:67
Avg rating:3.0/5.0
Slides: 38
Provided by: DrDavi90
Category:

less

Transcript and Presenter's Notes

Title: Teaching Computer Science with the SSCLI


1
Teaching Computer Science with the SSCLI
  • Dr David Grey, Rob Miles

2
Overview
  • The SSCLI
  • Our .NET-based MSc in Distributed Systems
    Development
  • Course overview
  • The role of the SSCLI
  • Deploying the SSCLI
  • Technical challenges and our responses
  • Example laboratory exercise
  • Watching demos fail is fun!

3
The SSCLI
4
The ECMA Common Language Infrastructure (CLI)
  • is a standardised specification for a virtual
    execution environment, produced by Microsoft
  • whose implementation would be a subset of the
    .NET framework
  • The specification (ECMA 335/ISO 23271/2 ) defines
  • type system
  • intermediate language
  • component model
  • A compliant CLI implementation consists of
  • a C compiler
  • CLI execution engine
  • component frameworks

5
The SSCLI
  • SSCLI is Microsofts freely available CLI
    implementation, distributed in source form
  • is properly known as the Shared Source Common
    Language Infrastructure
  • runs on Windows, FreeBSD and MacOS
  • built from the same source as the same as the
    commercial .NET implementation
  • includes all non-Windows specific functionality
    of .NET
  • Superset of ECMA CLI, subset of .NET
  • We were introduced to the SSCLI at its launch
    event and reckoned we could use it to teach some
    serious Computer Science!

6
The SSCLI vs .NET
7
Implemented for Learning
  • Many areas of interest (3 million lines of code)
  • Contains useful component-based frameworks
  • Standard programming constructs
  • Web-services, networking and distributed
    computing support
  • Contains compilers, tools, and utilities
  • C, JScript, and IL JIT compilers
  • Assembler, disassembler, linker, debuggers
  • Configuration utilities
  • Extensive tests and build harness

8
The SSCLI Distribution
  • Packaged as single compressed file archive
  • 1.9 million lines of code in first release (now
    gt3 million)
  • 1.15M of C and C
  • 625K of C
  • 125K of CIL (intermediate language)
  • Smattering of assembly code and Perl scripts
  • 5900 source files
  • 2900 tests
  • Build output
  • 1200 defined types
  • About 20 dynamically loadable libraries
  • About 22 executable programs

9
A .NET-based MSc Course
10
The Challenge of Teaching Software Development
  • Three years is not enough time!
  • To achieve this breadth of coverage we tend to
    lose the depth
  • We do not have time to expose the students to
    large systems and appropriate development
    techniques
  • We have little opportunity to give students all
    the testing/debugging skills needed by industry
  • We wanted to address these issues in the
    Distributed Systems MSc we were introducing

11
MSc in Distributed Systems Development
  • This degree
  • was developed in conjunction with Microsoft UK
    and the SSCLI product team
  • uses .NET to explore modern distributed systems
    concepts
  • responds to the challenges we face at the
    undergraduate level and the skills that employers
    require
  • uses SSCLI to explore the design and
    implementation of managed code and distributed
    computing environments
  • offers in-depth exposure to testing, debugging
    and maintenance using the SSCLI source as an
    example of a large, commercial-quality software
    system

12
.NET Degree Aims Content
  • Aims
  • Give advanced coverage of modern distributed
    computing techniques
  • Develop skills in working with large codebases
  • To develop active practitioners
  • Provide hands-on practical experience underpinned
    by advanced theoretical concepts

13
Course Structure
14
The Role of .NET and SSCLI
  • .NET provides an overreaching example of
    distributed systems concepts/techniques
  • SSCLI provides
  • basis for studying down to the metal
    implementation details (e.g. Introduction to
    .NET, Virtual Machine Architectures modules)
  • excellent environment for enhancing professional
    software development skills (e.g. testing,
    debugging and maintenance)
  • Our demo shows one example of this

15
Deploying the SSCLI
16
Deployment Challenges
  • Full install and build of SSCLI requires 600MB to
    1GB disk space full local build takes 15
    minutes
  • SSCLI used in modules taught simultaneously
  • Simultaneous modules (may) require students to
    make possibly conflicting alterations to SSCLI
    code
  • Deploy to a networked environment in which
    students may use different machines at different
    times
  • Installing/building on server not desirable due
    to impact of many simultaneous builds on network
    bandwidth performance and time taken

17
Our Solution
  • Install modifiable copy of SSCLI locally on each
    machine
  • Full modify permissions for all users
  • Second read-only vanilla copy installed on each
    machine
  • Script copies vanilla installation over
    modifiable version on logout
  • Vanilla working modifiable version always
    available at logon

18
Our Solution
  • In each module students only work on small areas
    of SSCLI source tree
  • Source code control (SCC) used to store
    individual student modifications
  • Student restores modifications from SCC into
    local modifiable copy
  • Forces students to use recognised commercial
    development practices

19
Example MSc Lab Exercise
20
An SSCLI-based Laboratory Exercise
  • A live demo
  • A debugging exercise from the Maintaining Large
    Software Systems module designed to
  • get the students thinking about all aspects of
    the compilation/execution cycle (challenges some
    pre-conceptions?)
  • provide opportunities to develop debugging and
    testing skills
  • familiarise the student with the SSCLI code and
    the techniques used to implement it

21
Teaching Debugging
  • Some things you have to do before you get good at
    them
  • You can read about riding a bike, but this will
    not necessarily help when you get on one!
  • Debugging is like this
  • We see the ability to test, debug and maintain
    programmes as an essential skill for Computer
    Scientists

22
The Art of Debugging
  • Teaching what to do when it all goes wrong is
    difficult
  • Students will have to debug their own programs
    but do not have to spend much time debugging
    other peoples
  • We are setting the worst case scenario
  • There is a problem with the underlying
    implementation
  • Their program is fine, but it still doesnt work!

23
A Simple Sort
  • Student are asked to write a C program to bubble
    sort the following numbers
  • static float data 45.0, 6.5, 435.2, 22.0,
    6.3, 100.1, 0.02, 99.9, 45.0, 17.4, 56.4
  • Being kind people, we even suggest an algorithm
  • Simple bubble sort

24
Run the sort with SSCLI
  • Compile and run the program using the SSCLI C
    compiler and the SSCLI CLR
  • Not a happy ending!
  • Something is causing our program to do bad things

25
Finding out more
  • We can use the SSCLI debugging tools to find out
    more about the problem
  • We notice that i has the deeply suspicious value
    of 10
  • The 101th location is beyond the array

26
Whose fault?
  • At this point the students have to decide if
    their code is at fault
  • Inexperienced programmers are prone to problems
    with array bounds
  • First they must convince themselves that their
    program is correct
  • They will not expect the language implementation
    to cause problems

27
Prove the environment
  • Can we verify the correctness of the code in any
    way?
  • Use the .NET C compiler and CLR
  • Hypothesis
  • if it works in .NET our code must be valid
  • Outcome
  • The program works correctly in this environment

28
First conclusion
  • Something about the SSCLI environment or C
    compiler causes the problem
  • Hypotheses
  • Something is wrong with the implementation of for
    loops
  • Something is wrong with the lt operator
  • Write some simple programs to test these
    hypotheses

29
What could be wrong?
  • Something is definitely not right
  • Hypothesis
  • The C compiler generates Common Intermediate
    Language code. Perhaps the code generation is
    incorrect.
  • Use ildasm to disassemble the compiler output to
    see if this hypothesis is correct

30
A look at the code
  • IL_0017 looks deeply suspicious
  • We can propose the hypothesis that the compiler
    may be producing the wrong code for the lt
    operation in loops
  • We need to find a way to test this

31
Round Tripping
  • One of the great things about SSCLI is the tool
    set
  • We can fix the bug and re-assemble the IL
    produced by the disassembler
  • The code passes the tests now

32
When compilers go bad
  • The compiler is outputting the wrong instruction
    for lt. Why?
  • The parser may be mistaking lt for lt
  • but the SSCLI C compiler is supplied with a
    pre-built parser (which we cant break!)
  • The code generation is sending out the wrong
    instruction for lt
  • we should test this first

33
Good News, Bad News
  • Good News
  • We fixed the fault
  • Bad News
  • It still doesnt work!
  • This is only half of the exercise
  • The second part requires students to debug the
    virtual machine implementation and fix a fault
    deliberately introduced in the handling of
    floating point lt operations

34
Learning Process
  • This exercise uses SSCLI to confront some of the
    students preconceptions.
  • Most new graduates would
  • Not produce sufficient test cases to narrow the
    problem down to the floating point comparison
  • Not suspect the compiler of producing incorrect
    code
  • Think that they had not fixed the compiler after
    removing the bug
  • The SSCLI source is large and unfamiliar
    exactly what they will face in the real world

35
Learning Outcomes
  • Importance of methodical approach
  • Design of test cases
  • Navigation of code base
  • Debugging tools
  • Disassembly tools
  • An introduction to intermediate language
  • Just-In-Time compilation

36
Summary
  • We believe that .NET and the SSCLI are valuable
    teaching tools
  • The SSCLI is useful as an example of
  • A realistically sized software project
  • how software development is done in the real world

37
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com