Mailinglist Archive: yast-devel (144 mails)

< Previous Next >
Re: [yast-devel] Simple example of refactoring
On Tue, 20 Aug 2013 12:48:26 +0200
Lukas Ocilka <lukas.ocilka@xxxxxxxx> wrote:

On 08/19/2013 05:19 PM, Josef Reidinger wrote:
because we have now ruby I want to show really simple way how we can
refactor existing code. I choose just simple example to be easy to
understand and on other hand full working. [1]

There is two interesting points in it.
1) using minitest for testing, its structure ( so you can imagine
how it looks ) and how it can be easy integrated with automake
( nice part is that if you run `make check` then both testsuite is
run, old and new one
2) Using ruby builtin regex, so we no longer need our own.

Just to add some more info on this refactoring piece. Josef has used
a standard Ruby Resolv [1] class to replace our built-in
functionality. This will save our time in the future as we don't need
to care about our own implementation and saves some space as well as
our implementation was a duplicate to standard Ruby library which
will be installed anyway.

I like the idea and I expect that you will identify and replace
more ;) This is actually something that anyone with a basic Ruby
knowledge can do. It's could even be marked as, so called, junior job.

Well, it is questionable if it is junior job, as there can be small
differences between ruby and our implementation, so it needs a lot of
testing of corner cases and good knowledge both implementations if
there is differences.
And to be honest in this change I heavily believe in tests because
compare these two regexp is too much for my brain :) [1][2]

Also I need to consider what is better to use as there is also IPAddr
class in ruby, which for me is better to use, but it is different
concept then our, so it is not so elegant to refactoring of IP module
( but I strongly recommend to use it to replace IP module in ruby code
because you can use it as object )





To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: yast-devel+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups