[Kstars-devel] Astrocalc refactoring

Khudyakov Alexey alexey.skladnoy at gmail.com
Wed May 6 18:35:34 CEST 2009


Hello everyone,

I've played with astronomical calculator sources. Its refactoring was quite 
amusing. There are results. No regressions found.

01-modcalcdaylength_stack_refactor.patch

Objects in modCalcDayLength::updateAlmanac(...) are allocated on stack not on 
heap. Namely KSSun, KSMoon and KSNumbers. They are not very big so there is no 
point in heap allocation.

AstroCalc class refactoring

02-astrocalc_constrctor_refactor.patch

Widget in stack are allocated and put in stack by template function. This 
saves some copy-pasting. 

03-astrocalc_dispatch_refactor.patch

Items in navigation panel are allocated by two helper functions. They also 
fill two maps. First: item name -> widget in stack, second: name -> help text.

04-astrocalc_dispatch_map_refactor.patch

gen{Time,Coord,Solar}Text functions are removed. 

All dispatching in slotItemSelection is done via maps instead of long ladder 
of `ifs'. Item name appears in source code only once.  

05-astrocalc_clean_refactor.patch

Unneeded data fields are removed. 
--
  Khudyakov Alexey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 01-modcalcdaylength_stack_refactor.patch
Type: text/x-patch
Size: 3379 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kstars-devel/attachments/20090506/c028c30b/attachment-0005.patch 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 02-astrocalc_constrctor_refactor.patch
Type: text/x-patch
Size: 4019 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kstars-devel/attachments/20090506/c028c30b/attachment-0006.patch 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 03-astrocalc_dispatch_refactor.patch
Type: text/x-patch
Size: 5555 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kstars-devel/attachments/20090506/c028c30b/attachment-0007.patch 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 04-astrocacl_dispatch_map_refactor.patch
Type: text/x-patch
Size: 13818 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kstars-devel/attachments/20090506/c028c30b/attachment-0008.patch 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 05-astrocalc_clean_refactor.patch
Type: text/x-patch
Size: 7084 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kstars-devel/attachments/20090506/c028c30b/attachment-0009.patch 


More information about the Kstars-devel mailing list