bookCache
directly into the UIState
object, so that it is 'insulated' from the rest of the code. I think that this makes sense, because we never really use bookCache
outside of the context of UIState
, so the two are clearly linked. This would also allow us to have more control over what code can do to the bookCache
by moving it out of global scope.I also asked Kevin what he thought of my approach to our
XMLHttpRequest
code. I was worried that having a base function that is referenced by other functions which pass in specialized strings might not be a good thing to do, but he said that this was definitely a valid design pattern. The getDataFromUrl
method is essentially a template, and the three specific methods pass in specialized parameters to customize the specific steps that are taken to launch the request.I also wanted to make sure I added in this quote from a guy named Tony Hoare that Kevin sent me a while ago after my "bad code vs. good code" post.
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult."
I love that quote. Glad you included it!
ReplyDelete