A26: Model Implementation
This week, we focused our attention on another critically important part of any web application; persistent data. Up to this point, our applications relied on in-memory repositories, which were great because they were easy to work with and debug, however, as soon as that application stopped running, the data was gone. Implementing a persistent back-end, MySQL in our case, solves this problem.
In this weeks WODs, we learned how to implement a MySQL backend into both local and deployed applications. Complete descriptions of the WODs can be found on the ICS314 website here.
WOD ModelImplementation-1: DigitsMySQL
Goal: Learn how to implement back-end persistence for our web apps using MySQL and EBean.
Prior to attempting this WOD, I read through all of the assigned reading. Despite this preparation, I still found this exercise extremely difficult. In fact, I would say that this was perhaps the most difficult WODs assigned this semester. I was not able to complete the exercise on my first attempt and DNF’d after an hour and 30 minutes. The following are a few of the reasons I think this exercise was so difficult:
- During my first attempt, I didn’t have a very good understanding of the functions of annotations and how they affect the creation and structure of the database tables. I also didn’t understand how to designate a relationship between two different entity instances.
- There doesn’t seem to be a way to debug the app as you’re building it. In previous WODs, we were able to write a little bit of code then refresh the browser to test that the application still works. When implementing the database backend, one has to set the whole thing up first (import the right classes, annotate the appropriate objects and fields, and update the implicated methods) before testing can occur.
Immediately after failing to complete the exercise, I watched Dr. Johnson’s solution and took notes on his implementation and explanation of his approach (I did the same thing during the Authentication and Authorization WOD and found it very helpful in completing both the at home and in class exercises). I repeated the WOD and was able to complete in Av time of 1 hour and 7 minutes. Later that night, I decided to test my retention of what I had learned and repeated this WOD. I finished my third attempt in Rx time of 46 minutes and 27 seconds.
WOD ModelImplementation-2: DigitsCloudBees
Goal: Learn how to deploy a MySQL-backed Play application to CloudBees.
Compared to the previous WOD, this exercise was a breeze. Not only did Dr. Johnson provide us with hints, but we previously deployed a MySQL backed application in assignment A25. Since this WOD was a review of a process we’ve already done, I was able to complete it in Rx time of 22 minutes and 22 seconds on my first attempt.
Although the last couple of assignments have been difficult, I feel that with the skills we’ve acquired (such as authentication and authorization and persistent data) we now have all the tools we need to create effective web applications.