Tuesday, March 10, 2015

Changes 3/9/15 - Blog Url Change and Blob Downloading

So the first thing I did today was change my blog url from ahirschberg-website.blogspot.com to ahirschberg-programming.blogspot.com.  I didn't want all the avid readers of my blog to get confused though, so I registered a new blog under the old domain and made a post with some Javascript that redirects to this blog. The line I used was
setTimeout(function() {
  window.location.replace("http://ahirschberg-programming.blogspot.com")
}, 2000);
I decided to have a timer rather than instantly redirect so that visitors to the site would be able to at least glance at the message saying the blog had been moved.

We also started working on downloading files rather than streaming them.  Our #getFileFromUrl method, which creates and sends an XMLHTTPRequest, is very reusable.  I just added a shortcut(?) method (forget what these are called): #getBlob(url, load_callback) which just calls getDataFromUrl(url, 'blob', load_callback). This is probably a code smell or something, because I'm using a lot of magic strings and specialized methods calling a base method with specific parameters, but at the moment I don't feel like it's too pressing of an issue, especially because there are other portions of the code which will need a lot more attention.

 The code is really hard to navigate, especially for me since a lot of it is stuff I didn't write myself.
Additionally, our app has no structuring or objects of any sort, which makes it very hard to navigate.

This method is a good example of a problem I see in the code.  The time variable is currently passed around as an int and hours, seconds and minutes are found using math within the method.  This should really be some sort of PlayTime object with the integer as an underlying variable and methods doing the math to return seconds, minutes, and hours rather than have these operations done within the method.  I'm not trying to nitpick, and this is just one random thing I happened to notice when reading over the code, but also illustrates what I think is a problem with our code structure in general that we will need to deal with going forward.

1 comment:

  1. You are not nitpicking at all. One of my biggest hopes is to be able to use your app here as an example for other future app developers to learn from, particularly future students in our IT program. Using the best practices Kevin taught you is both a node of respect to him for his effort as well as a feather in your cap demonstrating what an excellent student you are! ;-)

    Please continue focusing on refactoring and improving your code base. Maybe Kevin will be willing to give it an eye over as well, to see how well you are applying your lessons?

    ReplyDelete