12.04 2010

Creating an application from zero to done: Day 1

As I might have mentioned earlier on, I’m still a student at Åbo Akademi, working to get my master’s degree in computer science. The studies have not really moved forward in the pace I would have hoped, since i have worked almost full time for the last two years. I’m trying to get my last courses done this semester so that I can then start, and focus on my final thesis.

I got a chance to take a intruging course this period. My school and my workplace was organizing a one week intesive course in Vaadin! The course itself is a walk in the park for me as I been working with Vaadin full time now for over two years. It is an introduction course where you are supposed to make a basic application with the framework. The example application coded live on the presentation of day 1 was a RSS reader, and the course participant’s projects should be of the same magnitude. As I probably got about five of that size projects already done, and when it isn’t really a challange for me, I decided to make something bigger.

I got interested in golf last summer and got me a bag of clubs of my own this spring. For that reason, and that I’ve been wanting to test out new Java frameworks, I decided to start doing a golf result tracker software. This is a total overkill for the course but I get to do something I think is fun.

For the backend I decided to go with Maven for package and dependency control and db4o for the database, along with JUnit for testing. As a seprate project I’ll do a Vaadin frontend with at least two addon components found on the newly released Vaadin Directory, ChameleonTheme for making a custom look & feel, and VisualizationsForVaadin to plot some graphs. I think this set of complexity is about what I will be capable of doing in the four days (Mon-Thu) we have time to code on it. Vaadin is in a different project so that I can add alternative GUI’s to it sometime in the future, if I end up with a decent application. An Android and iPhone app would be handy when being on the golf course!

Today I started looking at what features I want to support in the project. I decided to limit it to adding and viewing of players, tracks and scores. With this small featureset I have still room for some feature creeps. I went on defining a data model and basically coded the first version of all entities all the way. It resulted into seven different entities. I also did some user-handling and password encryption for safe data storage at one point when I accidentally got a little carried away. After defining the fields for the entities I started doing unit tests, and added the getters and setters to the objects along the test writing as I noticed which ones is actually neccessary for the applicaiton (for example a lot of setters are not allowed to be called after initialization and I prefer to have less code and no unused public methods). My project has only entities and tests and no entry point to the application itself. Only dependency injected so far with Maven is JUnit. The code base is still only 355 total lines of code, with 54% of it being tests. 93.7% of the code is being tested with only some catch clauses and such still being outside the coverage. This information is gathered with the plugins ECLEmma (for code coverage) and Metrics (for metrics, duh!) for Eclipse. Moving on from actually coding, I started with doing some mockups of the user interface. I used Balsamiq to do them, as it is really fast and it is free to use online. I did five mockups which is about a third of what I need. These focused on the main screen of the application and adding a new track to the system.

I’m starting to somewhat get a picture of what the application will include at this point. Tomorrow I will probably start with setting up a project with Vaadin and fiddling around with the main layout of the application. I’ll probably draw a couple of mockups and alter the business logic too as I will probably find some points that could have been done better.

Mockup of the main screen

Comments
14.03 2010

Becoming an investor

Now is a good time to write about my interest in investing and finance in general. Why now, you ask? Well, this week is the first time my stock portfolio total shows a positive number, calculated roughly from the day this recession we have started. I made my first bigger investments just before the downhill started, so I have been looking at a red summary row the whole time I have been investing, until now. Having had this declining market is not all bad. I lost a lot at the beginning, but I have got the total up to +-0 by heavily investing over the second half of 2009. If I hadn’t believed in the markets I wouldn’t have invested more, and I would still have losses of about 20% today. This means that the market as a whole hasn’t yet fully recovered from the recession, which means that the rest of the recoverement is in other words pure profit to me. Yay.

I think I invest a little bit too heavy for the moment, but I just see great potential in it. I took a course in investing in fall, and one detail that was said on the course really stuck into my mind. That was that you should not invest money that you may need in the near future, 5 years or so, except when you get some very secure/short term investments (state bonds etc.), and only a fraction of all your investments should be in the high risk/volatility sector at all times. This is funny when the most expensive object I have, after my investments, is my TV, and roughly 90% of all my investments are in stocks. I may also need the money in a few years if Katja and I decide to buy our own flat. They say it is good to not worry about the risk so much when investing, but I have a feeling that I sometime neglect it alltogether, which isn’t either good. 

Here’s what my portfolio looks right now. Company names along with their percental weight:

Finnish stocks:

