On Tuesday, November 1, 2016 at 9:36:36 AM UTC-5, Rupert Smith wrote: > On Tuesday, November 1, 2016 at 1:16:40 PM UTC, Kasey Speakman wrote: >> >> It is silly, and I don't know why it was done this way. But that's the >> world I live in now. It's easy to justify one case at a time, but all >> tolled it adds up. >> >> As far as "layers", you should check out these two posts in order. >> >> >> http://blog.ploeh.dk/2013/12/03/layers-onions-ports-adapters-its-all-the-same/ >> >> http://blog.ploeh.dk/2016/03/18/functional-architecture-is-ports-and-adapters/ >> > > I think people who write code like this must get paid by the line. A > couple of years ago I worked some overtime over Christmass/New Year to > refactor a system like this that was getting out of control. In 5 days I > turned 10,000 lines of code with layers into 1,000 lines of code with just > 1 layer that did exactly the same thing - then booked myself a cheap > holiday in early January to enjoy my TOIL. > > I'm not saying its always the right answer, but when someone tells you > that you must have lots of layers, I would always question them and their > motives. >
I used to think that too. But then I fell into all the traps doing things naively and over time found myself moving towards similar things to the blog. Of course, such an OO architecture is not worth doing in every case... only in critical cases. Then I eventually found functional programming. And if you read the followup post about "functional architecture", much of the overhead of "ports and adapters" is no longer present when it's done functional. For instance, single method interfaces are common in "ports and adapters" in OO languages, but in FP those are just functions. You probably don't even need to define a type alias. You get the benefits of dependency injection with almost none of the traditional overhead as seen in OO "ports and adapters". -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
