Archive for the ‘java’ Category

OpenMRS Module Development Learnings – 102

Update November 2018: This blog post has been superseded by the OpenMRS SDK (
My team mates and I are completing a number of OpenMRS workshops focused on improving our module development capability. This blog post captures the unwritten lessons that we have picked up as a way of giving back our lessons to help others in the community (and will be moved to the OpenMRS Wiki once the lessons have been internalized and consolidated, as that is its natural home).
The approach is based on the following OpenMRS community articles:
  1. Creating Modules –
  2. Creating your First Module –
As you develop the module it is important to keep testing and verifying whatever you do especially when the module involves user interface components, extending the OpenMRS UI. The process we ended up using was as follows:
  1. Setup a module using the module creation command line utility
  2. Downloaded Spring Loaded from its maven repository
  3. Downloaded and setup OpenMRS standalone from picking a version greater than 1.11.x which supports debugging options
  4. Once the standalone version is installed, open the and add the following variables to the vm_arguments: (should all be one line – separated here for clarity)
    • -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
    •{absolute path to root folder of the module}
    • -javaagent:{absolute path to spring loaded jar}
    • -noverify -Dspringloaded=inclusions=org.openmrs.module.modulepackage..* (note the two trailing dots before the *)
  5. Setup newly the module into an IDE (tested with IntelliJ & Eclipse)
  6. Installed a FileSync utility, RemoteSynchronizer for IntelliJ & FileSync ( for Eclipse
  7. Setup sync for the omod webapp folder into the standalone webapp folder located at WEB-INF/view/module/{modulename}
Our development workflow is smoothened out since any changes to Java classes & JSPs are automatically applied & reflected in the standalone app.
Additional Tips and Tricks
  1. Tomcat – Change the following init params in web.xml:
    • modificationTestInterval from 4 to 0, so that JSPs are automatically recompiled
    • development is true (this is the default)
  2. Intellij – the Java classes are not automatically recompiled on saving changes so there is need to run mvn package -DskipTests
  3. Follow the OpenMRS conventions as much as possible by cloning openmrs-core to see how the design of the interfaces, service layers is done. This will help get access to lots of the magic that happens behind the scenes.
  4. Java 8 will give you trouble, stick to 1. 7 as we did not try 1.6 anywhere.



Launching Syzygy – Uganda Focused Utility Calculator

Just as Google has rebranded into Alphabet, on behalf of Styx Technology Group I would like to officially announce the launching of Syzygy which is a platform for a comprehensive utility calculator for Uganda based on PAYE Calculator ( which was released by myself in 2012.

There are many calculators and utility apps out there, but there are none focused on Uganda specific computations and tools required within the country today. This initial launch is an upgrade of the look and feel of PAYE Calculator to the Android material design, refactoring of the back end to provide the necessary modularity for expansion.

Need any specific features or computation for consideration please contact us at styxtechgroup at gmail dot com

Looking forward to hearing from you

The link to the Syzygy app is

Update 3:

Just had a little techie moment there so I thought I would add some more meat on the technology thinking and approach used for this new platform:

  1. App Compat Library – which provides material design features for pre-Lollipop devices, and this app should load on Ice Cream Sandwich (Android 4.0) devices
  2. Model-View-Presenter (MVP) design pattern akin to Model-View-Controller for web applications. The models will be POJOs (Plain Old Data Objects)
  3. Theme and other functional customizations are being kept as minimal as possible to speed up development and reduce the quantity of testing
  4. Layouts will be as fluid as possible to handle multiple screen sizes, however more focus will be placed on functionality to make this app useful after all Material design is already beautiful.
  5. As few permissions as possible will be requested of you during installation, after all the app does not need them.

Update 2:
There have been quite a number of questions on the inspiration behind the names, so here goes:

  1. Syzygy – In astronomy this is when there are three (3) celestial bodies in a straight line usually the earth, sun and moon. At this point once could argue that the bodies are either in conjunction (working together) or in opposition. In reference to this utility all the tools are meant to work together so that the sum of the parts is greater than the whole.
  2. Styx – In Greek mythology this is the river in between this world and the underworld, with the power to make one invincible. We at Styx Technology Group seek to bridge the divide between those who understand and those who do not understand technology, its impact to society and how to leverage it for growth.

Update 1:
Screen Shots

Home Screen

Home Screen

Navigation Bar

Navigation Bar

PAYE Calculator

PAYE Calculator

ORM Anti-pattern – Right conclusion, wrong reasons – Rebuttal

This is a rebuttal for Right conclusion, wrong reasons  ( ) for an ORM being an anti-pattern.

The main purpose of an ORM (Object Relational Mapper) is to fix the object-relational mismatch, which is a mismatch between how an object is treated differently by the object oriented and relational paradigms which are fundamental constructs in programming and data storage/retrieval. The mismatch is well addressed by Scott Ambler of the Agile Manifesto (, Jeff Atwood of Coding Horror (

The traditional waterfall method handles this problem by trying to identify all entities and relationships before development begins. However the Rational Unified Process (RUP), Scrum and other agile development methods, however face a problem in that the data model changes, drastically during development, as more information becomes available and the client/implementation team learn more about the solution and business needs.

Hard-coding SQL statements becomes critical as these changes are not easily reflected as the database model evolves. ORMs like Hibernate ( and Doctine ( provide a means of mapping the POJOS (Plain Old Java Objects) and POPOs (Plain Old PHP Objects) into relational tables via XML mappings, and annotations (depending on your needs). As your model changes rapidly, all u have to keep changing is the database schema and object definitions.

The major strengths are also a big weakness, ORMs generate generic SQL which is not very optimized, so is slow when using traversing the object graphs, however a mix of ORM access (content pages, display pages where most attributes are displayed) and straight SQL (for lists and pagination) tends to reduce the impact of a the problem.

I have no experience in the new NoSQL data stores so I do not know what the implications are, but ease of unit testing, tool support etc, save time especially when the changes are rapid 🙂

Software Development Process – The Journey

I am starting a new set of topics on my experiences in the practical application of the software development lifecyle (SDLC). The tools are as important as the people, however a versatile process will always allow you to change one without the other.

My initial exposure to the SDLC was through the Rational Unified Process (RUP – in 2001 which along with the Unified Modelling Language (UML – during my days of Java development. Over the next 5 years there were a number of other influences:

  1. Eclipse ( vs JDeveloper
  2. Hibernate ( Object Relational Mapping project, to ease the SQL needed to save and update POJOS (plain old java objects)
  3. Spring Framework ( the first step towards a useable Java Framework from Rod Johnson, with Dependency Injection, XML bean configuration, Application Contexts all dealing with POJOS. I basically memorized his whole book J2EE Design and Development
  4. Martin Fowler, Refactoring – Changing the Design of Existing Code without affecting functionality
  5. Scott Ambler – Object-Relational Mismatch, Coding Standards, and Database Refactoring
  6. Kent Beck – Junit
  7. Design Patterns from the Gang of Four – while these were not immediately applicable, they were extensively referred to in refactoring and the spring framework
  8. Alistair Cockburn – Use cases – did not make so much sense till about 2 years ago
  9. Javaworld and the ( – excellently written articles on solving common problems and experiences before Google and StackOverflow (
  10. Not forgetting the good old version control, have been using CVSNT (, yes CVS on Windows, however the product has been retired, so its almost time to move, though to what – Subversion, Mercurial, Bazaar???

Also mid-way was a change of programming languages from Java to PHP mainly due to ease of deployment for web applications.

Therefore the journey will touch on the different influences to a practical process that is still evolving.

OpenCMS Woes – Three Pipe Problem Solving Technique

Well it seems like my woes with OpenCMS migration seem to be over, but the issue is so strange only experience can enlighten one. This still re-inforces my thoughts that Java based applications are huge, complex and diffcult to work with.

My expectations for a migration are as follows:

a) Copy application files from one server to another

b) Move application database from one server to another

c) Configure application files to use new server

The steps do not matter whether operating systems have been changed or not, as long as the same versions of the application server remain the same (no major version changes). However with OpenCMS it seems like that is not the case. The database files have to be in sync at a point in time, yet this is not mentioned in any of the manuals, my team seems to know this by heart

How did we solve this, almost by accident, it may seem, but we have to give credit to the Three Pipe problem solving technique championed by Sherlock Holmes. Basically we left the problem alone for the time it takes to smoke 3 pipes (3 days), then we had a fresh perspective of the problem.

If the basic migration has failed, how else can one export data from one openCMS installation to another, use the “inbuild CMS export functionality”, but the site is too large! Then export a folder at a time.

And bam!! there it was, almost like a charm, one by one the folders were included in the site and one by one the website took shape. Now I am off for a good nights sleep, the vampires and monsters will have gone for a rest, as we tackle the rest of the problems in this case.

Thanks Sherlock, loved the 2010 edition of your movie too. I promise to re-read all your exploits before 1 year is up

%d bloggers like this: