Persistence, Persistence, Persistence! – TrayRSS

Well, if you are a code esthete, you won’t be happy with trayrss. The way it was. I wrote many tests and began to refactore it. Read more about my progress.


criss cross

messy mason
messy mason by Brittany Randolph

Well, if you are a code esthete, you won’t be happy with Trayrss. I did a messy work in the beginning and if you gain technical dept you have technical dept. Fact. I could find excuses (it was a tech playground for me and it has grown, and so on …) but let me be honest, I could have done better.

And be honest to yourself, do you really like your coding from about 4 years ago?

So now it’s time to pay for my depts.

garbage man

I’ve started to clean up my code in the previous release. But big refactorings are risky, even more if there is poor unit test coverage. So the plan is to reimplement the modules of Trayrss. First of all I decided to add more structure by declaring some modules like gui, service, domain and persistence. I moved the old code in the new packages, knowing that I will not be able to separate the concerns completely.

To gain code quality I’ve picked one of this packages in this release, the persistence layer, and started to rewrite it from scratch. The good, the bad and the ugly – yep the old persistence was two of it and to bad that every other component got in touch with it!

Rettet die Ampelmännchen!
Rettet die Ampelmännchen! by Kyle Gradinger

So I wrote tests, unit tests, well I should better call most of them integration tests. They represented the state of the code when I began to refactor and to clean up the mess. While bringing structure to the code, I wrote even more tests matching the new needs. Frist failing, a bit later changing to green. And at the end I had a simple api for my persistence, fascading every database access. The other components now don’t need to care about transactions, lazy loading, storing any more. And if I have to add or change something in the future, it will be easily verified due to my tests! Success!

collecting eggs

With this new fundament I’m convinced that I can move TrayRSS and it’s gui to a new level, increasing the user experience. To reach this goal in the next iteration I’d like to rebuild the tray menu with JavaFX and explore the promised compability of Swing and JavaFX by integrating the old configuration dialogs with it. Don’t worry, this old dialogs will be replaced in future releases too.

be gentle

If you like to help me with this work, or just want watch how messy my code really is, I’ve got good news for you. I will release the source TrayRSS on Github within the next release. So stay tuned for upcoming updates on TrayRSS or get the newest release on the official homepage.

Eggs
Eggs von Spamily

Ähnliche Artikel:

Autor: Thomas Pummer

Thomas Pummer ist Softwareentwickler an der Universität Wien. In seiner Freizeit betreut er das Open Source Projekt TrayRSS und werkt an diversen anderen kleinen Projekten. Er ist sehr interessiert an Open Source und Webentwicklung und testet gern neue Programmiersprachen.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

*