Open Source .NET Development
Setting Up A Professional Development Environment Using Open Source Software (OSS)
Morten Mertner
Senior Consultant, Teknologisk Institut .NET Architect and Software Developer
Developer of Gentle.NET (object persistence framework / ORM)
Introduction – Open Source Software
Open Source Software Licensing
Stability Support
Introduction – The Development Environment
Setting Up A Professional Development Environment Unit Testing Documentation Source Control Automation Continuous Integration Issue Tracking
Open Source Software (OSS)
Hosting
SourceForce (www.sourceforge.net) – 100.000+ projects FreshMeat II (www.freshmeat.net) – 41.000+ projects GotDotNet (www.gotdotnet.com) – 7.200+ projects
Search Engines
Koders (www.koders.com) – 225,816,744 lines of code
Why do it?
Fame, Pride, Frustration, Love of Craft Powerful motivators
Licensing
GPL (GNU Public License)
Must publish all source changes
Affects linked files (compile-time dependencies) 67% (freshmeat.net statistics)
LGPL (Lesser GNU Public License)
Must publish changes to component only Does not affect own project
Can be used with closed-source commercial offerings 6% (freshmeat.net statistics)
Stability and Support
Activity Checks Forums Mailing lists Source repository Issue tracker Project statisticsPicking the right tool
Trials
Documentation and license reviews Hands-on testing and evaluation
Unit Testing
What
Module testing (black & white-boxed)
Purpose
Establish confidence Track progress
Never fix the same error twice
Additional Benefits
Enables Test Driven Development
Unit Testing – xUnit
Tools NUnit MbUnit Frontends Command Line Default GUI TestDriven.NET ZaneBugUnit Testing – Demo
Sample Code
Creating your first test case Running the tests
Evaluating the results
TestDriven.NET – Visual Studio integration
Documentation – NDoc
NDoc
http://ndoc.sourceforge.net
Standard .NET documentation tags (<summary>..</summary>)
Benefits
Create professional looking documentation
Enable full Visual Studio integration (F1 help, IntelliSense)
Strategy
State purpose and document non-obvious information
Always document all public methods, their parameters and return types Provide namespace summaries
Documentation – NDoc
Output HTML
Windows Help (.chm)
Visual Studio integration (.HxS)
Support Tools
Visual Studio Help Integration Toolkit
http://download.microsoft.com/download/6/2/4/624a17d7-445f-499b-a2ed-82a06c36b370/VSHIK2003.exe H2Reg
Source Control
What
Everything a developer needs to start working - source, libraries, build files, tools
Anything NOT created by build process (documentation, binaries)
Benefits
Enables effective team work
Revision control (labels, branches) Accountability
Source Control – Subversion
Subversion WebDAV
Cross-platform
All modern SCM features (atomic commits, branching, move/rename, etc.)
Strategy
Use a dedicated development server (avoid file servers / network shares) Use included scripts to convert existing VSS repositories
Don’t spend much time on security (permit writes) Document most-used procedures and concepts
Source Control – Subversion Tools
Command Line
Subversion (svn) (http://subversion.tigris.org)
Stand-alone GUI
RapidSVN (http://rapidsvn.tigris.org)
Windows Explorer integration
TortoiseSVN (http://tortoisesvn.tigris.org)
Visual Studio integration
Automation
What
Repetetive tasks (usually also boring and error-prone)
Benefits
Reproducibility of build procedure Easy sharing of project setup
Enables isolated build machine Scheduled builds
Cross-compilation Complex scripting
Automation – NAnt
NAnt (inspired by Ant)
http://nant.sourceforge.net
XML syntax
Tasks
Compiling
Validation and reporting (unit testing, FxCop) Packaging (installers, setup projects)
Custom tasks
Tools (graphical editors) NAnt-GUI
Automation – NAnt
Sample Build File
<?xml version="1.0" ?>
<project name="nant" default="compile"
xmlns="http://nant.sf.net/schemas/nant.xsd"> <target name="compile"> <solution solutionfile=”..\Source\Calculator.sln” configuration="debug" /> </target> </project>
Continuous Integration
Continuous Integration
Developer feedback on source repository actions Remote management and reporting
Instant problem detection
Continuous Integration – CruiseControl.NET
CruiseControl.NET (ThoughtWorks - Martin Fowler, GoF)
http://ccnet.thoughtworks.com
Web Dashboard CCTray
Depends on
Web Server / IIS
Source repository (any)
Build tool (NAnt, MSBuild, VS.NET)
Integrates with NUnit / MbUnit
Issue Tracking
What
Record all tasks that require human action
Tasks
Requirements (initial feature set) Bugs, supplemental features, tasks
Benefits
Progress visibility Accountability
Reporting and statistics
Issue Tracking – Mantis
Mantis
http://www.mantisbt.org
Strategy
Define projects, categories, permissions, etc. in advance - and keep them updated
Create sub-tasks for non-actionable issues
Always be specific (”fix documentation” will not do) Enforce usage