1

I am working on an application, for which a temporary change request has come in to a given feature. Specifically, the business currently only wants to manage a Physical address for a given customer, and wants us to remove the option to add a mailing address.

This feature will most likely need to be re-introduced in the future, so, I am wondering what the best way to handle the removal would be for now. Having additional properties on the ViewModel is not necessarily a problem, but, it's messy. And there is even more of a problem when it comes to the View itself. We need to remove the UI elements, but, we need to make it easy to bring it back in the future.

So...do I comment out the unneeded code bits? This is the simplest approach, but, it's messy.

Do I create a new View and ViewModel? If so, where is the appropriate place to store the original for safe-keeping? Our application is under source control (SVN), so, we could theoretically come back to this revision, but, it seems like overkill for such a small change.

Has anyone else run into a similar situation? Any recommendation on how to best handle this?

4

2 回答 2

1

So...do I comment out the unneeded code bits?

No, that would be very messy. That's what version control is intended to do.

Do I create a new View and ViewModel?

Yes, replace the original.

If so, where is the appropriate place to store the original for safe-keeping?

Version control.

Our application is under source control (SVN), so, we could theoretically come back to this revision, but, it seems like overkill for such a small change.

overkill? No. That's what VCS do best => they keep revision history. Also you might consider creating a label so that you can easily come back later.

于 2011-06-08T21:37:46.807 回答
0

什么视图引擎?实际上,这可能或可能不重要。

从“我可能需要这个未来”的角度来看,我会考虑移动现在正在消失并可能重新出现在 MVC 用户控件中的 UI 位。它比到处注释代码更“混乱”。然后,您现在可以将其排除。

至于 ViewModel?有几种可能性。短杆肯定会在 ViewModel 中添加位,即使没有使用,但这意味着您正在旋转未使用的数据,并且没有明确的时间框架来确定何时使用。但是,当您需要额外信息时,您始终可以创建一个派生类,并在您开始使用它时让用户控件将视图模型转换为派生类(协变和逆变是您的朋友),从而使代码更改相当小当企业“清醒过来”时。

于 2011-06-08T21:40:21.730 回答