5 ms·
I was confronted with a problem, so I thought I would use Java. Now I have a problem factory.
by paulsutter 11y ago
I was confronted with a problem, so I thought I would use Java. Now I have a problem factory.
- icelancer 11y agojava.classes.factories.problem.module
- evilotto 11y agoWhen all you have is a HammerFactoryImpl, every problem looks like an INailIter
- arethuza 11y agoWhy restrict things to Hammer and Nails - you need to abstract that a bit further. Why not IDirectedForceApplier and IDirectedForceRecipientIter :-) Maybe they should introduce a "Name not sufficently abstract" syntax error into the Java compiler! :-)
- deleted 11y ago[deleted]
- yoz-y 11y agoOf course the currently trending answer would be to use monads. Preferably implemented in Go.
- arethuza 11y agoI remember a colleague who wrote Common Lisp in the style of Occam - with concurrent process and communication channels. His code actually looked a lot like some Go code I've seen - hardly surprising I guess given the common ancestry to CSP.
- lispm 11y agoBtw., CSP in Hoare's Book is a Lisp... http://www.usingcsp.com/cspbook.pdf http://www.usingcsp.com/cspbook.pdf Page vi: > The proposed implementations are unusual in that they use a very simple purely functional subset of the well-known programming language LISP. This will afford additional excitement to those who have access to a LISP implementation on which to exercise and demonstrate their designs.
- marcosdumay 11y agoHum... Haskell monads are very concrete when compared to the Java factories. They represent abstract stuff, but always a single well defined abstract concept. They do not make the code more generic. Maybe you can replace those with lenses, or applicatives in general. People do overuse those.
- Kenji 11y agoYou made me laugh out loud. Hahaha. Genius. Don't get me wrong, I love Java, but some of its patterns make me wish I was programming C++.