Pokemon Manager - part 3

Pokemon Manager had progressed quite nicely over the past couple of days. I’ve now got the database working for saving pokemon, so I don’t think it will be too much of a stretch to work on releasing them again, which should be as easy as removing them from the database. I feel as if I’m at a bit of an awkward state, timewise. I will probably, hopefully, finish the releasing of pokemon by the end of today or tomorrow morning. I have a full two points tomorrow though, and I had hoped that I’d have enough time to do a web interface in addition to the cli interface I’ve currently got. I don’t want to hand something I am not happy with, and I don’t know if two points is enough to create a web interface that I am happy with. I wouldn’t want to rush it, and it would have to be styled as well, so, even though all the functionality should be easy to implement, I don’t know if it would be worth it. I would hate if I were to try and get a web interface working and then in my mini review for someone to say that I should have spent more time on my core code.

I do know that having a mini review board is a really good oppertunity though. I’m going to have a whole bunch of crafters looking at my code, and not just in a ‘I can’t work something out please can you help me’ way, but in a really considered way. That’s great, and I feel very lucky, and I know it doesn’t happen that often so I want to show them as much as I can, and I would like feedback on something web based, but it’s just time. I have to make a decision on whether I can use my time to improve my current code, or create a new interface. There is also the fear that I could spend two points working on a web interface only to decide it’s not good enough and I don’t want to hand it in, and then I’ll have two points worth of code that isn’t really worth anything. Well, it will be obviously be worth something, but not to my mini review board.

Anyway, enough about my time worries, I will decide that when I finish the setting pokemon free story. I’ll focus on delivering the requirements before thinking about any extras. What I have been doing is working on my database. I decided to use a database because I knew that it would be easier to use a database storage system with a web application. I also wanted to practice using databases. We used one in Lunchman, but it was one of those exercises that, if I had to repeat it, I wasn’t sure if I could. I wanted to find that out, and I was pleasantly suprised. I’d remembered quite a lot, and found that my understanding had increased. When it came to debugging, I think when we were working on Lunchman, I didn’t really have a clue how to go about it, but this time around I think I got my head around it.

I obviously couldn’t get IntelliJ working with the database, I’m still not sure why. It wouldn’t recognise the driver. I tried mutliple different versions, adding jars to the classpath and even downloading them so that I had local access. I couldn’t get it to work and I feel that I probably shouldn’t blame IntelliJ, as I know that you can use IntelliJ with a database, I just don’t know how to use it well enough. Gradle was running my tests fine, so, to save time, I used the command line instead of the IntelliJ test runner. This wasn’t too much of a problem, I actually quite like the html file gradle gives you for your test data.

So I think I’ve learnt a lot about databases, and feel much more comfortable with at least postgres and Java.

I spiked the database to begin with, and once I got it connected I considered deleting it all and test driving the class all over again. I felt that this could be overkill, it was only one class after all, but after about ten minuites of working with the spiked code, feeling that there were probably two classes in my one spiked class and finding it impossible to seperate them, I deleted the code and started again with a test. I felt like this was a good step in my development. I’m really learning to love TDD more and trust it. When I TDD, I write better code and I trust my code more. It’s all well someone telling you the right way you should do something, but that point when you really see why one way is better than another is a good feeling.

Testing the database wasn’t as hard as I thought it could be. I had a few errors with not tearing down correctly meaning data was persisting from one test to another, but once I had sorted that, the tests were straight forward. I used what I learnt from LunchMan about the Repository Pattern to test integration with my database and my PokemonManager, and that made things much easier.

Another thing that I’ve been working on through PokemonManager is my documentation. When a package or library or language has really bad documentation it makes me not want to use it. It makes me distrust it. I feel that if the developers can’t be bothered to write documentation, then how can I trust they can be bothered to write working code? I know this is not really the case, but I love good documentation. My documentation, however, is awful. I never really thought it was necessary for my code because, really, who is going to be using the code I’ve written anytime soon? But I should practice. I want to make my code as easy as possible to use and make use of, and for that, documentation is really important. So I’ve been practicing with PokemonManager.

So that’s what’s been going on with PokemonManager. I’m really enjoying it. I’m really really enjoying just trying to write good code. It may not be great code, I am sure it’s riddled with problems, but I feel that I have so far done the best I can manage at the moment, and that’s a good feeling.