16.04 2010

Creating an application from zero to done: Day 4

Today I had to do a lot other stuff than on this project. I actually did some of my normal work for a change, went to school to attend to a lecture and went to see some stand-up in the evening. I could only squeeze in work on this project between 12:00-15:00 and 22:00-02:00. It wasn’t really enough. I finished some basic views for all three main objects (players, tracks, rounds) but then I noticed a showstopper bug in my software regarding db4o. To add a new round, I create a round object, fetch the players and a track and set these to the round, fill in all the scores and tell db4o to store the round. Every time I stored a round, db4o also stored a new copy out of the players and round into the database. I ended up pretty fast with hundreds of copies of the same objects, which pretty much made the whole software useless. I have now spent a couple of hours trying to figure it out, but in vain. The view pages are somewhat limited, and I still have my home screen completely undone and it can’t really be done before the db4o problem is solved. I guess I can squeeze an extra hour to this before the deadline 12:00 tomorrow, but it’s 2am now and I want some sleep!

Comments
14.04 2010

Creating an application from zero to done: Day 3

I worked about two hours extra yesterday on the project when I got home. The goal, as I said, was to draw the mock-ups for the two other ‘add’ screen, Player and Result. I did that, and actually implemented the Player mock up along with half of the Result mock up. It went quite fast as the foundation was done. I finished the ‘Add Result’ -view on Wednesday morning in the next three hours. That is probably the most complicated view my software will have. At this point I had all add views done and only need views to view data anymore. As I had no real persistence I decided to close the GUI project and start working on the domain project.

First look on db4o

db4o is a data storage framework that works in an object oriented way. The instruction text looked very promising. You don’t need any annotations or XML configurations and it will accept any object for persisting. Basically you just do this to store something:

ObjectContainer db = Db4oEmbedded.openFile("path/to/my/file/");
try{ db.store(myObject) } 
finally { db.close(); }

That looks very easy. Almost too simple to be true. But it was that simple. I had persisted my first objects with only three lines of coding. I downloaded db4o (with maven), read up on how to use it and implemented the store and ‘list all’ functions for all my entities in three hours. Very nifty! The only downside with db4o I see right now is it’s licence, which is GPL, which means that I have to decide to either publish all my code as open source or find an alternative to db4o before I publish my project in any way (i.e. make it freely usable on the web, give it to friends for personal use etc.). Got to think about what to do.

I also worked along with the GUI project by making a page to view information about the players in the system. It’s basically just a table with all players in the system and when you choose one, you’ll see an info grid on that player. Now it still only shows the name of that player. I’ll make similar views on tracks and rounds tomorrow and a nifty home page showing info of the logged in user. Then there is just some polish and adding a graph or two left. Probably will make it in time. Maybe.

I’ve clocked somewhere around 28 hours on this project with an additional four of five hours on the course doing something else than the project (introduction and such). I’m starting to notice that the 11-12 hour days are starting to wear me out but my inspiration in this project, and the inspiration to succeed will still push me forward through the last day of coding.

Comments
13.04 2010

Creating an application from zero to done: Day 2

Day 2 started of fighting with Maven. Setting up the web project was not as straightforward as I would have hoped. First step was to find how out how to use the Vaadin archetype to generate the project. The archetype doesn’t seem to be in the main maven repository and I had a hard time figuring out where I can add new repositories to m2eclipse, and which repository exactly to add. I got it finally right with a lot of trial and error and it generated me the dynamic web project with an start-up application and Vaadin jar etc. That was just the beginning of my problems. Next up I had the problem that eclipse’s WTP didn’t accept my project and I couldn’t deploy it directly. I got WTP to recognize the project as a web project by adding natures to .project file and finally adding the Java and Dynamic Web Module project facets. After getting it deployed on tomcat I noticed that my web.xml generated by the archetype was empty, and I had to copy it in from another project. The final issue I had was that WTP didn’t deploy the Maven Dependencies, which contained the Vaadin jar, so I had to manually modify the .classpath file. It was a bumpy road but finally I got a grey page on the screen with a button saying “Click Me”. I probably should make a tutorial for myself how to set up a business logic project and a Vaadin project at some point, because that is basically what I need when I start something new. But now it’s time to get into the coding!

As I got the architecture right I started cranking out the code quite fast. First thing I did was to create a static page that looked exactly like the mockup I drew yesterday. With that finished I had the basic layout with header and content, and placeholders for my main parts of the application - Home, Add and View.

I also had the time to finish of the view for adding new tracks in the system. That’s one of the three view’s of the ‘Add’ part. The two others are basically the same and I already got the mechanism done to send messages back and forth so it should implementing the rest of that part should go quite fast. The view sends the data to a front controller now, which sends it forward to a service on the backend. The service does nothing at all for the moment. I’ll probably make those when all the ‘Add’-views are done.

So two days behind, two still in front of me. I worked on this project for about eight hours today. I got the data model, tests, the GUI template and one view done. I still got left about six views, persistence, doing graphs, theming and some final touch-up here and there. It’s a lot to be done but I guess it is doable. I think I’ll draw the views for adding players and results still today, and start implementing those tomorrow. I hope I also get the persistence somewhat done tomorrow.

Home screen

Add track screenshot

Comments
1 of 4