Sunday, October 23, 2011

Composite Key Problem in Doctrine and How to Work Around

I tried to create an invoicing system with symfony 1.4. It did not work out well as the database design contained some complex composite keys which were not possible to be mapped properly in doctrine that is bundled with symfony 1.4.

I tried to work around by creating the database first, and then generating the schema. But, if I use the same generated schema and created the database, some extra unnecessary  constrains were generated. These constrains made the database design useless. After trying a couple of time, I lost my faith in doctrine, and just gave up.

See my post on doctrine and composite keys to see the design which caused the problem.

I heard that symfony-2 has a better support for the composite keys, and tried it out. Again, it did not work out well.

Then, after some searching, I learned that to properly use an ORM, I should start with a class diagram. ORM should persist it to the relational database. I should not go the other way around, which is, creating the relational db structure and mapping it to the class diagram. So, I tried the above db design in the OO context, and below is the initial draft I could quickly produce. This diagram sees simpler and natural to put into action with an ORM.


A complex problem to be solved in one perspective, can be a very simple one in another perspective. Finding the right tool, if it seems hard, then consider finding the right perspective to solve the problem.

Sunday, October 16, 2011

Nokia - Maemo, Meego, Meltemi, and What ....?

History has proven that division of labour is the path of the future and present. Nokia should have concentrated on Phone Hardware rather than trying to come up with a phone OS. Their efforts to come up with Maemo and Meego were proven failures. They shared the same fate as HP's WebOS. (Now that google has bought Motorolla, will the history repeat? The answer is yet to be seen)

In the meantime, other phone companies started making phones for Android. That worked well as the model goes along the well proven division of labour concept. They had out-beaten Nokia in the Smartphone Niche.

From the above perspective,  Nokia's decision to go with Windows-7 Mobile is a good choice. And Plasma Active is a recent choicewhich is now open . Even if they had decided to go with Android, that would also be fine, if they had the capability to compete purely based on the hardware.

Or has Nokia lost their faith in their hardware competency and trying to survive with the brandname and some software differentiation?