i quite like MVC for web apps.
but otherwise i find it horrible; especially when there's a GUI involved.
Name:
Anonymous2009-12-28 3:07
RAII is the heartiest, chunkiest, and most delicious of programming metaphorsdesign patterns. Every day I write two bowls full of RAII. Broccoli and cheese is my favorite kind but usually I get tomato, because if I eat too much broccoli, I hax myself. The tomato is very good as well, though. It has actual chunks of tomato, which is not something you'll find in a typical programming metaphor. The thought of those tomato chunks on my keyboard is enough to make my mouth water. Another good kind that I like is beef and barley. The beef has to be manually managed but the broth and the barley make up for it. Basically RAII is something everyone should try once, even if it kills them. My brother worked on a prototype of the THERAC-25 and he died of RAII, but his last words were "It was delicious."
Name:
Anonymous2009-12-28 4:28
>>1
I like the if...then...else design pattern. It's much cleaner than the gotos I was using previously
Name:
Anonymous2009-12-28 4:32
my favorite and only pattern is defmacro
Name:
Anonymous2009-12-28 4:47
I rather enjoy the push rax/pop rax design pattern. Sure, when I really need performance I lay out the map of register usage in advance and I don't need that pattern, but when I code something that is not performance critical, some scripting code basically, and I just need to use rax for something, then i just store/restore it on the stack and that is all. I find this pattern to be a real productivity booster!
I hate the singleton pattern. It's a kludge to write procedural code in languages that force you to use OO, and so you get a lovely getInstance() peppered everywhere in your code.
Name:
Anonymous2009-12-29 14:15
I like the Adapter pattern because it lets me pretend that I am able to use function pointers.
Name:
Anonymous2009-12-29 14:25
>>12
No, static methods are a kludge to write procedural code in forced-OO languages. Singletons are a way to share global state among a family of functions when initializing that state may be costly or impractical to do at load time, or may not be needed in every execution. A non-OO language would solve this by requiring an init() call before the first use (which is prone to programmer error) or checking for a valid instance every time a related function is called (which is wasteful). +sharedInstance exploits the type system to force an initialization check only when necessary.
>>14 Singletons are a way to share global state among a family of functions Global variables are the way to share state between a family of functions. You're still thinking in OOP for a set of functions that clearly do not behave this way.
You think global variables are a worse solution? I've got news for you: your singleton IS a global variable. Shocking! I also find it hilarious that you think halting all threads and invoking the class loader is less wasteful than just checking for a damn instance. Besides, the best solution, that is forcing the user to call init(), is not a big deal; you can make it fail very loudly when the user forgets to do so, and you can anticipate exactly when your bulky initialization happens. Do you care about performance or don't you? Don't give me this half-way hack bullshit.
But all of these are really a violation of encapsulation, having you deal with an 'instance' you should know nothing about. Static methods (or plain old functions in non-shitty languages) is the real solution here. Do your class loader hack if you want; just hide it from the users of your module.