Refactoring: create a wrapper Object or duplicate code?



  • Hi there,

    I'm new to pfSense progamming, and I'm about to tackle the load balancer status pages for use with aliases (host and port aliases), which are currently broken i.m.o.

    So my question is: would the team rather prefer a patch which
    a) refactors probably larger portions of the code by inventing a wrapper object for shared code, or
    b) fix the display by replicating portions of the code, but leaving the included functions alone.

    As a programmer I would certainly choose a), but for ease of evaluation I might choose b) for a pull request.

    Which route should I follow? Which has better chances of my pull request beeing accepted?

    Cheers,
    Tobias


  • Rebel Alliance Developer Netgate

    If you're talking about the Load Balancer status pages (As in status_lb_pool.php and status_lb_vs.php ) then neither since that is services is deprecated and has already been removed from 2.5.0.

    Generally speaking, however, we prefer to reduce or prevent code duplication so using functions and so on to prevent duplicating code is better.



  • Thanks for the heads-up, I found out the LB feature is gone when I cloned the github code instead of tinkering in the shell...

    Since it's deprecated I won't spend any effort on it, and take a look at haproxy instead.

    Is there any plans on easing the transition when upgrading?


  • Rebel Alliance Developer Netgate

    There aren't any plans to migrate from one to the other since they operate in much different ways.


Log in to reply