Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Refactoring: create a wrapper Object or duplicate code?

    Scheduled Pinned Locked Moved Development
    4 Posts 2 Posters 299 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      tm_an
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • jimpJ
        jimp Rebel Alliance Developer Netgate
        last edited by

        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.

        Remember: Upvote with the ๐Ÿ‘ button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        1 Reply Last reply Reply Quote 1
        • T
          tm_an
          last edited by

          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?

          1 Reply Last reply Reply Quote 0
          • jimpJ
            jimp Rebel Alliance Developer Netgate
            last edited by

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

            Remember: Upvote with the ๐Ÿ‘ button for any user/post you find to be helpful, informative, or deserving of recognition!

            Need help fast? Netgate Global Support!

            Do not Chat/PM for help!

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.