Thank you everyone for all of the helpful ideas. I def like the Component library and I will have to sit down and figure out how to best work that into my application while it is still young. All of the links have been consumed and I am starting to absorb more and more. Thank you for taking the time to share your thoughts and ideas with me.
-d On Saturday, February 7, 2015 at 10:07:45 AM UTC-6, Dru Sellers wrote: > > Greetings, > > I am trying to convert my mind from OO (C#) to one more functionally > friendly. I am increasingly comfortable with simple applications in > clojure, but as I start to build more complex applications, I start to fall > down about how to structure my application. I don't want to just shove OO > ideas into the functional nature of Clojure. I'm looking for any help > someone can provide to help shimmy my brain into the right mental patterns. > > Background: Long time C# developer who leans heavily on IoC / DI / > Interfaces / Testing / Object Encapsulation. > > > *Specific Question: Object Encapsulation* > I feel like my function parameter lists are much "wider" than they would > be in C#. This is due to the "lack" of a constructor. So if I previously > had a C# class that looked like: > > > public class AccountRepository : IAccountRepository > { > IDatabaseConnection _connection; > > public AccountRepository(IDatabaseConnection connection) > { > _connection = connection; > } > > public void Save(Account account) > { > _connection.Execute("UPDATE accounts SET coupon=@coupon WHERE id=@id", > { coupon = account.Coupon, id=account.Id}); > } > } > > In the above I have encapsulated the "_connection", the other methods > don't have to deal with it. In Clojure (especially if you are following > Sierra's Component pattern) you end up with > > (defn save [db account] > (update db (:coupon account) (:id account)) > ) > > I end up having to pass this 'db' around all over the place. I think that > this is just something I'll have to get used to more than anything. Am I > missing anything? > > Thank you for your time. > > -d > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.