if i didn't mention that before, i should tell it now, here at somewhere
in... <http://www.somewherein.net/> rnd team we are playing a lot with ruby
on rails. these days our rails team is completely focusing on a
product(which is secret for the time being :) ) where we
found a lot of interesting stuffs, for instance.
few days back, we found our application_helper and few controllers are
growing too fast and getting extra fat (lines of code). so we had few
refactoring to reduce the extra fat.
now have a look on the code we had with in application_helper.rb taken from
tag/v-0.3
[image:
fat_refactoring_before.gif]<http://hasan.we4tech.com/wp-content/uploads/2007/11/\
fat_refactoring_before.gif>
this code is not completely visible over the screen snap, this is 340
number of lines. which was the output of our 3 iteration.
though these number of lines are not that much problematic, but we had a
scenario which was difficult to make it more concern aware and single
concerned.
now have a look on our code which is taken from the current trunk,
[image:
fat_reforing_after.gif]<http://hasan.we4tech.com/wp-content/uploads/2007/11/fat_\
reforing_after.gif>
Wow, now it is 50 lines only including the header copyright information.
the trick was very simple, we followed the following conventions -
1. find out all related and same concerned functions
2. stick team together in a module
3. include the module to statically available all functions
no integration problem, nothing has occurred.
we are happy with this :)
i think our ruby learning process is going smoothly :)
--
----------------------------------------------------
nhm tanveer hossain khan (hasan)
http://hasan.we4tech.com
----------------------------------------------------
mobile: +880 1713 090 511
----------------------------------------------------
"work for fun"
[Non-text portions of this message have been removed]