Developing with 'NET - PowerPoint PPT Presentation

1 / 33
About This Presentation
Title:

Developing with 'NET

Description:

Mark Simms mark.simms_at_cathexis.ca Steve Clarke steve_at_infotechcanada.ca Overview ... To highlight the value of open-source tools to assist in the development ... – PowerPoint PPT presentation

Number of Views:31
Avg rating:3.0/5.0
Slides: 34
Provided by: msi49
Category:

less

Transcript and Presenter's Notes

Title: Developing with 'NET


1
Developing with .NET
  • Open Source Tools for .NET Development
  • May 26th, 2004

Mark Simms ltmark.simms_at_cathexis.cagt Steve Clarke
ltsteve_at_infotechcanada.cagt
2
Overview
  • Presentation Goals
  • Software Development Process
  • Sample Application
  • Software Tools

3
Presentation Goals
  • To demonstrate to the user of several valuable
    tools to assist in software development
  • To highlight the value of open-source tools to
    assist in the development process
  • To create a sample application using these tools

4
Software Development Process
  • Software development typically proceeds in five
    (5) stages
  • Requirements
  • Design
  • Implementation
  • Verification
  • Maintenance

5
Software Development Process
6
Sample Application - Specification
  • High Level Requirements
  • Display a table of information for review by the
    user
  • Retrieve this information upon demand from a
    central database

7
Sample Application - Specification
  • Constraints
  • Written in C for the .NET Framework v1.1
  • Developed using Visual Studio.NET 2003
  • Windows Forms application
  • XML File backend (for simplicity)

8
Sample Application - Specification
  • A more in-depth requirements document will be
    posted on the wedevelop.net web site, along with
    this presentation, code samples and other
    resources.

9
Sample Application - Design
  • GUI Prototype
  • Use Visio to prototype your Forms based user
    interfaces
  • Advantages
  • Fast to implement
  • Easy to change and mockup
  • No temptation to use as base for actual
    implementation (i.e. as opposed to developing in
    a programming environment)

10
Sample Application Design (GUI)
  • Simple Forms-based application
  • DataGrid or table for displaying information from
    the database
  • Update button for refreshing the information on
    the screen
  • Two database fields of interest Name and
    Preferences

11
Sample Application Design (Architecture)
  • Visio is your friend
  • Simple Architecture diagram

12
Sample Application Design (Database)
  • Visio is still your friend
  • Enterprise manager or Query Analyzer also useful,
    though Visio is more generic.
  • NOTE I got lazy and decided to use XML as the
    backend for the sample application

13
Sample Application Design (Model)
  • Visio does reasonably good UML diagrams
  • Notes
  • Hardcode the database connection and table name
  • Refresh will connect to the database and update
    the data table with the contents of an entire
    table

14
Open Source Tools
  • NUnit Unit testing framework
  • NUnit Add-in Visual Studio.NET integration for
    NUnit
  • Subversion source code management
  • NDoc source code documentation

15
Subversion Source Code Control
  • http//subversion.tigris.org/
  • Open-source source code control system
  • Developed as a replacement for CVS
  • Features
  • Multi-user source code versioning
  • Atomic commits
  • Efficient branch / tag operations
  • Windows explorer integration

16
Subversion Source Code Control
17
Subversion Source Code Control
  • Subversion stores code in repositories
  • Repositories accessed via WebDAV over HTTP using
    URLs
  • http//svn-serverport/path/to/repository/
  • Can be browsed directly using a web browser

18
Subversion Source Code Control
  • Use the TortoiseSVN client Windows Explorer
    integration

19
Subversion Source Code Control
  • Checkout check out fresh copy of a revision
    from the repository
  • Update update your local copy from the
    repository
  • Commit commit your changes to the repository

20
Subversion Source Code Control
  • Subversion versus Visual Source Safe
  • Subversion doesnt suck.
  • Uses local-copy merge as opposed to mutually
    exclusive file locking
  • Multiple developers can be working on the same
    file at the same time. At commit time these
    changes will be merged (automatically, or
    manually)

21
Sample App Using Source Code Control
  • Demonstration
  • Retrieve template project from subversion
    repository
  • Contains sample C.NET application with GUI of
    MainForm

22
NUnit Unit Testing for .NET
  • Unit Testing in unit testing called components
    (or communicating components) are replaced with
    stubs, simulators, or trusted components. Calling
    components are replaced with drivers or trusted
    super-components. The unit is tested in
    isolation.
  • In plain English
  • Test small units of your code
  • Using an automated framework
  • Written by developers as they create classes and
    methods

23
NUnit Unit Testing for .NET
  • Unit Testing
  • Enhances your understanding of what you think
    your code is supposed to do
  • Provides confidence that your code does what you
    think it does

24
Demonstration Using Unit Testing
  • Implement Unit Testing for our DataAccess class.
  • Test
  • Retrieval of data
  • Can we retrieve a valid data table object?
  • Is the correct data retrieved?
  • Use the NUnit framework to set up the database
    with default data

25
Demonstration Developing Unit Tests
  • Test Initialization Initialize data set
  • Execute Tests
  • Retrieve data
  • Cleanup Restore old data set
  • Can step through tests in VS.NET Debugger

26
Demonstration Developing Unit Tests
  • NUnit uses attributes to describe
  • TestFixture a self-contained collection of
    tests (contained in a class)
  • SetUp a function that sets up the test
  • TearDown a function that cleans up after the
    test
  • Test a function that implements a test

27
Demonstration Developing Unit Tests
  • Using NUnit.Framework
  • TestFixture
  • Public class TestDataManager
  • SetUp
  • public void SetUp()
  • // Do stuff
  • TearDown
  • public void TearDown()
  • // Clean up

28
Demonstration Developing Unit Tests
  • Test
  • Public void TestSomething()
  • object obj null
  • Assert.IsNotNull(obj, Error object was null)
  • int x 5
  • Assert.AreEqual(x, 3, Error got x
  • expected 3)

29
NDoc Source Code Documentation
  • Similar to JavaDoc
  • Allows your application to be self-documenting
    (from a technical perspective)
  • Critical for SDK and API type applications

30
NDoc Source Code Documentation
  • Document your classes

namespace test1 /// ltsummarygt /// This is a
class summary to be included in our
documentation. /// My class does essentially
nothing useful. /// lt/summarygt public class
Class1 /// ltsummarygt /// Another pretty
useless function. Concatenates /// two
strings and returns the result. ///
lt/summarygt /// ltparam name"a"gtThe first
stringlt/paramgt /// ltparam name"b"gtThe second
stringlt/paramgt /// ltreturnsgtA string consisting
of the concatenation of /// a and
blt/returnsgt public static string concat(string
a, string b) return a b
31
NDoc Source Code Documentation
  • Configure VS.NET to create a documentation file

32
NDoc Source Code Documentation
  • Build your project
  • Use NDoc to compile the XML file into HTML / CHM
    / etc

33
Resources
  • NUnit http//www.nunit.org/
  • NUNit Add-in for VS.NET http//sourceforge.net/pro
    jects/nunitaddin/
  • Subversion http//subversion.tigris.org/
  • NDoc http//ndoc.sourceforge.net/
Write a Comment
User Comments (0)
About PowerShow.com