adamralph / bau-nuget

A Bau plugin for running NuGet commands
MIT License
2 stars 1 forks source link

Collapse type hierarchy #10

Closed adamralph closed 9 years ago

adamralph commented 9 years ago

At the moment, in each of those cases there is a single inheritor so it seems they can be collapsed, in the name of YAGNI.

aarondandy commented 9 years ago

Both of these are not pure YAGNI but are kind of YAGNI, you will need to make a call on them.

The first case is easy and is more about design. The requests are structured to match the hierarchy in https://github.com/Haacked/NuGet/tree/master/src/CommandLine/Commands . So to keep it or collapse it is up to you. I'm happy with current functionality and see no need for it to be expanded at the moment.

The second case is more complicated and for technical reasons. The reason for using a generic and non generic type have more to do with some of the fluent methods being extension methods. Generic inference does not work so well with methods of the form A Method<A,B>(A thing) where A:ABase<B> where B:BBase so those extension methods were applied to the non-generic type while the real logic is within the generic type. Looking back an interface would probably have been better. It may soon not mater as most of the complexity as due to the intent to support both command line and NuGet.Core. After #8 is done this should be looked at again with a fresh perspective and hopefully we can get rid of the generics entirely.

adamralph commented 9 years ago

Thanks for the explanations!

  1. I'd probably get rid of it. I can't see us doing anything other than a restore. Install/update don't really make sense for a task script (unless you can think of a use case).
  2. Sounds good.
aarondandy commented 9 years ago

NuGetCliBauTaskBase no longer exists so that solves the hard problems.

aarondandy commented 9 years ago

Consider merging download into restore instead of commandbase.