Re:Design Patterns – A comprehensible guide
by kdevrou on Friday February 17, 2017 @01:34PM
(#13670526)
Just one of many reasons that Scala is such an attractive option for Java developers:
// There is only one object DatabaseConnectionConnor {}
Re:Design Patterns – A comprehensible guide
by cessor on Sunday February 19, 2017 @10:35AM
(#13680159)
It's true that other languages often don't require certain patterns. Strategy and Visitor are often unnecessary when a programming language has functions as first class citizens.
I found that it often helps to remember that the GoF book was written about object oriented patterns with C++.
I often asked myself this question! Why do I have to say
and then get an object using: Why can't I say and just go and let my runtime make sure that I get the appropriate instance? Left aside the discussion of how useful that pattern is, I would like my language to be more powerful. I am aware of alternatives (Borgs in Python) and that many people consider Singletons an antipattern, as it helps introduce globally shared state, etc. but then, why do I have to care about how instances are implemented?After all, in C#, foreach interacts with iterators, why not push other mechanisms down into the language in the same way?
Ideas: