Skip to main content

Posts

Showing posts from July, 2015

Designing Key/Value Repository API with Java Optional

I spent some time last month by defining our repository API . Repository is commonly component used by service layer in your application to persist the data. In the time of polyglot persistence , we use this repository design discussed in this article to persist business domain model - designed according to (our experience with)  domain driven design . Lessons Learned We have large experience since we used nhibernate as a persistent framework in earlier product version. First, and naive, idea consist in allowing the programmers to write queries to the database on his own. Unfortunately the idea failed soon. This scenario heavily relied on a belief that every programmer knows how persistence/database work and s/he wants to write those queries effectively. It inevitably inflicted error-prone and inefficient queries. Essentially, nobody was responsible for the repositories because everyone contributed to them. Persistence components was just a framework. The whole experience implies