Mailinglist Archive: yast-devel (246 mails)

< Previous Next >
[yast-devel] Summary of code review
  • From: Josef Reidinger <jreidinger@xxxxxxx>
  • Date: Tue, 18 Aug 2009 15:48:50 +0200
  • Message-id: <4A8AB142.3000606@xxxxxxx>
during today meeting with Karel (external rails consultant) we do some
public code review of my code and we also find some general problems. I
try summarize it in this mail. Please ask if you don't understand something.
I start with rest-service:
We should have some general method in ancestor (e.g.
YastApplicationController) of all webyast plugins which do something (so
no permissions or resources) some general method permission checker with
same behavior (like response permission denied). We in general should
eliminate things which is repeating in each plugin.
Have one line view is useless and better is use respond_to.

My class LogException is useles if we disable backtrace silencing so e is enought (btw it looks like our webclient is not
generated by rails 2.3, as few files missing, it looks like we generated
it by 2.2)
load_proxy method is good idea how to reduce needed lines of code but
should not redirect or set any infos. Instead use throwing exceptions
and use rescue_from to display correct page. This also discover why
sometime our universal exception handler doesn't work, because some
exception is not child of Exception but Error.
This also discover how looks our Resource service and it is really
unreadable and unmaintainable code, as it is really big, should use e.g.
mixins or something else to reduce its size and complexity. Test for
this class looks good, so we should try refactor it to better result.
We should better structure whole architecture like some part of
controller do things in one area which is not close to controller
contract, so we should move it to mixin (especially use it in
application controller).
Karel doesn't like checking for gettext in application controller.

some positives from code review - time module is good documented and
testing looks good even if designer could recognize it is written after
code. Ideas to reduce code size and duplicated code is good, only
implementation is not always good.

some general knowledge:
- testing model is the easiest so move the most of functionality there
for easier testing
- over-mocking is not good, as it abstract from reality (it is useful
when you don't have implemented some functionality)
- .railsrc and .irbrc for some general routines available during
console session

I hope I don't forget much thinks, maybe someone add another knowledge.
Josef Reidinger
YaST team
maintainer of perl-Bootloader, YaST2-Repair, webyast modules language
and time
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups