Live data from Hacker News

You Should Write Ugly Code

redotheweb.com

51–56 of 56 posts

Re: You Should Write Ugly Code

#51
post #8

Earlier quoted context omitted.

Usually it's when they get their first non-seed round of investment and realise their product doesn't let them grow as fast as they'd like. Products growing through sales can go without proper cleanup for decades. Friends have told me stories of single SQL queries taking upwards of 15 minutes to run (and then being rewritten in SQL+PHP that does the same in 20 seconds)

I've seen my share of awful (but trivially optimizable) queries taking forever to run - but can you elaborate on what PHP has to do with it?

Just that PHP is considered slow compared to a RDBMS, but is much much quicker when used appropriately.

Re: You Should Write Ugly Code

#52
post #51

Earlier quoted context omitted.

I've seen my share of awful (but trivially optimizable) queries taking forever to run - but can you elaborate on what PHP has to do with it?

Just that PHP is considered slow compared to a RDBMS, but is much much quicker when used appropriately.

Ah, so you're talking about moving some of the logic from the SQL into code? Yes, that can certainly give a huge boost, no matter what the language.

Re: You Should Write Ugly Code

#53
Cannot possibly disagree more.

- Of course, ugly code is fine for experimening, short-lived code, or code that won't be touched again.

- But beautiful code makes me enjoy my work, which is really important.

- It makes lives of other devs better. Devs want more money for working with ugly code (ie. it costs the company money).

- Ugly code supports the culture that aesthetics is not important.

Re: You Should Write Ugly Code

#54
post #49

I had a really great post for this topic about the utility of ugliness in language design. Ocaml provides imperative features but makes them ugly, subtly encouraging a functional approach in most cases. Clojure quite brilliantly makes OOP and heavy Java interop possible but very ugly (because the language's ultimate goal is platform-agnosticism) while making idiomatic Clojure beautiful. Making something ugly is often…

I feel like functional and non-OOP languages are probably unpopular in the corporate world because when you're using one, there is not really any need to have a business analyst design the application in UML diagrams or Microsoft Visio. Java, on the other hand, is perfect for that, if that's what you're looking for. Java and enterprise software were made for each other.

There are two schools of programming that have diverged: low-productivity and high-productivity development. It's not always about language. I know people in the HP world that use traditionally LP languages like Java or C++ for performance reasons. But the horrid mess of a stereotypical JavaJob is the LP development world where, as you said, those horrible Big Designs are created without irony.

Re: You Should Write Ugly Code

#55

Earlier quoted context omitted.

Thanks, "Technical debt" is the word here. "Beautiful" might not come close to "valuable" in terms of importance, but "Clean" should come close, because accumulating too much crap makes maintenance & feature addition painful. Uncle Bob's "Clean Code" does a great job at detailing that.

How does one define the difference between "Beautiful" and "Clean"?

"Beautiful" -> Easy to read, succinct but not so succinct as to obfuscate

"Clean" -> Modular, separates concerns, loosely coupled, not in need of significant refactoring, easy to write unit tests for

Post reply on HN