Hacker News new | ask | show | jobs
by hobbs 6601 days ago
Indeed, I found that this statement sounded alarms in my critical thinking cortex:

"the Singleton "pattern" encourages you to forget everything you know about OO design, since OO is hard, and procedural is easy."

Why, oh why, are we encouraging people to use OO 100% of the time, when it's admittedly harder than the alternatives? (I'm looking at you, Java.) Methinks the bandwagon continues to play on, even after two decades...

1 comments

Something that Alex Martelli said in one of his talks when I was starting off with Python was something along the lines of: "Ignore OOP!"

I had never heard anyone suggest anything like that before, I think some developers think OOP is "the way forward." I spent many months trying to force my mind to think in an OOP manner, now I don't even bother. Occasionally I find a place where it does work, but it's definitely not a magical bullet.

I've just noticed that there are two "impedance mismatches" in a lot of applications.

UI -> Domain Model -> Persistence

Most people know of the 2nd one. The 1st one is just as big an impedance mismatch!

Most of the ways of doing UIs are not OO. If UIs were OO in a given environment, then naive developers following the path of least resistance starting from the GUI "hello world" would naturally build an OO application.

Are there any environments like that? Is Rails one such environment?

Most UI code is intrinsically event-based. e.g., "on click, do this", "on resize, do that"

Erlang comes to mind as a good event-based language. Strangely, it is rarely (if ever) used for UI.

I guess this is why Rob Pike can spend 6 months writing a concurrency-friendly language like Newsqueak, then use it to write a GUI windowing system in a coupe of hours.

http://video.google.com/videoplay?docid=810232012617965344