Affecto		10,0%
Elisa            1,0%
Fiskars		 2,6%
Fortum		 6,0%
Huhtamäki        9,4%
Kemira		 0,4%
Neste Oil	 2,1%
Nokia		 7,4%
Nordea Bank	20,4%
Orion		 2,8%
Outokumpu	 7,7%
Panostaja	 1,8%
Pöyry		 9,2%
Rautaruukki	 1,9%

Funds:

India Fund	 3,3%
East-Europe Fund 2,7%
China Fund	 2,9%
Russia Fund	 3,0%
Low yield interest/stock fund 5,3%

Next step in shaping the portfolio is probably to take a deeper look if the stocks are evenly spread out in different industry segments to minimize risk.

I want to stress the benefits of investing to everybody. Only way to get a little extra, and not being so dependant on your payday is to take care of yourself. That, by making sure you have a few other sources of income. “Become financially independent” and “don’t work for money, make your money work for you” as Kiyosaki said in his book ‘Rich dad, poor dad’. A great book - read it if you haven’t yet. Yes, you! However, I really can’t recommend actively investing in stocks to anyone, except if you are ready to get really commited into the whole thing. Funds are so much easier to invest in when there is someone in the banking firm taking care of your money the whole time, for a living. The profits may be a little less because of extra fees but the risk for the portfolio to crash is that way so much smaller. I am bound to sometimes lose money on the stocks because of my dumb decisions. That’s because I simply don’t know enough right now about the dynamics of the markets and the companies I invest in. But I am ready to lose some in order to learn, as you learn from your mistakes. I think the fastest way to learn (but maybe not the most profitable) is to just jump into the game. It is, aditionally, a hobby to me, with it’s own thrills and chills.

Comments
21.02 2010

The Curious World of Java Frameworks: An Introduction

I have felt all my time being a programmer that I don’t know enough of my field of profession. I guess you could call it a healthy curiosity and the need to become a better software engineer. At first, when I started working, I wanted to get a better grasps of the very basics. Learning to use Java efficiently, which is the language I work with, learning nifty programming tricks, coding in an object oriented way, testing, building, refactoring, writing maintainable code etc. I feel that I have gotten a hang of these things now and my curiosity has moved on to other things. My latest interest lies in third party frameworks which have caused a big buzz in the Java community lately. I tout people to use our company’s GUI framework, but at the same time I haven’t bothered to look at other readily available frameworks out there.  I guess that many in the branch too easily just starts to code their projects head first, instead of taking the time to look around for a moment too see what’s available out there. Many of the common project requirements have already been coded a bunch of times, and many end up building their own little framework when there is already many proven and free solutions available for download. I don’t think it is so much of a case of the Not Invented Here -syndrome (NIH), although it could be a factor, but more of not just knowing enough of all the powerful tools that you could add to your toolbox.

I have therefore gathered a list of frameworks that interests me, but of which I don’t really know anything about. The biggest one of these is the Spring framework. Next of the bat comes Maven and the third is db4o. There is a few others too but I won’t go into details right now.

The parts of Spring that I’m most interested in is building more modular applications with its Dependency Injection (DI) and Aspect-Oriented Programming (AOP) capabilities and it’s Object-Relational Mapping (ORM) integration tools to automatically handle connections, transactions, exceptions etc. to the database. I use Hibernate a lot and Spring has Hibernate integration, so I’m interested to see what parts of my own code is already implemented in a more generic solution into Spring. I just got the book ‘Spring in Action‘ by Craig Walls that I’ll start exploring at some point. The downside is that the book is 700 pages and I’m a terrible slow reader. On the plus-side, Spring in very modular in itself and the most important modules are presented in the very beginning of the book. That means that I can take some new features to use after every chapter.

The one that I’m going to look at first, however, is Maven. Maven is first and foremost a build system to easily produce jar:s, war:s and ear:s of your projects. Additionally, it can download other framework jar:s for you and easily plug them into your project. I’m looking into it to simplify project structures and have it help me to handle dependencies between my own projects when there can be up to six different projects depending on each others.

db4o interest me because I want to see what alternatives there are to SQL. Object databases is one of them. I’ve heard that db4o is really simple to use and that would be a great asset to small pet projects.

So those are the frameworks I’m gonna start off with to enlarge my Swiss army knife. I’ll start with Maven as I already have tested out it a little, it is fairly compact and it defines the project’s structure. It’ll be a lot easier to add on the other frameworks to the project when I’ve laid the foundation with Maven.

Let’s see how this starts off..

Comments
2 of 4