3 ms·
Most amusing I've seen was Java code that was rather over zealous about DRY and no-string-literals in code (i.e. all strings had to be define as constants). Th
by arethuza 14y ago
Most amusing I've seen was Java code that was rather over zealous about DRY and no-string-literals in code (i.e. all strings had to be define as constants).
This resulted in code like:
url = HTTP + COLON + SLASH + SLASH + WWW + DOMAIN_NAME + DOT + COM;
based on lots of definitions like:
public final static String COLON = ":";
public final static String SLASH = "/";
public final static String DOT = ".";
public final static String COM = "com";
[Apologies if this contains any Java syntax errors, I pretty much stopped using Java soon after this experience]
Also I've just realised that I'm really glad Java doesn't have a standard pre-processor - truly evil things would then have been possible <shudder>
- minikomi 14y agoCOLON + OPEN_BRACKET
- helpermethod 14y agoAt University we were also forced to do this. This and other stupid rules (like declaring all variables at the beginning of a method) were considered 'good style'.
- InclinedPlane 14y agoHah. It's funny how nobody thought to create a simple static utility function which converted a domain-name to a fully-qualified .com URL.