1. Java / Говнокод #18941

    −41

    1. 1
    2. 2
    3. 3
    public Entry(int id, double nearBid, double nearAsk, double traderNearBid, double traderNearAsk, double farBid, double farAsk, double traderFarBid, double traderFarAsk, double spotBid, double spotAsk, double traderSpotBid, double traderSpotAsk, double nearPointsBid, double nearPointsAsk, double traderNearPointsBid, double traderNearPointsAsk, double farPointsBid, double farPointsAsk, double traderFarPointsBid, double traderFarPointsAsk, double swapPointsBid, double swapPointsAsk, double traderSwapPointsBid, double traderSwapPointsAsk, Set<Status> statusesBid, Set<Status> statusesAsk, double amount, double farAmount, double spotAmount, double availableSpotAmountBid, double availableSpotAmountAsk, double maxSpotAmountBid, double maxSpotAmountAsk, double availableFwdAmountBid, double availableFwdAmountAsk, double maxFwdAmountBid, double maxFwdAmountAsk, double availableFarAmountBid, double availableFarAmountAsk, double maxFarAmountBid, double maxFarAmountAsk, double availableAmountBid, double availableAmountAsk, double nearBasisPointSpread, double farBasisPointSpread, String tenor, LocalDate valueDate, String farTenor, LocalDate farValueDate, String fwdRiskBook, long fwdAlerts, int fwdDecimals, double fwdPrecision, double fwdTolerance, boolean spotSideInverted, boolean roundSwap, boolean zeroNpvSwap, boolean farAmountZeroNpvCalculated, double leftCcyNearDiscountFactor, double leftCcyFarDiscountFactor, double rightCcyNearDiscountFactor, double rightCcyFarDiscountFactor, double nearFarmResidualAmountBid, double nearFarmResidualAmountAsk, double nearFarmPointsBid, double nearFarmPointsAsk, double farFarmResidualAmountBid, double farFarmResidualAmountAsk, double farFarmPointsBid, double farFarmPointsAsk, String farmBook, OnshoreCrossRiskDetailsEntry onshoreCrossRiskDetails, double adjustedSwapPoints) {
            this(id, nearBid, nearAsk, traderNearBid, traderNearAsk, farBid, farAsk, traderFarBid, traderFarAsk, spotBid, spotAsk, traderSpotBid, traderSpotAsk, nearPointsBid, nearPointsAsk, traderNearPointsBid, traderNearPointsAsk, farPointsBid, farPointsAsk, traderFarPointsBid, traderFarPointsAsk, swapPointsBid, swapPointsAsk, traderSwapPointsBid, traderSwapPointsAsk, statusesBid, statusesAsk, amount, farAmount, spotAmount, availableSpotAmountBid, availableSpotAmountAsk, maxSpotAmountBid, maxSpotAmountAsk, availableFwdAmountBid, availableFwdAmountAsk, maxFwdAmountBid, maxFwdAmountAsk, availableFarAmountBid, availableFarAmountAsk, maxFarAmountBid, maxFarAmountAsk, availableAmountBid, availableAmountAsk, nearBasisPointSpread, farBasisPointSpread, tenor, valueDate, farTenor, farValueDate, fwdRiskBook, fwdAlerts, fwdDecimals, fwdPrecision, fwdTolerance, spotSideInverted, false, roundSwap, zeroNpvSwap, farAmountZeroNpvCalculated, leftCcyNearDiscountFactor, leftCcyFarDiscountFactor, rightCcyNearDiscountFactor, rightCcyFarDiscountFactor, nearFarmResidualAmountBid, nearFarmResidualAmountAsk, nearFarmPointsBid, nearFarmPointsAsk, farFarmResidualAmountBid, farFarmResidualAmountAsk, farFarmPointsBid, farFarmPointsAsk, farmBook, onshoreCrossRiskDetails, adjustedSwapPoints, -1, -1, null);
        }

    И тут я подумал, а не многовато ли аргументов...

    Запостил: zazazazazaza, 30 Октября 2015

    Комментарии (15) RSS

    • Это конструктор Вселенной?
      Ответить
    • На автомате прочитал nearBird вместо nearBid.
      Ответить
    • ну пара еще точно влезет
      Ответить
    • В таких случаях более читаемо каждый аргумент с новой строки писать.
      Ответить
      • Хз...

        public Entry(int id,
            double nearBid,
            double nearAsk,
            double traderNearBid,
            double traderNearAsk,
            double farBid,
            double farAsk,
            double traderFarBid,
            double traderFarAsk,
            double spotBid,
            double spotAsk,
            double traderSpotBid,
            double traderSpotAsk,
            double nearPointsBid,
            double nearPointsAsk,
            double traderNearPointsBid,
            double traderNearPointsAsk,
            double farPointsBid,
            double farPointsAsk,
            double traderFarPointsBid,
            double traderFarPointsAsk,
            double swapPointsBid,
            double swapPointsAsk,
            double traderSwapPointsBid,
            double traderSwapPointsAsk,
            Set<Status> statusesBid,
            Set<Status> statusesAsk,
            double amount,
            double farAmount,
            double spotAmount,
            double availableSpotAmountBid,
            double availableSpotAmountAsk,
            double maxSpotAmountBid,
            double maxSpotAmountAsk,
            double availableFwdAmountBid,
            double availableFwdAmountAsk,
            double maxFwdAmountBid,
            double maxFwdAmountAsk,
            double availableFarAmountBid,
            double availableFarAmountAsk,
            double maxFarAmountBid,
            double maxFarAmountAsk,
            double availableAmountBid,
            double availableAmountAsk,
            double nearBasisPointSpread,
            double farBasisPointSpread,
            String tenor,
            LocalDate valueDate,
            String farTenor,
            LocalDate farValueDate,
            String fwdRiskBook,
            long fwdAlerts,
            int fwdDecimals,
            double fwdPrecision,
            double fwdTolerance,
            boolean spotSideInverted,
            boolean roundSwap,
            boolean zeroNpvSwap,
            boolean farAmountZeroNpvCalculated,
            double leftCcyNearDiscountFactor,
            double leftCcyFarDiscountFactor,
            double rightCcyNearDiscountFactor,
            double rightCcyFarDiscountFactor,
            double nearFarmResidualAmountBid,
            double nearFarmResidualAmountAsk,
            double nearFarmPointsBid,
            double nearFarmPointsAsk,...
            double adjustedSwapPoints)
        Ответить
        • class Entry {
              public int id;
              public double nearBird;
              public double farBird;
              // ...
          }
          Ответить
          • Bird-in-the-middle attack.
            Ответить
            • Почитывая сток я подумал, что это комментарий к треду о самолётах.
              Ответить
            • Кто-то защищается от bird-in-the-middle с помощью акустических пушек, кто-то с помощью специально обученных соколов, а кто-то — международный аэропорт Большое Савино в Перми:
              http://iconosquare.com/p/1034453548706421452_36199725
              Ответить
          • NEAR! FAR! WHEREVER YOU ARE!
            I believe that the heart does go on...

            простите за некрофилию, не смог удержаться
            Ответить
        • Оперативы то хватит такой метод вызвать? xD
          Ответить
    • Ничего, до лимита JVM ещё далеко... Верным путём идёте, товарищи!
      Ответить
      • А на сколько параметров там лимит?
        Ответить
        • 4.11. Limitations of the Java Virtual Machine
          ...
          The number of method parameters is limited to 255 by the definition of a method descriptor (§4.3.3), where the limit includes one unit for this in the case of instance or interface method invocations.

          https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.11
          Ответить
          • + 4.3.3


            A method descriptor is valid only if it represents method parameters with a total length of 255 or less, where that length includes the contribution for this in the case of instance or interface method invocations.

            The total length is calculated by summing the contributions of the individual parameters, where a parameter of type long or double contributes two units to the length and a parameter of any other type contributes one unit.
            Ответить

    Добавить комментарий