Mistři v programování na #hovnokod

Miluji funkce s nazvem hack... A co tenhle pattern: a = b; if(x) -> a=b; else if(y) -> a=b; c = d;

    private void hackDataAutoExtraFup(Service service, Product product) {
        service.setServiceStatus(IntegrationUtils.operationMapClient.get(OrderItemOperationType.ADD));
        if (product.getOrderItemOperation() == OrderItemOperationType.UPDATE) {
            service.setServiceStatus(IntegrationUtils.operationMapClient.get(OrderItemOperationType.ADD));
        } else if (product.getOrderItemOperation() == OrderItemOperationType.SUSPEND ||
                product.getOrderItemOperation() == OrderItemOperationType.REMOVE ||
                product.getOrderItemOperation() == OrderItemOperationType.REMOVE_ON_END_OF_PERIOD) {
            service.setServiceStatus(IntegrationUtils.operationMapClient.get(OrderItemOperationType.ADD));
            setParameterValue(service, ProductIvmAutoExtraFup.MAX_RENEWAL_COUNT, "0");
        }
    }

Anonymous,

if (bla.equals("")) {
            try {
                throw new ToolConfigException("Please contact the developers.");
            } catch (ToolConfigException e) {
                e.printStackTrace();
            } finally {
                System.exit(1);
            }
        }

Anonymous,

Nepoužívaná konstanta. Ani nijak nezapadá do logiky aplikace.

public static final String DAY = "EEEE";

Anonymous,

Holy crap. Co takhle kolekce pouzit kdyz uz je pouzivas kamo?! Tohle je zahravani si s peklem...

		eb.setRecipients(StringUtils.join(recipients, "; "));
		eb.setRecipients2(StringUtils.join(recipients2, "; "));
		eb.setRecipients3(recipients3);
		eb.setSubject(subject);
		eb.setBody(body);
		eb.setType("Outage");
		eb.setSentBy(user.getUserName());
		eb.setSentDate(now);
		eb.setUpdatedBy(user.getUserName());
		eb.setUpdatedDate(now);

		emailsDao.save(eb);
		emailsCache.put(eb.getId(), eb);

		// send email(s)
		try {
			Email email = new Email(subject, body, "text/html");
			if (!recipients.isEmpty()) {
				for (String recipient : recipients) {
					email.addTo(recipient + "@ourdomain.com");
				}
			}
			if (!recipients2.isEmpty()) {
				for (String recipient : recipients2) {
					email.addTo(recipient + "@ourdomain.com");
				}
			}
			if (recipients3.length() != 0) {
				String[] recipients3AsArray = recipients3.split(";");
				for (String recipient : recipients3AsArray) {
					email.addTo(recipient.trim());
				}
			}
			email.send();
		}

Anonymous,

Bud alebo.

    enum Type {
        ITEM_IMAGE,
        ITEM_NO_IMAGE
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        if (viewType == Type.ITEM_IMAGE.ordinal() || viewType == Type.ITEM_NO_IMAGE.ordinal()) {
            return new ItemViewHolder();
        }
        return null;
    }

Anonymous,