Mistři v programování na #hovnokod

Narazili jste na zprasený kód? Nahrajte ho sem.


Software: the final frontier. These are the voyages of the application Enterprise. Its neverending mission: to explore strange new technologies, to seek out new patterns and new algorithms, to boldly go where no developer has gone before.
public class FinancialConstants {

	/**
	 * Get value "0" with scale 0
	 * 
	 * @return
	 */
	public static final BigDecimal getZeroValue() {
		// BigDecimal result = new BigDecimal(0);
		//
		// result = result.setScale(0);

		return BigDecimal.ZERO;
	}

	/**
	 * Get value "1" with scale 0
	 * 
	 * @return
	 */
	public static final BigDecimal getValueOne() {
		// BigDecimal result = new BigDecimal(1);
		//
		// result = result.setScale(0);

		return BigDecimal.ONE;
	}

	/**
	 * Get value "10" with scale 0
	 * 
	 * @return
	 */
	public static final BigDecimal getValue10() {
		// BigDecimal result = new BigDecimal(0);
		//
		// result = result.setScale(0);

		return BigDecimal.TEN;
	}

	/**
	 * Get value "100" with scale 0
	 * 
	 * @return
	 */
	public static final BigDecimal getValue100() {
		BigDecimal result = new BigDecimal(100);

		result = result.setScale(0);

		return result;
	}

	/**
	 * Rounding of result amount is mathematical
	 * 
	 * @return
	 */
	public static final int getRoundingStyle() {
		return BigDecimal.ROUND_HALF_UP;
	}

	/**
	 * Get vat rate 19%
	 * 
	 * @return
	 */
	public static final BigDecimal getVatRate19() {
		BigDecimal result = new BigDecimal(19);

		result = result.setScale(0);

		return result;
	}

}

Anonymous,


Kód generovaný automaticky do GooglePlayGames pluginu
public static bool RequireGooglePlus()
{
       return "false" == "true";
}

Anonymous,


kolega miluje cislo 2
//    String fqn = signalDefinition.getFqn();
//    FQN fqn2 = new FQN( fqn );

Anonymous,


efektivne nacteme obsah souboru...
$fileContent = implode("", file($filePath));

Anonymous,


Při spuštění testů chodí uživatelům maily? Nevadí!
/**
 * Sets all personal contact addresses to one which should be used in unit tests - prevents sending of email's to
 * someone who's not interested in them.
 * 
 * @throws Exception
 */
protected void setUnitTestMailAddressesToMine() {
	if (personDetailsDao == null) {
		throw new PreconditionViolationExcpetion(
				"To use this unit test feature please set following in it: personDetailsDao = getSpringBean(DAOSpringNamesEnum.PERSON_DETAILS);");
	}
	try {
		for (PersonDetails details : personDetailsDao.findAll()) {
			details.setEmail(getPropertyHolder().getMailUnitTestsReceivee());
			personDetailsDao.persist(details);
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}

Anonymous,