Web Log di Adrian Florea

"You know you've achieved perfection in design, not when you have nothing more to add, but when you have nothing more to take away." Antoine de Saint-Exupery
posts - 440, comments - 2715, trackbacks - 3944

My Links

Archives

Post Categories

Image Galleries

.RO Blogs

.RO People

.RO Sites

Blogs

Furls

Links

vinCitori

Null Object

A proposito di Nullable types vorrei segnalare due cose:

1. un commento interessante di Anders Hejlsberg via un post di Krzysztof Cwalina, PM CLR:

"When you design APIs using Nullable<T>, you have to be very sensitive to the fact that a Nullable<T> is a lot less convenient to use than a T. Nullable<T> with value types makes sense and solves a real world problem--therefore, users will be amenable to the inconveniences of using it. However, Nullable<T> with reference types makes little sense and solves no real world problem. In fact, it adds nothing but confusion because, in terms capabilities, there is no difference between a string and a Nullable<string>. With respect to having a Value Type constraint on Nullable<T>, we haven't done it because it would severely limit Nullable<T>'s use in generic scenarios. For example, imagine a Find method that returns a T or a null value when an item isn't found. In the generic world, a possible solution is to return Nullable<T>, but only if Nullable<T> works for all types";

2. un Nullable type che ho trovato nel framework CSLA.NET di Rockford Lhotka come la classe CSLA.SmartDate.

In realtà i tipi Nullable sono suggeriti da un design pattern proposto da Bobby Woolf nel 1996 come Null Object, caso particolare di un altro pattern, Special Case

Print | posted on venerdì 26 marzo 2004 01:15 | Filed Under [ Pattern Dappertutto ]

Powered by:
Powered By Subtext Powered By ASP.NET