by Mikael Henriksson
31. January 2009 14:49
Don’t remember who wrote it but I experienced it first hand tonight. I got it from Clean Code or some other great book I read. I can’t remember the exact frase but it goes something like this –“You give the name of your methods the same thought process as you would a child”. Something like that. For me it was not the name of a method but rather a user control. You see I have just started working with MVC (love it by the way) and I was trying to do a simple
<% Html.RenderPartial("Login"); %>
This worked very well until I tried to visit the actual ActionResult View. For some reason I got a StackOverFlowException and while debugging it it looked like Html.RenderPartial is taking the name of the ActionResult and get stuck in an infinite loop. A simple renaming the user control Login to LoginControl and do the following solved my problems:
<% Html.RenderPartial("LoginControl"); %>
It is an extremely silly problem really but it still got me thinking that name giving is one of the most important aspects of programming!
382aef3a-2ec2-41fb-b859-155b94700bc0|0|.0
Tags: MVC
MVC