Skip to main content
Code Review

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

This abstraction is a leaky abstraction and should be avoided.

As Mark Seeman puts it Mark Seeman puts it:

Consider why you want to add IDisposable to your interface. It's probably because you have a particular implementation in mind. Hence, the implementation leaks into the abstraction.

Now in this specific context he's talking about ISomeInterface : IDisposable, but the same applies to an abstract class, because an abstract class is an abstraction just like an interface is.

Implementing it in a base class prevents any derived class from deriving from anything else, because in C# a class can only derive from a single base class. This reason alone is a showstopper.

Also, calling Dispose() twelve times in a row on a disposable object should not throw anything. Only using a disposed object should; your implementation breaks the pattern in ways that break POLS.

This abstraction is a leaky abstraction and should be avoided.

As Mark Seeman puts it:

Consider why you want to add IDisposable to your interface. It's probably because you have a particular implementation in mind. Hence, the implementation leaks into the abstraction.

Now in this specific context he's talking about ISomeInterface : IDisposable, but the same applies to an abstract class, because an abstract class is an abstraction just like an interface is.

Implementing it in a base class prevents any derived class from deriving from anything else, because in C# a class can only derive from a single base class. This reason alone is a showstopper.

Also, calling Dispose() twelve times in a row on a disposable object should not throw anything. Only using a disposed object should; your implementation breaks the pattern in ways that break POLS.

This abstraction is a leaky abstraction and should be avoided.

As Mark Seeman puts it:

Consider why you want to add IDisposable to your interface. It's probably because you have a particular implementation in mind. Hence, the implementation leaks into the abstraction.

Now in this specific context he's talking about ISomeInterface : IDisposable, but the same applies to an abstract class, because an abstract class is an abstraction just like an interface is.

Implementing it in a base class prevents any derived class from deriving from anything else, because in C# a class can only derive from a single base class. This reason alone is a showstopper.

Also, calling Dispose() twelve times in a row on a disposable object should not throw anything. Only using a disposed object should; your implementation breaks the pattern in ways that break POLS.

added 201 characters in body
Source Link
Mathieu Guindon
  • 75.5k
  • 18
  • 194
  • 467

This abstraction is a leaky abstraction and should be avoided.

As Mark Seeman puts it:

Consider why you want to add IDisposable to your interface. It's probably because you have a particular implementation in mind. Hence, the implementation leaks into the abstraction.

Now in this specific context he's talking about ISomeInterface : IDisposable, but the same applies to an abstract class, because an abstract class is an abstraction just like an interface is.

Implementing it in a base class prevents any derived class from deriving from anything else, because in C# a class can only derive from a single base class. This reason alone is a showstopper.

Also, calling Dispose() twelve times in a row on a disposable object should not throw anything. Only using a disposed object should; your implementation breaks the pattern in ways that break POLS.

This abstraction is a leaky abstraction and should be avoided.

As Mark Seeman puts it:

Consider why you want to add IDisposable to your interface. It's probably because you have a particular implementation in mind. Hence, the implementation leaks into the abstraction.

Now in this specific context he's talking about ISomeInterface : IDisposable, but the same applies to an abstract class, because an abstract class is an abstraction just like an interface is.

Implementing it in a base class prevents any derived class from deriving from anything else, because in C# a class can only derive from a single base class. This reason alone is a showstopper.

This abstraction is a leaky abstraction and should be avoided.

As Mark Seeman puts it:

Consider why you want to add IDisposable to your interface. It's probably because you have a particular implementation in mind. Hence, the implementation leaks into the abstraction.

Now in this specific context he's talking about ISomeInterface : IDisposable, but the same applies to an abstract class, because an abstract class is an abstraction just like an interface is.

Implementing it in a base class prevents any derived class from deriving from anything else, because in C# a class can only derive from a single base class. This reason alone is a showstopper.

Also, calling Dispose() twelve times in a row on a disposable object should not throw anything. Only using a disposed object should; your implementation breaks the pattern in ways that break POLS.

added 436 characters in body
Source Link
Mathieu Guindon
  • 75.5k
  • 18
  • 194
  • 467

This abstraction is a leaky abstraction and should be avoided for all.

As Mark Seeman puts it :

Consider why you want to add IDisposable to your interface. It's probably because you have a particular implementation in mind. Hence, the implementation leaks into the abstraction.

Now in this specific context he's talking about ISomeInterface : IDisposable, but the reasons mentioned abovesame applies to an abstract class, because an abstract class is an abstraction just like an interface is.

Implementing it in a base class prevents any derived class from deriving from anything else, because in C# a class can only derive from a single base class. This reason alone is a showstopper.

This abstraction is a leaky abstraction and should be avoided for all the reasons mentioned above.

This abstraction is a leaky abstraction and should be avoided.

As Mark Seeman puts it :

Consider why you want to add IDisposable to your interface. It's probably because you have a particular implementation in mind. Hence, the implementation leaks into the abstraction.

Now in this specific context he's talking about ISomeInterface : IDisposable, but the same applies to an abstract class, because an abstract class is an abstraction just like an interface is.

Implementing it in a base class prevents any derived class from deriving from anything else, because in C# a class can only derive from a single base class. This reason alone is a showstopper.

Source Link
Mathieu Guindon
  • 75.5k
  • 18
  • 194
  • 467
Loading
lang-cs

AltStyle によって変換されたページ (->オリジナル) /