DRY is an over-rated programming principle?
Pizza Cost Optimization Dark Pattern Programming Example:<p>Here is the pizza cost optimizer from Pizzatool, written in object oriented NeWS PostScript, which checks all of the pre-defined base pizza styles and selects the &quot;best&quot; combination of style + extra toppings, ostensibly to save the user some money.<p>It&#x27;s actually a dark pattern, because it&#x27;s biased towards selecting higher level pizzas instead of the least expensive pizza. But at least the dark pattern is documented:<p>&quot;Figure out the cost of the pizza, were we to order it as this style, and remember the style as the best match if it pleases us. The definition of pleasing us is biased towards matching higher level complex pizza styles, rather than economical lower level pizzas with extra toppings. This is the kick-back to Tony&amp;Alba&#x27;s for all that free beer.&quot;<p>The Story of Sun Microsystems PizzaTool
How I accidentally ordered my first pizza over the internet:<p><a href="https:&#x2F;&#x2F;medium.com&#x2F;@donhopkins&#x2F;the-story-of-sun-microsystems-pizzatool-2a7992b4c797" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;@donhopkins&#x2F;the-story-of-sun-microsystems...</a><p>Tony and Alba&#x27;s Pizza and Pasta, Mountain View:<p><a href="https:&#x2F;&#x2F;www.yelp.com&#x2F;biz&#x2F;tony-and-albas-pizza-and-pasta-mountain-view" rel="nofollow">https:&#x2F;&#x2F;www.yelp.com&#x2F;biz&#x2F;tony-and-albas-pizza-and-pasta-moun...</a><p>PizzaTool Source Code:<p><a href="https:&#x2F;&#x2F;www.donhopkins.com&#x2F;home&#x2F;archive&#x2F;NeWS&#x2F;pizzatool.txt" rel="nofollow">https:&#x2F;&#x2F;www.donhopkins.com&#x2F;home&#x2F;archive&#x2F;NeWS&#x2F;pizzatool.txt</a><p><pre><code>    % Calculate the cost of this pizza.
    %
    &#x2F;updatecost { % - =&gt; -
      10 dict begin % localdict
        &#x2F;TheBest &#x2F;defaultstyle ClassStyle send def
        &#x2F;TheStyle null def
        &#x2F;TheTopping null def
        &#x2F;TheBestCost 99 def
        &#x2F;TheBestExtras 0 def

        % For each and every pizza style in the universe:
        &#x2F;styles ClassStyle send { % forall:               % style
          &#x2F;TheStyle exch def                              %

          % Ask this style for its list of standard toppings.
          &#x2F;TheToppings &#x2F;toppings TheStyle send def

          % Is every topping from this style on our pizza?
          true                                            % true
          TheToppings { % forall:                         % true topping
            Toppings exch arraycontains? not { % if:      % true
              % Oops, this topping&#x27;s not on the pizza. No dice.
              pop false exit                              % false
            } if                                          % true
          } forall                                        % true|false

          { % if: all the toppings of the style were on our pizza:
                                                          %
            % Make an array of our pizza toppings that aren&#x27;t in the style.
            &#x2F;ExtraToppings [
              Toppings {                                  % ... topping
                % Is this topping included in the style? Then toss it.
                TheToppings 1 index arraycontains? {      % ... topping
                  pop                                     % ...
                } if
              } forall
            ] store                                       %

            % Figure out the cost of the pizza,
            % were we to order it as this style,
            % and remember the style as the best match if it pleases us.
            % The definition of pleasing us is biased towards matching
            % higher level complex pizza styles, rather than economical
            % lower level pizzas with extra toppings.
            % This is the kick-back to Tony&amp;Alba&#x27;s for all that free beer. 
            PizzaSize &#x2F;pizzasizeindex self send           % sizeindex
            ExtraToppings length                          % sizeindex extras
            &#x2F;extraprice TheStyle send                     % $
            dup                                           % $ $
            ExtraToppings length                          % $ extras
            &#x2F;extras TheStyle send sub                     % $ $ extras&#x27;
            1 le { .9 mul } if                            % $ biased$
            TheBestCost le { % ifelse:                    % $
              % Hey this is the best match so far, let&#x27;s not forget it!
              &#x2F;TheBestCost exch store                     %
              &#x2F;TheBest TheStyle store
              &#x2F;TheBestExtras
                ExtraToppings length &#x2F;extras TheBest send sub
              store
            } { pop } ifelse                              %
          } if                                            %
        } forall                                          %

        % Set the window footers of the pizza topping panel.
        % The left footer displays the name of the pizza style,
        % and the right footer displays a message
        % telling the user to choose more toppings,
        % or the number of extra toppings,
        % or nothing at all.
        TheBestExtras dup 0 lt { % ifelse:                % extras
          neg dup 1 eq { () } { (s) } ifelse              % extras (plural?)
          exch (Choose % more topping%!) sprintf          % (message)
        } { % else:                                       % extras
          dup 0 ne { % ifelse:
            dup 1 eq { () } { (s) } ifelse                % extras (plural?)
            exch (With % extra topping%.) sprintf         % (message)
          } { % else:                                     % extras
            pop nullstring                                % ()
          } ifelse
        } ifelse                                          % (left footer)
        &#x2F;name TheBest send exch                           % (left) (right)
        &#x2F;setfooter ToppingWindow send                     %

        % Remember the price of this pizza in dollars rounded to cents,
        % and calculate its string value. 
        TheBestCost                                       % $
        Fraction mul
        100 mul round 100 div
        &#x2F;Price 1 index store
        dup 100 mul round cvi 100 mod                     % $ cents
        exch floor cvi                                    % cents dollars
        1 index 10 lt { (%.0%) } { (%.%) } ifelse         % cents dollars fmt
        sprintf                                           % (price)

        % Set the value of the costfield and totalfield labels to
        % the price string.
        dup &#x2F;setvalue costfield send
        &#x2F;setvalue totalfield send                         %

        % Set the value of the stylevalue label to the name of the best style,
        % and set the stylemenu value to the index of that name in the list of
        % pizza styles. (The stylemenu is an exclusive settings menu.)
        &#x2F;name TheBest send                                % name
        dup &#x2F;setvalue stylevalue send
        PizzaStyleNames exch arrayindex {                 % index
            [exch] &#x2F;setvalue stylemenu send               %
        } if                                              %

        % Remember the best match pizza style.
        &#x2F;Style TheBest store

      end % localdict
    } def</code></pre>