4 ms·
Yes, that's exactly what it did. I started my programming career in FORTRAN and BASIC, and really appreciated the advances of structured programming and the con
by geophile 12y ago
Yes, that's exactly what it did. I started my programming career in FORTRAN and BASIC, and really appreciated the advances of structured programming and the control structures in the languages that supported it -- the Algol family, Pascal, C. I see OO as doing more of the same, providing language constructs for commonly used patterns, and I think it is very successful at doing that. I think that a lot of the OO hatred comes from OOs failure at meeting goals that were claimed during the peak of the OO hype cycle. I think that another, well-justified source of hatred is the architecture astronaut stuff -- AbstractFactoryProxyFactory and the like.
Personally, I like Clojure (which I am just learning now) in spite of the lack of objects. I think that the ability to write a Point class, encapsulate the coordinates, and expose an API is great. In my opinion, representing a Point as a vector or map, and then having a set of unassociated functions operating on these point-like collections sacrifices some good ideas that came from object-orientation.
- adambard 12y ago> Personally, I like Clojure (which I am just learning now) in spite of the lack of objects. I think that the ability to write a Point class, encapsulate the coordinates, and expose an API is great. In my opinion, representing a Point as a vector or map, and then having a set of unassociated functions operating on these point-like collections sacrifices some good ideas that came from object-orientation. Since you mentioned you were learning, I thought I'd share that, although I like functions-on-data as much as the next guy, I often use protocols and records for tasks like this, generally for no reason other than organization and self-documentation: (defprotocol Pointy (add-vectors [this other]) ; ... ) (defrecord Point Pointy (add-vectors [{this-x :x this-y :y} {other-x :x other-y :y}] (->Point (+ this-x other-x) (+ this-y other-y))) ;... ) I think this has more to do with type-safety than object-orientation though.
- weavejester 12y agoProtocols and records exist purely for polymorphism. If you want type safety, then perhaps try core.typed: (defalias Point (HMap :mandatory {:x Num, :y Num} :complete? true)) (ann add-vectors [Point Point -> Point]) (defn add-vectors [a b] {:x (+ (:x a) (:x b)) :y (+ (:y a) (:y b))})