Tuesday, 24 December 2013

What is going on with 1.0-alpha3?

Time between alphas in 1.0 release cycle is really long. Alpha1 was released 1.5 year after 0.12, alpha2 - more than month after alpha1. Another month passes but there is no alpha3 in sight. There are several reasons for this.

First, I'm the only active developer of Kadu now (beevvy is porting it to Qt5, but he is doing it in secret, so it does not count).

Second, I'm helping my friend with home overhaul.

Third, these are alphas for 1.0 release. I want them to be as solid as possible. Each alpha is dedicated to fixing one specific big issue (big in terms of required code changes). First alpha was done as mark that OTR is ready for generic use. Second one fixed issues #2621 and #2646. Now I'm working on better plugins handling (#2706). It requires a lot of work: splitting classes, writing unit tests, implementing graph algorithms. Most of the work is already done, but there is still GUI to be worked on.

Last big issue (that will make alpha4) is duplicating messages in chat view. After that, just little bugs will remain and we will be happy to switch to beta cycle.

Sunday, 1 December 2013

Source code structure evolution


Kadu source code evolved over years. Directory structure evolved along with it. It all stared with single code directory (named kadu), single autotools one (named admin) and a few with libgadu library sources. Above chart shows this evolutions as number of directoriesd use for different categories during last 12000 commits.

Lets start with boring ones: varia line shows how many icon and sound themes we had. During development some were added (like modern Adium themes) and some removed (because of licence issues or pure ugliness).

Modules and plugins lines shows how many code was kept our of core source for modularity. First modules emerged just after a few years: autoresponse, voice, sms... They were responsible for most of new directories for a very long time. Big switch from modules to plugins shows that we didn't think that all of them were worth the transition (there is subtle technical difference between module and plugin in Kadu terminology).

Count of classes in each files and files in kadu (now kadu-core), where core source is kept, directory was growing very fast from the beginning to the point where code was almost unmanageable. So the Big Split era was started. Each "business" object family got it own directory (buddies, contacts, chats, accounts, avatars, status and so on...). GUI code was split between widgets and windows and separate directories for configuration were created. This is all represented by core line on above chart. Lately speed of expanding this structure increased - some widgets got whole directories instead of just files. Number of support classes for handling ChatWidget (12)ChatWindow (7) and GroupTabBar (4) increased so much that it stopped to make sense to keep them with other widgets code. It all happens for our believe in Single Responsibility Principle.

For me it is very important to keep everything as clean as possible. When your code grows in lines be sure it also grows in number of files and number of directories. Keeping too much code in one class, too much classes in one file or too much files in one directory will eventually lead to Big ball of mud architecture. It is very easy to smuggle 1000 lines of code to a place that already has 10000 than to add small method to small class. Keep good structure on every level - it will force everybody to think deep about new code placement.