Skip to content

Comment on What was the strangest coding standard rule that you were forced to follow?parent

Comments

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>

COLON + OPEN_BRACKET

Hah. It's funny how nobody thought to create a simple static utility function which converted a domain-name to a fully-qualified .com URL.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.