2015/08/23

Week 2 at Epicodus JAVA/Android program


The second week of Java was hard.

Working with objects within objects within objects, think Inception of Objects. Add RESTful routes with Spark and yes, what a complicated maze!

On the plus side, those mazes led to some interesting projects, like the Tamagotchi and GoFish. Each of these particular projects taught me – through trial and error and error and error and blood and tears – these two fundamental things:

1. DO NOT try to manipulate time. If objects within objects lead to Inception of Objects, starting a counter in one of those classes and trying to manipulate it from another class can create parallel dimensions which lead to your Tamagotchi dying terrible inevitable mathematical deaths. Other pairs were more successful by creating a “click here to make time pass” method.

2. Removing items from ArrayLists while looping through them is not as easy as it sounds. The safest way we figured to do that was to store the items you want to delete in another temporary ArrayList and then remove this temporary ArrayList. It’s tricky. There are many questions about it on stackoverflow, we looked at the documentation a million times but I we didn’t find a good enough answer. For now, I’m keeping the temporary ArrayList trick in mind, hoping something better comes up in the near future.

But hey, the week wasn’t just blood and tears and dead Tamagotchis and ConcurrentModificationException, we also started pushing functioning projects to the web through Heroku! So here you go, my first project to go online and this week’s Code Review challenge, a Dictionary app: https://blooming-sea-3658.herokuapp.com/

You can add words and definitions and ok, it’s not very useful because they’re gonna disappear when you restart your session since they’re not linked to a database. Yet. Because guess what, tomorrow we get started on SQL!