Helper Methods for Code Tests?

  • Jan 31, 2013
  • 0 Comments

This week, I continued to work on code tests. In doing so,  I came up with a couple of API Methods that I’m really excited about. isFoundInOrCalledFromMyFirstMethod() (mouthful of a name, I know) does just that. I helps me to sort out what is the “visible code” or the code that is making the characters in the scene move. This is helpful because this is the code the badges normally originate from. This is also probably the code that the mentors will also be interested in.

In order to test if the user has a get a part skill (e.g. billyGoat.getHead()), I created methods to return the get part method for the caller as well as the target. This also led to an update to the getCaller() method so that is now returns a value for billyGoat, billyGoat.getHead() and scene. (It used to only return the first).  

I also did some thinking about Kyle’s question from last week. He asked whether or not I thought there was a case for having some kind of helper methods. Writing the code tests has definitely expanded my mental model of Looking Glass and Alice - however I don’t know if the mentors have the time or resources to do the same. In my struggle to figure out how the heck I’m supposed to be finding the color of an input, for instance, I have the ability to search through the code base, look at Aaron’s awesome diagram, or ask Dennis. The potential mentors probably won’t have access to either of those resources. This, then, makes the case for more API methods that take away the need for mentors to have this knowledge. For instance, I added a method that returns a set of the automatically generated method names. Although I will continue to add to these methods as I continue to write these tests, I will by no means have anticipated every need or question a new mentor would have. A mentor could potentially write a helper method that would be useful for other mentors. Where, then, do these go? Are they submitted to bank of helper methods that other mentors could access? Are they submitted to us for inclusion into the API? Maybe we track the use of the different methods and include the ones that are most often used.

Comments

  • No comments yet

Log In or Sign Up to leave a comment.