Strange assignment to local variable in profilecontroller.cs edit methods

Dec 31, 2011 at 12:13 AM

Hi,

I've recently been working with the project silk code base and noticed a strange local variable assignment in the MileageStats.Web.Controllers.ProfileController.cs class: the MileageStats.Domain.Models.User function argument "updatedUser" in "Edit", "JsonEdit" and "CompleteRegistration" is assigned to a local variable ("user") before being used in a view or JSON construct.

I feel I must be missing something as I cannot see a reason for this, in either the code logic or for variable scoping purposes.

Is there an implicit reason for this or something other reason, i.e. best practise?

Many thanks in advance,

James 

Developer
Jan 2, 2012 at 4:19 PM
Edited Jan 2, 2012 at 4:46 PM

Hi,

Based on my understanding, this was done to add clarity to the code. However, if you believe this should be changed you could create a work item in the Issue Tracker so that the team is aware of it and might consider it for a future release.

Thanks,

Agustin Adami
http://blogs.southworks.net/aadami

Coordinator
Jan 4, 2012 at 10:17 PM

Yes, I agree it is strange. It may have been done for clarity as Agustin suggested, but it's more likely it was left over from a previous refactoring and was just overlooked. I don't think it represents any best practice or serves any particular purpose. I'll add it to the issue tracker so we can clean it up in a future revision.

Thanks for pointing it out,
Don

Coordinator
Jan 4, 2012 at 10:18 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.