This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-27
Channels
- # aleph (8)
- # announcements (14)
- # beginners (25)
- # cider (20)
- # cljdoc (5)
- # clojure (70)
- # clojure-europe (2)
- # clojure-germany (6)
- # clojure-italy (8)
- # clojure-nl (3)
- # clojure-russia (107)
- # clojure-spec (22)
- # clojure-uk (40)
- # clojurescript (18)
- # core-async (3)
- # cursive (8)
- # data-science (11)
- # datomic (20)
- # editors (1)
- # emacs (5)
- # figwheel-main (19)
- # fulcro (25)
- # graphql (1)
- # hoplon (2)
- # hyperfiddle (2)
- # jobs (1)
- # leiningen (3)
- # lumo (4)
- # off-topic (40)
- # pedestal (1)
- # quil (4)
- # re-frame (5)
- # shadow-cljs (105)
- # sql (4)
- # uncomplicate (1)
Do you think it should be acceptable to break the DRY Pattern in some cases? For example repeating db paths in events and subs is more readable but referencing a path variable located elsewhere is more DRY. Also some view code is easier to understand if it's just repeated but then it wouldn't follow dry. Another example is some forms. A login, signup, password-change-request and password-change page duplicate a lot of similar fields such as email & password. Its more readable to to just duplicate the events and subs and when you need to make small differences its easy to do. For example the password field in login may have different validation to signup. Keeping this DRY complicates the code but it's DRY. afaik the DRY pattern exists to prevent making changes in many places but it's a trade off with complexity. What are some peoples thoughts?
it absolutely is acceptable to break DRY >As Sandi Metz put it, “duplication is far cheaper than the wrong abstraction”. -- https://programmingisterrible.com/post/176657481103/repeat-yourself-do-more-than-one-thing-and
see also "Rule of three" which explicitly allows for duplication, at least at first: https://en.m.wikipedia.org/wiki/Rule_of_three_(computer_programming)
@U1GEY70F5 What a fantastic article. It covered some other things I was curious about too