InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

Changes and Improvements to the Base Class Library

Posted by Jonathan Allen on Nov 11, 2008

Sections
Development
Topics
.NET Framework ,
.NET

Since 2005, the base class library was in stasis. While the rest of the .NET framework evolved and built upon the 2.0 version of the CLR, the base class library team has been slowly building their wish list. With .NET 4, a new version of the CLR and BCL is on deck and these enhancements can finally be realized.

New Types

Languages like IronPython and F# have something simple and yet entirely alien to the core .NET languages, a real integer type. Unlike VB and C#, which limit integers to what fits in a given set up bits, these languages can hold virtually any value. But in order to share values between the two, to say nothing of other languages, a common implementation is needed. The base class library will be adding BigInteger. This high performance implementation was jointed developed by the BCL team and the Microsoft Solver Foundation.

Another typed added primarily for F# and IronPython is Tuples. Tuples themselves are fairly trivial, essentially just being a data structure that holds a fixed-length set of values. In some ways it is like an array, but each value can have a different type. Like BigInteger, the primary reason for including it at the BCL level is to avoid duplicate, incompatible implementations.

Under collections is the SortedSet class. This is yet another class that supports sorted collection of objects where each sort key must be unique. Still missing is a sorted list that allows duplicates.

Unmanaged Memory Support

When working with very large files, native developers turn to a technique known as Memory-Mapped Files. As the name implies, a memory-mapped file maps a file-like construct to an address in memory. In addition to actual files, devices and shared memory objects can be mapped. One of the most common uses of a memory-mapped file is inter-process communication. To do this, each application opens the same file descriptor. With the next version of the BCL, .NET developers will be able to use memory-mapped files directly instead of via platform invoke calls.

Internationalization

The Resource Manager for both .NET 4 and Silverlight 2 will support the user's preferences for UI languages instead of just default the to the CurrentUICulture's chain. This is especially important when a user has more than one preferred language.

Breaking Changes

The default comparison logic for several System.String methods have been changed. This should not affect English-only applications, but it may have an impact on internationalized applications.

The default partial matching overloads on System.String (StartsWith, EndsWith, IndexOf, and LastIndexOf) have been changed to be culture-agnostic (ordinal) by default. In addition, ToUpper and ToLower on System.String and System.Char have been changed to use the invariant culture instead of the current culture. Although we have guidance and FxCop rules that recommend always using overloads that take a StringComparison parameter, unaware developers often just use the default overloads. In previous versions of .NET, these default overloads do a culture-sensitive comparison using the current culture. This can often lead to subtle bugs, most notably security vulnerabilities, when unaware developers use the default overloads to do security-sensitive string comparisons.

Performance Improvements

Currently the methods on Directory and DirectoryInfo return arrays. This means that the entire array of files has to be populated before a single entry is accessed. With the addition of IEnumerable support for Directory and DirectoryInfo, the first file in the directory can be accessed immediately while the rest of the list is lazily populated.

Fixing Changes by Eric Smith Posted
  1. Back to top

    Fixing Changes

    by Eric Smith

    Maybe switching StartsWith, EndsWith, etc. to ordinal will actually fix more code than it breaks.

Educational Content

New-age Transactional Systems - Not Your Grandpa's OLTP

John Hugg discusses high volume transaction processing applications with high and low frequency profiles, and how VoltDB can be used for that purpose.

Cool Code

Kevlin Henney examines code samples to see what can be learned from them starting from the premise that one won’t write great code unless he knows how to read it.

Collaboration: At the Extremities of Extreme

Jason Ayers share the observations he made watching a team of developers collaborating in real time on the same code base, pushing XP, pair programming and continuous integration to their extremes.

Yesod Web Framework

Michael Snoyman presents Yesod, a web framework written in Haskell and containing a web server, templating, ORM, libraries (templating, gravatar, etc.).

Transactions without Transactions

Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.

Attila Szegedi on JVM and GC Performance Tuning at Twitter

Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.

10 tips on how to prevent business value risk

One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.

Interview: Software Systems Architecture: Working With Stakeholders Using Viewpoints and Perspectives

InfoQ spoke to the authors of Software Systems Architecture on a couple of new topics, the System Context viewpoint and Agile, which have been added to the second edition.