- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
TDWTF: Where factory.getInstance().getInstance().getInstanceFactory().getInstance().getInstanceFactory().getOrderFactory().getInstance().getInstanceFactory() compiles.
Admin
Yo dawg, we heard you like factories so we built a factory to return a factory so you can instantiate while you instantiate
Admin
Oh, someone fristed me on the yo dawg.
captcha: ludus
Admin
It is valid JavaScript (and TypeScript, which compiles to JavaScript).
The fact that it most likely throws a TypeError is irrelevant. It still compiles.
Admin
Anyway, according to PEP 8, you should never inline code after the colon; put the rest of the block on a new line, with proper indentation. Also, docstrings should be in triple-quotes, and not rely on string concatenation. So:
Admin
"The Factory pattern is an excellent way to solve a variety of programming problems using an object-oriented language."
No. No, it is not.