tag:blogger.com,1999:blog-1799433464682869513.post4691702366902123869..comments2020-01-31T17:29:27.966-08:00Comments on Logan Barnett: ReuseLogustushttp://www.blogger.com/profile/14062670963429924460noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-1799433464682869513.post-60909410335423120612016-04-14T20:17:54.184-07:002016-04-14T20:17:54.184-07:00(@Unknown?)
Dave Koontz is a dear friend of mine a...(@Unknown?)<br />Dave Koontz is a dear friend of mine and we have worked on some big projects together. Dave is largely responsible for my transition into functional programming. A lot of our discussions revolve around how things play out in Robot Arms. Small world!<br /><br />The scare method is an example to me of OO thinking in my mind, and this makes it hard to take on a functional programming mindset. When you're talking about scaring mice, dog, cats, and elephants, what are you _really_ doing? OO says you change the dog to be a scared dog and that might mean something different than a scared cat.<br /><br />In FP you don't _change_ anything. You produce new things that look different or have alterations of the prior data. There aren't objects but data and ways to transform data. The animal kingdom OO metaphor breaks down because mutating things in place is just strange. You don't overwrite the same line over and over again in your logs, and your version control software never actually deletes your files forever. Less philosophically, scaring something might mean you create a new cat state and part of that cat state means it has a scared state of mind rather than a hungry state of mind, or whatever. Things are indicated by data and not by their methods.<br /><br />Explaining FP concepts is still difficult to elaborate on because it's such an inverted approach from what I'm used to. Couple that with me just getting into it and articulation feels very clumsy. Either way I hope that helps a bit.<br /><br />Logustushttps://www.blogger.com/profile/14062670963429924460noreply@blogger.comtag:blogger.com,1999:blog-1799433464682869513.post-34173678550866085862016-04-14T11:22:06.324-07:002016-04-14T11:22:06.324-07:00I don't have a full understanding of the conce...I don't have a full understanding of the concepts of functional programming - but I've dipped my toe in it and found it useful. <br /><br />What helped me get started was just discussion of the concepts / ideas of functional programming and how it might work. All of my work has been using a custom library for Unity that encourages but does not require functional concepts in an imperative environment (<a href="https://bitbucket.org/dkoontz/robotarms" rel="nofollow">Robot Arms by David Koontz</a>).<br /><br />As a beginner, my issues have been with organization. When your code is extremely flexible, it can be hard to know where best to place things - and also difficult to remember what you've already done that could potentially be re-used. For me, with the flexibility of FP came the difficulty of organization - where do I put my scare method where cats can scare dogs, mice can scare elephants and so on? This may seem trivial, but it can be a bit overwhelming. <br /><br />On top of that, there is often a line between flexibility and convenience. Take, for example, our scare method. In cats, when they are scared, their tails raise and their hair raises. When dogs are scared, the exact same things happens! So maybe my scare method takes care of flipping a few flags. <br /><br />Then I want to scare an elephant, and some of those flags no longer apply. This came up surprisingly often for me. As you try to use your code in new ways, you might have to refactor, and deciding on how best to refactor can be challenging. I will say it is refreshing to actually have to think while coding though, as unusual as that might sound.Aaron Jhttps://www.blogger.com/profile/04487610421612680804noreply@blogger.com