tobie/ua-parser — pull request #398 by atifaziz (2014-05-22 21:30:13+00:00)
Title: C# port reviewed for simplicity, safety and duplication

This request proposes completely refactored guts of the C# implementation while maintaining the public API surface 99% compatible with version 1 and with all the tests still passing!

This refactored implementation is almost entirely functional such that all classes have been reviewed and rehashed as pure functions:
- Data types (i.e. `OS`, `Device` and `UserAgent`) have been rendered immutable. Some still had mutable properties previously so that's the 1% breaking change.
- All fields and state are readonly. Where state needs mutation, the effects are completely encapsulated and [isolated to one location](https://github.com/atifaziz/ua-parser/blob/f304fd2b054621d10a447323fa175ea55e609509/csharp/UAParser/UAParser.cs#L323) and within a workflow.
- Duplicate code, especially among `*Pattern` classes, consolidated into a [reusable and composable workflow](https://github.com/atifaziz/ua-parser/blob/f304fd2b054621d10a447323fa175ea55e609509/csharp/UAParser/UAParser.cs#L249).

With this simpler implementation where there are fewer types and each function is itself small & cohesive, I propose to keep it all in a single file (instead of 13). In the next version (2), it can made even shorter (but not without breaking changes) so having a single file to digest makes the overall solution approachable to study and review without an IDE & tooling.

The XML documentation has been removed because it bloats the source without adding much value. The public API is small & the problem domain of UAParser is well understood. If anything, the README documentation or console app should be improved instead. If the implementation needs documentation, we could consider doing it à la [Nocco](http://dontangg.github.io/nocco/).